SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2408.06849 · 2024

Causal Agent based on Large Language Model

arXiv · PDF · Open in the Atlas

Code that ran

11 of 14 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 3 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/2408.06849.json · badge: /api/ran/2408.06849.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
kairong-han/causal_agent canonical (classifier label)
classifier basis: census
11 ran · 3 no recorded run
FunctionStatusWhere it lives
Stein_hess Ran
ran; our contract draft was wrong, not the code
kairong-han/causal_agent/SCORE-main/stein.py
code served (permissive licence) · get_code("a8a7a259db8a81b3")
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 (2, 4) 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)

# Create small sample data
# X should be a 2D tensor of shape (n, d) where n is number of samples, d is dimension
n, d = 2, 4
X = torch.randn(n, d, dtype=torch.float32)

# eta_G and eta_H are regularization parameters (scalars)
eta_G = 1e-3
eta_H = 1e-3

# s is optional bandwidth parameter (scalar or None)
s = None

ARGS = {
    "X": X,
    "eta_G": eta_G,
    "eta_H": eta_H,
    "s": s,
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
add_noise Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kairong-han/causal_agent/main_QR.py
code served (permissive licence) · get_code("bb340e38e6e61436")
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 ndarray, ndim 2, dtype family float, shape (2, 4) 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 numpy as np

np.random.seed(0)

# Create a small sample data array
data = np.random.randn(2, 4)

ARGS = {
    "data": data,
    "noise_level": 1e-08
}
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 ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
compute_top_order Ran
ran; our contract draft was wrong, not the code
kairong-han/causal_agent/SCORE-main/stein.py
code served (permissive licence) · get_code("00230c910f8f28f5")
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

torch.manual_seed(0)

# Create a small dataset: n=2 samples, d=4 dimensions
X = torch.randn(2, 4, dtype=torch.float32)

# Regularization parameters for the two inverse operations in Stein_hess
eta_G = 1e-3
eta_H = 1e-3

# Optional parameter for kernel bandwidth (will be auto-computed if None)
normalize_var = True
dispersion = 'var'

ARGS = {
    'X': X,
    'eta_G': eta_G,
    'eta_H': eta_H,
    'normalize_var': normalize_var,
    'dispersion': dispersion,
}
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 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
edge_dir Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kairong-han/causal_agent/util.py
code served (permissive licence) · get_code("9a227dfd5452fed4")
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 Edge. 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)

# The function edge_dir takes:
# - X: int (an index)
# - Y: int (an index)
# - adj1: something indexable with [X][Y] and [Y][X] that returns -1, 0, or 1

# Create a small adjacency matrix that can be indexed like adj1[X][Y]
# We'll use a 2D list/array with values from {-1, 0, 1}
adj1 = [
    [-1, 1, 0, -1],
    [1, 0, -1, 1],
    [0, -1, 1, 0],
    [-1, 1, 0, -1]
]

X = 0
Y = 1

ARGS = {
    "X": X,
    "Y": Y,
    "adj1": adj1
}
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 Edge — a Edge output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Edge 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
edge_num Ran
ran, honoured the contract we drafted
kairong-han/causal_agent/SCORE-main/demo_SCORE.py
code served (permissive licence) · get_code("63790fd8bd85e92f")
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

node_num = [i for i in range(3, 11)]

def edge_num(node_num):
    max_num = int(node_num * (node_num - 1) / 2)
    if node_num:
        return [i for i in range(0, max_num + 1)]

ARGS = {
    "node_num": 5
}
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
find_all_paths Ran
ran; our contract draft was wrong, not the code
kairong-han/causal_agent/util.py
code served (permissive licence) · get_code("541d7f28dbdb0e00")
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. 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.

# Analyze the function: find_all_paths finds all paths from node i to node j in a graph
# Parameters:
# - i: starting node (int)
# - j: ending node (int)
# - adj: adjacency list (dict mapping node to list of neighbors)
# - path: current path being built (list, default=[])

# The function uses:
# - i, j as nodes to compare for equality
# - adj as a dict to check membership (if i not in adj) and access neighbors (adj[i])
# - path as a list to append to and check membership (if node not in path)

# Create a simple adjacency list representing a graph
# Example: 0 -> [1, 2], 1 -> [2], 2 -> [3]
adj = {
    0: [1, 2],
    1: [2, 3],
    2: [3],
    3: []
}

# Start node
i = 0

# End node
j = 3

# Initial path (empty list)
path = []

ARGS = {
    "i": i,
    "j": j,
    "adj": adj,
    "path": path
}
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 — a list 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
full_DAG Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kairong-han/causal_agent/SCORE-main/utils.py
code served (permissive licence) · get_code("a86ab79ff7c3ca42")
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 ndarray, ndim 2, dtype family float, shape (4, 4) 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 numpy as np

def full_DAG(top_order):
    d = len(top_order)
    A = np.zeros((d, d))
    for i, var in enumerate(top_order):
        A[var, top_order[i + 1:]] = 1
    return A

# Construct valid arguments
# top_order should be a sequence of indices representing a topological ordering
# It needs to contain valid indices for a DAG of size d
# Example: for a DAG with 5 nodes, top_order could be [0, 1, 2, 3, 4]

