SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.02636 · EMNLP · 2024

Can Large Language Models Learn Independent Causal Mechanisms?

Michael Witbrock, Gillian Dobbie, Alex Peng, Gaël Gendron, Bao Nguyen

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2402.02636.json · badge: /api/ran/2402.02636.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Strong-AI-Lab/Logical-and-abstract-reasoning canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
convert_examples_to_features Ran
ran; our contract draft was wrong, not the code
Strong-AI-Lab/Logical-and-abstract-reasoning/models/utils_multiple_choice.py
code served (permissive licence) · get_code("90ea10eb1aa031b1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
from typing import List
from unittest.mock import Mock

# Configure logging
logging.basicConfig(level=logging.INFO)

class InputExample(object):
    """A single training/test example for multiple choice"""

    def __init__(self, example_id, question, contexts, endings, label=None):
        self.example_id = example_id
        self.question = question
        self.contexts = contexts
        self.endings = endings
        self.label = label

class MockTokenizer:
    """Minimal tokenizer mock that implements encode_plus"""
    
    def encode_plus(self, text_a, text_b, add_special_tokens=True, max_length=128, 
                   pad_to_max_length=True, return_attention_mask=True, 
                   return_token_type_ids=True):
        # Create dummy tokens
        tokens = text_a.split() + text_b.split() if text_b else text_a.split()
        # Ensure we have enough tokens, pad or truncate to max_length
        input_ids = [101] + [1000 + i % 1000 for i in range(max_length - 2)] + [102]
        input_ids = input_ids[:max_length]
        input_ids = input_ids + [0] * (max_length - len(input_ids))
        
        attention_mask = [1] * len(tokens[:max_length-2]) + [1, 1] + [0] * (max_length - len(tokens) - 2)
        attention_mask = attention_mask[:max_length]
        attention_mask = attention_mask + [0] * (max_length - len(attention_mask))
        
        token_type_ids = [0] * (max_length // 2) + [1] * (max_length - max_length // 2)
        
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask,
            'token_type_ids': token_type_ids
        }

# Create example data
examples = [
    InputExample(
        example_id="example_1",
        question="What is the color of the sky?",
        contexts=["The sky is vast and beautiful.", "Birds fly high in the air."],
        endings=["blue", "red"],
        label="blue"
    ),
    InputExample(
        example_id="example_2",
        question="What do you see in the _?",
        contexts=["Looking up at the heavens.", "Down below on the ground."],
        endings=["sky", "earth"],
        label="sky"
    )
]

label_list = ["blue", "red", "sky", "earth"]
max_length = 32
tokenizer = MockTokenizer()

ARGS = {
    "examples": examples,
    "label_list": label_list,
    "max_length": max_length,
    "tokenizer": tokenizer,
    "pad_token_segment_id": 0,
    "pad_on_left": False,
    "pad_token": 0,
    "mask_padding_with_zero": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
corrupt_bench Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Strong-AI-Lab/Logical-and-abstract-reasoning/src/evaluate/information_gain.py
code served (permissive licence) · get_code("266daa7219ccdd1d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

def corrupt_bench(x):
    if len(x) == 0:
        return [random.randint(0, 10)]
    else:
        cx = x.copy()
        while x == cx:
            cx = [random.randint(0, 10) for _ in range(len(x))]
        return cx

# The function expects x to be a list-like object that supports:
# - len(x)
# - x.copy()
# - equality comparison (x == cx)
# - iteration for list comprehension

ARGS = {
    "x": [3, 7, 2, 5, 1]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
corrupt_pvr Ran
ran, honoured the contract we drafted
Strong-AI-Lab/Logical-and-abstract-reasoning/src/evaluate/information_gain.py
code served (permissive licence) · get_code("237c07af276bf442")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

def corrupt_pvr(x):
    return random.choice(list(set(range(0, 10)) ^ {int(x)}))

# The function takes a single parameter x
# It converts x to int, computes the symmetric difference with range(0,10)
# and returns a random choice from that set

# x should be something convertible to int
# Let's use a small integer value
x = 5

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_example_symbolic Ran
ran; our contract draft was wrong, not the code
Strong-AI-Lab/Logical-and-abstract-reasoning/src/evaluate/causal_induction_identification.py
code served (permissive licence) · get_code("fbc6ef16f2c20b2a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

LIGHT_DICT_SYMB = {'off': 0, 'undetermined': 1, 'on': 2}

def get_example_symbolic(objects, light_state):
    return [{'role': 'system', 'content': f'{str(objects)} -> {LIGHT_DICT_SYMB[light_state]}'}]

# Setup: objects can be any object that has a valid string representation
objects = ['lamp', 'switch', 'bulb']

# light_state must be one of the keys in LIGHT_DICT_SYMB
light_state = 'on'

ARGS = {
    'objects': objects,
    'light_state': light_state
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_trial_symbolic Ran
ran; our contract draft was wrong, not the code
Strong-AI-Lab/Logical-and-abstract-reasoning/src/evaluate/causal_induction_identification.py
code served (permissive licence) · get_code("a099bb4dec45b409")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - objects: used in str(objects), can be any Python object
# - label: returned as-is, can be any value

# Simple objects for the function
objects = {"key": "value", "number": 42, "list": [1, 2, 3]}
label = "test_label"

ARGS = {
    "objects": objects,
    "label": label
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_input_symbolic Ran
ran; our contract draft was wrong, not the code
Strong-AI-Lab/Logical-and-abstract-reasoning/src/evaluate/causal_induction_identification.py
code served (permissive licence) · get_code("0f3995390250c44f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def parse_input_symbolic(s, nb_remove=4):
    s = re.sub('\\{(.*?)\\}, ', '', s, count=nb_remove)
    return s

# Construct valid arguments for parse_input_symbolic
ARGS = {
    's': '{foo}, {bar}, {baz}, {qux}, keep this',
    'nb_remove': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
select_field Not yet run
unverified (harvested, no recorded run)
Strong-AI-Lab/Logical-and-abstract-reasoning/models/run_multiple_choice.py
pointer only (licence: MIT); the stored copy get_code serves, from yuweihao/reclor, is pointer only (licence: NONE) · get_code("0a546b305d274996")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yuweihao/reclor, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

simple_accuracy Not yet run
unverified (harvested, no recorded run)
Strong-AI-Lab/Logical-and-abstract-reasoning/models/run_multiple_choice.py
code served (permissive licence) · get_code("3c241ecfe3749a6d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 1 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
simple_accuracy 59 other papers
56 dated earlier, 2 later, 1 same year, order not determinable
1506.05865 (2015-06)
LCSTS: A Large Scale Chinese Short Text Summarization Dataset
1509.01626 (2015-09)
Character-level Convolutional Networks for Text Classification *
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 56 more not named here
select_field 9 other papers
8 dated earlier, 1 same year, order not determinable
1908.05739 (2019-08)
Abductive Commonsense Reasoning
2002.04326 (2020-02)
ReClor: A Reading Comprehension Dataset Requiring Logical Reasoning
2004.04494 (2020-04)
MuTual: A Dataset for Multi-Turn Dialogue Reasoning
and 6 more not named here
convert_examples_to_features 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning
corrupt_bench 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning
corrupt_pvr 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning
get_example_symbolic 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning
get_trial_symbolic 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning
parse_input_symbolic 1 other paper
1 dated earlier
2310.09430 (2023-10)
Assessing and Enhancing the Robustness of Large Language Models with Task Structure Variations for Logical Reasoning

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Despite impressive performance on language modelling and complex reasoning tasks, Large Language Models (LLMs) fall short on the same tasks in uncommon settings or with distribution shifts, exhibiting a lack of generalisation ability. By contrast, systems such as causal models, that learn abstract variables and causal relationships, can demonstrate increased robustness against changes in the distribution. One reason for this success is the existence and use of Independent Causal Mechanisms (ICMs) representing high-level concepts that only sparsely interact. In this work, we apply two concepts from causality to learn ICMs within LLMs. We develop a new LLM architecture composed of multiple sparsely interacting language modelling modules. We show that such causal constraints can improve out-ofdistribution performance on abstract and causal reasoning tasks. We also investigate the level of independence and domain specialisation and show that LLMs rely on pre-trained partially domain-invariant mechanisms resilient to finetuning.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2402.02636")
get_code_for_paper("2402.02636")
have("2402.02636")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2402.02636.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2402.02636.svg)](https://syntology.ai/paper/2402.02636)

Connect an agent — have() is free.