SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.14491 · EMNLP · 2023

Towards a Mechanistic Interpretation of Multi-Step Reasoning Capabilities of Language Models

Wangchunshu Zhou, Mrinmaya Sachan, Antoine Bosselut, Yifan Hou, Alessandro Stolfo, U Irvine, Guangtao Zeng, Jiaoda Li, Sutd, Yu Fei, Aiwaves

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2310.14491.json · badge: /api/ran/2310.14491.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
yifan-h/mechanisticprobe canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
avg Ran
ran, violated the contract we drafted
yifan-h/mechanisticprobe/src/utils.py
code served (permissive licence) · get_code("272fccc7faf0215a")
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 float, ndim 0, dtype family float, 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 torch

torch.manual_seed(0)

# The function avg(l) takes a list l, checks its length, 
# and returns the sum divided by length, or 0 if empty.
# It works with any numeric type that supports len(), sum(), and division.

# Create a simple list of numbers
l = [1.0, 2.0, 3.0, 4.0, 5.0]

ARGS = {
    "l": l
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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_head_mask Ran
ran; our contract draft was wrong, not the code
yifan-h/mechanisticprobe/src/stask/prune.py
code served (permissive licence) · get_code("3ee83ac3291341c4")
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 Tensor, ndim 2, dtype family float, shape (4, 3) 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 torch
import random
import numpy as np
from scipy.stats import entropy

torch.manual_seed(0)
random.seed(0)
np.random.seed(0)

# Create a small entropy matrix (4 layers, 3 heads)
e = np.array([
    [0.5, 0.3, 0.8],
    [0.2, 0.6, 0.4],
    [0.7, 0.1, 0.9],
    [0.4, 0.5, 0.2]
], dtype=np.float32)

ARGS = {
    'e': e,
    'p': 25,
    'drop': 'min'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) 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_label_idx Ran
ran, honoured the contract we drafted
yifan-h/mechanisticprobe/src/utils.py
code served (permissive licence) · get_code("42783df89e16edd3")
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 torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - data: needs to be a list of strings where each string can be split by ' '
# - label: needs to be a list of strings that appear in the corresponding data strings
# - The function splits each data string by spaces, then finds the index of label[i] in data_list[i]

data = [
    "apple banana cherry date",
    "red green blue yellow"
]

label = [
    "banana",
    "blue"
]

ARGS = {
    "data": data,
    "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 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
get_proof_graph Ran
ran; our contract draft was wrong, not the code
yifan-h/mechanisticprobe/src/proofparser.py
code served (permissive licence) · get_code("c13d0749a5472646")
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.

# Setup code to construct valid arguments for get_proof_graph function

# The function takes a single parameter: proof_str (a string representing a proof structure)
# Looking at the function body, it:
# - Replaces parentheses and splits the string
# - Processes tokens including '(', ')', '[', ']', '->', and node names
# - Builds a graph of nodes and edges

# Create a valid proof string that exercises the function logic
proof_str = "(node1 -> node2 (node3 -> node4))"

ARGS = {
    "proof_str": proof_str
}
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 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
get_proof_graph_with_fail Ran
ran; our contract draft was wrong, not the code
yifan-h/mechanisticprobe/src/proofparser.py
code served (permissive licence) · get_code("5621c0d34ff2bff6")
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

def get_proof_graph_with_fail(proof_str):
    proof_str = proof_str[:-2].split('=')[1].strip()[1:-1]
    nodes = proof_str.split(' <- ')
    all_nodes = []
    all_edges = []
    for i in range(len(nodes) - 1):
        all_nodes.append(nodes[i])
        if nodes[i + 1] != 'FAIL':
            all_edges.append((nodes[i + 1], nodes[i]))
    return (all_nodes, all_edges)


# Construct a valid proof_str argument
# The function expects a string that ends with "= [...]"
# Inside the brackets are nodes separated by " <- "
# Example: "proof= [node1 <- node2 <- node3 <- FAIL]"
proof_str = "proof= [step1 <- step2 <- step3 <- FAIL]"

ARGS = {
    "proof_str": proof_str
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
label_generator Ran
ran; our contract draft was wrong, not the code
yifan-h/mechanisticprobe/src/stask/probe.py
code served (permissive licence) · get_code("b70c417c1146f460")
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

torch.manual_seed(0)

# Analyzing the function:
# - data: a string of space-separated numbers
# - task_name: an integer used in range(task_name + 1) and comparisons
# - pred_type: a string that is either 'noise' or something else

ARGS = {
    "data": "3 1 2 0",
    "task_name": 3,
    "pred_type": "noise"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
knn_classifier Not yet run
unverified (harvested, no recorded run)
yifan-h/mechanisticprobe/src/stask/probe.py
code served (permissive licence) · get_code("5b2bb4a3ea7d3329")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 4 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
get_proof_graph 3 other papers
3 dated earlier
2010.02830 (2020-10)
PROVER: Proof Generation for Interpretable Reasoning over Rules
2106.01354 (2021-06)
MULTIPROVER: Generating Multiple Proofs for Improved Interpretability in Rule Reasoning
2203.10261 (2022-03)
FaiRR: Faithful and Robust Deductive Reasoning over Natural Language
get_proof_graph_with_fail 2 other papers
2 dated earlier
2010.02830 (2020-10)
PROVER: Proof Generation for Interpretable Reasoning over Rules
2106.01354 (2021-06)
MULTIPROVER: Generating Multiple Proofs for Improved Interpretability in Rule Reasoning
avg 1 other paper
1 later
2406.04216 (2024-06)
What Do Language Models Learn in Context? The Structured Task Hypothesis

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-23.

Repositories linked to this paper

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

Abstract

Recent work has shown that language models (LMs) have strong multi-step (i.e., procedural) reasoning capabilities. However, it is unclear whether LMs perform these tasks by cheating with answers memorized from pretraining corpus, or, via a multi-step reasoning mechanism. In this paper, we try to answer this question by exploring a mechanistic interpretation of LMs for multi-step reasoning tasks. Concretely, we hypothesize that the LM implicitly embeds a reasoning tree resembling the correct reasoning process within it. We test this hypothesis by introducing a new probing approach (called MechanisticProbe) that recovers the reasoning tree from the model's attention patterns. We use our probe to analyze two LMs: GPT-2 on a synthetic task (k-th smallest element), and LLaMA on two simple language-based reasoning tasks (ProofWriter & AI2 Reasoning Challenge). We show that MechanisticProbe is able to detect the information of the reasoning tree from the model's attentions for most examples, suggesting that the LM indeed is going through a process of multi-step reasoning within its architecture in many cases. 1

For agents

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

get_harvested_code_for_paper("2310.14491")
get_code_for_paper("2310.14491")
have("2310.14491")

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

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

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

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

Connect an agent — have() is free.