top_order = [0, 1, 2, 3]

ARGS = {
    "top_order": top_order
}
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 ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) 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_name Ran
ran, honoured the contract we drafted
kairong-han/causal_agent/dataset_gt.py
code served (permissive licence) · get_code("5f47c429ede66b1c")
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

torch.manual_seed(0)

to_find = ['apple', 'cherry']
name_list = ['apple', 'banana', 'cherry', 'date']

ARGS = {
    'to_find': to_find,
    'name_list': name_list
}
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 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
np_to_csv Ran
ran; our contract draft was wrong, not the code
kairong-han/causal_agent/SCORE-main/utils.py
code served (permissive licence) · get_code("7f33c8711d7b2d37")
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 numpy as np
import tempfile
import os

# Create a temporary directory for the save_path
temp_dir = tempfile.mkdtemp()
save_path = os.path.join(temp_dir, 'output.csv')

# Create a small numpy array
array = np.array([[1, 2, 3, 4],
                  [5, 6, 7, 8],
                  [9, 10, 11, 12]])

ARGS = {
    'array': array,
    'save_path': save_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
simulate_dag Ran
ran, honoured the contract we drafted
kairong-han/causal_agent/SCORE-main/utils.py
code served (permissive licence) · get_code("003d81116b4a4fb5")
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 ndarray, ndim 2, dtype family float, shape (5, 5) 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 numpy as np
import igraph as ig

ARGS = {
    'd': 5,
    's0': 8,
    'graph_type': 'ER',
    'triu': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
igraph, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (5, 5) — shape (5, 5) 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
triangle_to_adj Ran
ran; our contract draft was wrong, not the code
kairong-han/causal_agent/util.py
code served (permissive licence) · get_code("b036a30566ea1159")
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 numpy as np

torch.manual_seed(0)

# The function takes a 'triangle' parameter which is iterated over with len()
# and indexed with [i]. Each element triangle[i] is iterated with enumerate()
# to check if values != 0. This suggests triangle is a 2D structure (list of lists,
# numpy array, or tensor) where each row contains numeric values.

# Create a small triangle/matrix with some zero and non-zero values
triangle = [
    [1, 0, 3, 0],
    [0, 2, 0, 4],
    [5, 0, 0, 6],
    [0, 0, 7, 0]
]

ARGS = {
    "triangle": triangle
}
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 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
Stein_pruning Not yet run
unverified (harvested, no recorded run)
kairong-han/causal_agent/SCORE-main/stein.py
code served (permissive licence) · get_code("5da3b16530d01830")
How it ran

no invocation recorded.

generate Not yet run
unverified (harvested, no recorded run)
kairong-han/causal_agent/SCORE-main/demo_SCORE.py
code served (permissive licence) · get_code("1c31ede173ef4356")
How it ran

no invocation recorded.

get_code_result Not yet run
unverified (harvested, no recorded run)
kairong-han/causal_agent/baseline-codellm.py
code served (permissive licence) · get_code("55e01338dc26c5f7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 later) and 11 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
full_DAG 2 other papers
1 dated earlier, 1 later
2308.07480 (2023-08)
Order-based Structure Learning with Normalizing Flows
2605.17465 (2026-05)
TriOpt: A Scalable Algorithm for Linear Causal Discovery
Stein_hess 1 other paper
1 dated earlier
2309.01392 (2023-09)
Differentiable Bayesian Structure Learning with Acyclicity Assurance
compute_top_order 1 other paper
1 dated earlier
2309.01392 (2023-09)
Differentiable Bayesian Structure Learning with Acyclicity Assurance

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

The large language model (LLM) has achieved significant success across various domains. However, the inherent complexity of causal problems and causal theory poses challenges in accurately describing them in natural language, making it difficult for LLM to comprehend and use them effectively. Causal methods are not easily conveyed through natural language, which hinders LLM's ability to apply them accurately. Additionally, causal datasets are typically tabular, while LLM excels in handling natural language data, creating a structural mismatch that impedes effective reasoning with tabular data. To address these challenges, we have equipped the LLM with causal tools within an agent framework, named the Causal Agent, enabling it to tackle causal problems. The causal agent comprises tools, memory, and reasoning modules. In the tool module, the causal agent calls Python code and uses the encapsulated causal function module to align tabular data with natural language. In the reasoning module, the causal agent performs reasoning through multiple iterations with the tools. In the memory module, the causal agent maintains a dictionary instance where the keys are unique names and the values are causal graphs. To verify the causal ability of the causal agent, we established a Causal Tabular Question Answer (CausalTQA) benchmark consisting of four levels of causal problems: variable level, edge level, causal graph level, and causal effect level. CausalTQA consists of about 1.4K for these four levels questions. Causal agent demonstrates remarkable efficacy on the four-level causal problems, with accuracy rates all above 80\%. Through verification on the real-world dataset QRData, the causal agent is 6\% higher than the original SOTA. For further insights and implementation details, our code is accessible via the GitHub repository https://github.com/kairong-han/causal_agent.

For agents

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

get_harvested_code_for_paper("2408.06849")
get_code_for_paper("2408.06849")
have("2408.06849")

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

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

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

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

Connect an agent — have() is free.