SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.03268 · ICML · 2024

Understanding the Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregation

Xinyi Wang, Wenhu Chen, William Wang, Kexun Zhang, Liangming Pan, Alfonso Amayuelas

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 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.03268.json · badge: /api/ran/2402.03268.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
wangxinyilinda/lm_random_walk canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
KL Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wangxinyilinda/lm_random_walk/kg_reasoning/analysis.py
code served (permissive licence) · get_code("bd677ad1a63e9ad4")
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 float64, ndim 0, 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 numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Create small probability distributions
# P and Q should be 1D arrays of probabilities that sum to approximately 1
P = np.array([0.1, 0.2, 0.3, 0.4])
Q = np.array([0.15, 0.25, 0.25, 0.35])

# Ensure they're valid probability distributions (non-negative, avoid exact zeros)
P = np.abs(P) + 0.001
Q = np.abs(Q) + 0.001
P = P / P.sum()
Q = Q / Q.sum()

ARGS = {
    "P": P,
    "Q": Q,
    "epsilon": 0.0001
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
aggragate Ran
ran; our contract draft was wrong, not the code
wangxinyilinda/lm_random_walk/kg_reasoning/analysis.py
code served (permissive licence) · get_code("0b845d4db5d929b1")
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 numpy as np

# Analyze the function:
# - ps: iterable of values that support += operation (numpy arrays, numbers, etc.)
# - ids: iterable of hashable keys (integers, strings, etc.)
# - Both are zipped together, so same length
# - The function aggregates ps values by their corresponding id keys

# Create simple numeric arrays for ps and integer ids
ps = [np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8]), np.array([10, 20, 30, 40])]
ids = [0, 1, 0]  # ids 0 appears twice, so values will be aggregated

