SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2609.03003 · September 2026

Causal Foundation Models

Jesse Cresswell, Hossein Rahmani, Christopher Stith, Jesse C. Cresswell

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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2609.03003.json · badge: /api/ran/2609.03003.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
layer6ai-labs/cfms canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
ate_abs_error Ran
ran, honoured the contract we drafted
layer6ai-labs/cfms/causal_bench/metrics.py
code served (permissive licence) · get_code("30751be05fb1aa94")
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
import numpy as np

torch.manual_seed(0)

# The function ate_abs_error takes two float parameters:
# ate_hat: estimated average treatment effect
# ate_true: true average treatment effect
# It returns the absolute difference between them

ARGS = {
    "ate_hat": 0.75,
    "ate_true": 0.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 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
ate_rel_error Ran
ran, honoured the contract we drafted
layer6ai-labs/cfms/causal_bench/metrics.py
code served (permissive licence) · get_code("29836352f77449c1")
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
import numpy as np

torch.manual_seed(0)

# ate_rel_error computes relative error between estimated and true ATE (Average Treatment Effect)
# Parameters:
# - ate_hat: float, estimated ATE value
# - ate_true: float, true ATE value
# - eps: float, small epsilon to avoid division by zero (default 1e-08)

ARGS = {
    "ate_hat": 0.5,
    "ate_true": 0.48,
    "eps": 1e-08
}
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 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
make_iv_binary Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/cfms/causal_bench/data_generators.py
code served (permissive licence) · get_code("fb30929b6ac05f34")
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 SyntheticDataset. 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
from dataclasses import dataclass, field
from typing import Callable, Dict, Any

@dataclass
class SyntheticDataset:
    name: str
    X: np.ndarray
    T: np.ndarray
    Y: np.ndarray
    Y0: np.ndarray
    Y1: np.ndarray
    tau: np.ndarray
    ate: float
    meta: Dict[str, Any] = field(default_factory=dict)

    def train_test_split(self, train_frac: float=0.7, seed: int=0):
        n = len(self.Y)
        rng = np.random.RandomState(seed)
        idx = rng.permutation(n)
        n_train = int(train_frac * n)
        train_idx, test_idx = (idx[:n_train], idx[n_train:])
        return (train_idx, test_idx)

def _sigmoid(x):
    return 1.0 / (1.0 + np.exp(-x))

def make_iv_binary(n=2000, d=4, seed=0) -> SyntheticDataset:
    rng = np.random.RandomState(seed)
    X = rng.normal(0, 1, size=(n, d)).astype(np.float32)
    U = rng.normal(0, 1, size=n).astype(np.float32)
    Z = rng.binomial(1, 0.5, size=n).astype(np.float32)
    t_logits = 1.5 * Z + 1.0 * U + 0.2 * X[:, 0]
    p = _sigmoid(t_logits)
    T = rng.binomial(1, p).astype(np.float32)
    tau_const = 1.5
    noise = rng.normal(0, 0.5, size=n).astype(np.float32)
    Y0 = 0.5 * X[:, 0] - 0.5 * X[:, 1] + 1.0 * U + noise
    Y1 = Y0 + tau_const
    Y = np.where(T == 1, Y1, Y0).astype(np.float32)
    tau = (Y1 - Y0).astype(np.float32)
    X_with_Z = np.concatenate([X, Z.reshape(-1, 1)], axis=1).astype(np.float32)
    ds = SyntheticDataset(name='iv_binary', X=X_with_Z, T=T, Y=Y, Y0=Y0, Y1=Y1, tau=tau, ate=float(np.mean(tau)), meta=dict(identification='iv', heterogeneous=False, d=d + 1, instrument_col=d, confounded=True))
    return ds

ARGS = {
    'n': 100,
    'd': 4,
    'seed': 42
}
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 SyntheticDataset — a SyntheticDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SyntheticDataset 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_linear_confounded Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/cfms/causal_bench/data_generators.py
code served (permissive licence) · get_code("b84c34affea805f7")
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 SyntheticDataset. 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

ARGS = {
    'n': 100,
    'd': 5,
    'seed': 42,
}
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 SyntheticDataset — a SyntheticDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SyntheticDataset 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_nonlinear_heterogeneous Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/cfms/causal_bench/data_generators.py
code served (permissive licence) · get_code("437222c48a93b976")
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 SyntheticDataset. 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
from dataclasses import dataclass, field
from typing import Dict, Any

@dataclass
class SyntheticDataset:
    name: str
    X: np.ndarray
    T: np.ndarray
    Y: np.ndarray
    Y0: np.ndarray
    Y1: np.ndarray
    tau: np.ndarray
    ate: float
    meta: Dict[str, Any] = field(default_factory=dict)

    def train_test_split(self, train_frac: float=0.7, seed: int=0):
        n = len(self.Y)
        rng = np.random.RandomState(seed)
        idx = rng.permutation(n)
        n_train = int(train_frac * n)
        train_idx, test_idx = (idx[:n_train], idx[n_train:])
        return (train_idx, test_idx)

def _sigmoid(x):
    return 1.0 / (1.0 + np.exp(-x))

def make_nonlinear_heterogeneous(n=2000, d=6, seed=0) -> SyntheticDataset:
    """
    Nonlinear response surfaces with heterogeneous treatment effect
    that depends on covariates (sine + interaction term), as used in
    e.g. CausalPFN's README example.
    """
    rng = np.random.RandomState(seed)
    X = rng.normal(1, 1, size=(n, d)).astype(np.float32)

    def true_cate(x):
        return np.sin(x[:, 0]) + 0.5 * x[:, 1]
    tau = true_cate(X).astype(np.float32)
    logits = 0.4 * (X[:, 2] - 1.0)
    p = _sigmoid(logits)
    T = rng.binomial(1, p).astype(np.float32)
    noise = rng.normal(0, 0.1, size=n).astype(np.float32)
    Y0 = X[:, 0] - X[:, 1] + 0.3 * X[:, 3] ** 2 + noise
    Y1 = Y0 + tau
    Y = np.where(T == 1, Y1, Y0).astype(np.float32)
    return SyntheticDataset(name='nonlinear_heterogeneous', X=X, T=T, Y=Y, Y0=Y0, Y1=Y1, tau=tau, ate=float(np.mean(tau)), meta=dict(identification='backdoor', heterogeneous=True, d=d))

ARGS = {
    'n': 50,
    'd': 4,
    'seed': 42,
}
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 SyntheticDataset — a SyntheticDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SyntheticDataset 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
pehe Ran
ran, honoured the contract we drafted
layer6ai-labs/cfms/causal_bench/metrics.py
code served (permissive licence) · get_code("b3b16c892c13588b")
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 numpy as np

# The pehe function computes the square root of mean squared error between
# predicted treatment effects (tau_hat) and true treatment effects (tau_true).
# Both parameters should be 1D or 2D numpy arrays of the same shape.

# Create small example arrays
np.random.seed(0)

# Generate predicted treatment effects (4 samples)
tau_hat = np.random.randn(4)

# Generate true treatment effects (4 samples)
tau_true = np.random.randn(4)

ARGS = {
    "tau_hat": tau_hat,
    "tau_true": tau_true,
}
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 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
load_lalonde Not yet run
unverified (harvested, no recorded run)
layer6ai-labs/cfms/causal_bench/data_loader.py
code served (permissive licence) · get_code("c005a4862ceef19a")
How it ran

no invocation recorded.

load_lalonde_realcause Not yet run
unverified (harvested, no recorded run)
layer6ai-labs/cfms/causal_bench/data_loader.py
code served (permissive licence) · get_code("fca2ab616911a7f8")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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

Causal inference is the practice of estimating the effect of a treatment or intervention from data. It traditionally requires a bespoke pipeline for every new problem: first proposing a causal mechanism, selecting a compatible estimator, and finally training it. Meanwhile, across diverse settings and modalities, much of machine learning has shifted to the paradigm of foundation models: networks pretrained once at scale and applied to new tasks without fine-tuning. Causal foundation models (CFMs) bring this paradigm to causal inference. CFMs are pretrained neural networks that estimate causal quantities, such as the average treatment effect, on entirely new datasets using in-context learning without requiring model updates. This work provides a practical introduction to this emerging area. We summarize the necessary background in causal inference and machine learning before discussing CFMs. Throughout, we include example code and Jupyter notebooks.

For agents

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

get_harvested_code_for_paper("2609.03003")
get_code_for_paper("2609.03003")
have("2609.03003")

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

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

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

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

Connect an agent — have() is free.