ARGS = {
    "ps": ps,
    "ids": ids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
eval_with_timeout Ran
ran, honoured the contract we drafted
wangxinyilinda/lm_random_walk/cot_reasoning/calculator.py
code served (permissive licence) · get_code("25d344d4b993934e")
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 torch
import signal

torch.manual_seed(0)

# The function eval_with_timeout takes a formula string and an optional max_time integer
# The formula is evaluated using Python's eval() function
# max_time is the timeout duration in seconds

# Valid formula examples that won't timeout
formula = "2 + 2"
max_time = 3

ARGS = {
    "formula": formula,
    "max_time": max_time
}
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 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
make_random_walk_data_module Ran
ran; our contract draft was wrong, not the code
wangxinyilinda/lm_random_walk/cot_reasoning/load_data/random_walk_dataset.py
code served (permissive licence) · get_code("7965884ea488bbf9")
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 dict. 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 random
from unittest.mock import Mock

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

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.eos_token_id = 2
    
    def __call__(self, texts, truncation=False):
        # Return mock tokenized inputs
        # Each text gets tokenized to a list of token ids
        input_ids = []
        for text in texts:
            # Simple mock: convert text length to token count
            tokens = [1, 0, 1] * (len(text) // 10 + 1)
            input_ids.append(tokens[:50])  # Keep reasonable length
        return {'input_ids': input_ids}

# Create a minimal graph dataset stand-in
class MinimalGraphData:
    def __init__(self):
        self.num_nodes = 5
        # graph[node_id] -> list of indices to sample from
        self.graph = {
            0: [0, 1, 2],
            1: [2, 3, 4],
            2: [1, 2, 3],
            3: [3, 4, 5],
            4: [4, 5, 6]
        }
        # cots: list of text sequences
        self.cots = [
            "step one",
            "step two",
            "step three",
            "step four",
            "step five",
            "step six",
            "step seven"
        ]
        # example_ids: which example each cot belongs to
        self.example_ids = [0, 0, 0, 1, 1, 2, 2]
        # node_ids: which node each cot is associated with
        self.node_ids = [0, 0, 1, 1, 2, 2, 3]

tokenizer = MinimalTokenizer()
dataset = MinimalGraphData()
seq_length = 64
cot_length = 3
continuous_steps = 2
max_num_eval = 100
seed = 42

ARGS = {
    "tokenizer": tokenizer,
    "dataset": dataset,
    "seq_length": seq_length,
    "cot_length": cot_length,
    "continuous_steps": continuous_steps,
    "max_num_eval": max_num_eval,
    "seed": seed
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
make_sparse_mask Ran
ran; our contract draft was wrong, not the code
wangxinyilinda/lm_random_walk/cot_reasoning/model/generation_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from mingyuj666/disentangling-memory-and-reasoning, is pointer only (licence: NONE) · get_code("d6fb9c5bed407a12")
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 mingyuj666/disentangling-memory-and-reasoning, 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. A run is recorded.

model_name_mapping Ran
ran; our contract draft was wrong, not the code
wangxinyilinda/lm_random_walk/cot_reasoning/model/utils.py
code served (permissive licence) · get_code("47f22a2c40d83dba")
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 torch

ARGS = {
    'model_name_or_path': 'meta-llama/llama-2-13b-hf'
}
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 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
parse_outputs Ran
ran, honoured the contract we drafted
wangxinyilinda/lm_random_walk/kg_reasoning/analysis.py
code served (permissive licence) · get_code("9c493833053fbfe2")
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 2, 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 tempfile
import os

# Create a temporary file with the expected format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("some line\n")
temp_file.write("hidden layer predictions: [0.1, 0.2, 0.3]\n")
temp_file.write("another line\n")
temp_file.write("hidden layer predictions: [0.4, 0.5, 0.6]\n")
temp_file.close()

ARGS = {
    'file': temp_file.name
}
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 2, 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
safe_str Ran
ran; our contract draft was wrong, not the code
wangxinyilinda/lm_random_walk/cot_reasoning/model/my_trainer.py
pointer only (licence: MIT); the stored copy get_code serves, from mingyuj666/disentangling-memory-and-reasoning, is pointer only (licence: NONE) · get_code("f7c8ecc9fe3dc748")
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 mingyuj666/disentangling-memory-and-reasoning, 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. A run is recorded.

sample Not yet run
unverified (harvested, no recorded run)
wangxinyilinda/lm_random_walk/cot_reasoning/calculator.py
code served (permissive licence) · get_code("9fffb425547e2bb7")
How it ran

no invocation recorded.

use_calculator Not yet run
unverified (harvested, no recorded run)
wangxinyilinda/lm_random_walk/cot_reasoning/calculator.py
code served (permissive licence) · get_code("aa8243de687a96f5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 6 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
eval_with_timeout 1 other paper
1 later
2405.14804 (2024-05)
Can LLMs Solve longer Math Word Problems Better?
make_sparse_mask 1 other paper
1 later
2411.13504 (2024-11)
Disentangling Memory and Reasoning Ability in Large Language Models
safe_str 1 other paper
1 later
2411.13504 (2024-11)
Disentangling Memory and Reasoning Ability in Large Language Models
use_calculator 1 other paper
1 later
2405.14804 (2024-05)
Can LLMs Solve longer Math Word Problems Better?

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

Pre-trained language models (LMs) are able to perform complex reasoning without explicit finetuning. To understand how pre-training with a next-token prediction objective contributes to the emergence of such reasoning capability, we propose that we can view an LM as deriving new conclusions by aggregating indirect reasoning paths seen at pre-training time. We found this perspective effective in two important cases of reasoning: logic reasoning with knowledge graphs (KGs) and chain-of-thought (CoT) reasoning. More specifically, we formalize the reasoning paths as random walk paths on the knowledge/reasoning graphs. Analyses of learned LM distributions suggest that a weighted sum of relevant random walk path probabilities is a reasonable way to explain how LMs reason. Experiments and analysis on multiple KG and CoT datasets reveal the effect of training on random walk paths and suggest that augmenting unlabeled random walk reasoning paths can improve real-world multi-step reasoning performance. 1 .

For agents

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

get_harvested_code_for_paper("2402.03268")
get_code_for_paper("2402.03268")
have("2402.03268")

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

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

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

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

Connect an agent — have() is free.