SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.05969 · 2023

Localizing Model Behavior with Path Patching

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 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; 0 honoured the contract we drafted, 0 violated it and 10 have no contract verdict; 0 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/2304.05969.json · badge: /api/ran/2304.05969.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
redwoodresearch/rust_circuit_public canonical (classifier label)
classifier basis: census
10 ran · 3 no recorded run
FunctionStatusWhere it lives
check_cast Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/py_utils.py
code served (permissive licence) · get_code("45d0115e5f739bf8")
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 MyClass. 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)

# The function check_cast takes:
# - cls: a class to check isinstance against
# - c: an object to check
# - exception: an exception type to raise (default TypeError)

# For a successful case, we pass an instance that matches the class
class MyClass:
    pass

instance = MyClass()

ARGS = {
    'cls': MyClass,
    'c': instance,
    'exception': TypeError
}
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 MyClass — a MyClass output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MyClass 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
cum_name_to_eps_name Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/cum_algo.py
code served (permissive licence) · get_code("1a02c7bfaa2b8388")
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
import numpy as np

# The function takes a single string parameter 'cum_name'
# It checks if the first character is 'k' and replaces it with 'eps'
# Otherwise it appends '_eps' to the string

# Test cases for different inputs
ARGS = {
    'cum_name': 'k_some_name'
}
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 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
dedup_with_order Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/algebric_rewrite.py
code served (permissive licence) · get_code("39872ad6e0f9c6ca")
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
from typing import Iterable, List, TypeVar

T = TypeVar('T')

def dedup_with_order(seq: Iterable[T]) -> List[T]:
    seen = set()
    out: List[T] = []
    for x in seq:
        if x in seen:
            continue
        else:
            seen.add(x)
            out.append(x)
    return out

# Test sequences with hashable elements
test_seq_1 = [1, 2, 3, 2, 1, 4, 5, 4]
test_seq_2 = ['a', 'b', 'c', 'b', 'a', 'd']
test_seq_3 = [1, 1, 1, 2, 2, 3]

ARGS = {
    "seq": test_seq_1
}
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_tensor_shape Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/rr_util/rust_circuit_type_utils.py
code served (permissive licence) · get_code("bd83c07b355d6df4")
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 torch.nn.functional

torch.manual_seed(0)

# Create a small tensor with distinct dimensions for probing
x = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    'x': x
}
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
map Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/optional.py
code served (permissive licence) · get_code("8f38ed9a551bc6bc")
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
import torch.nn as nn

torch.manual_seed(0)

# The function map takes an optional value x and a callable f
# If x is not None, it applies f(x) and returns the result
# Otherwise it returns None

# Define test values
test_value = "hello"
test_function = lambda s: s.upper()

ARGS = {
    "x": test_value,
    "f": test_function
}
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
maybe_dtype_to_maybe_string Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/rr_util/rust_circuit_type_utils.py
code served (permissive licence) · get_code("b8768128ba49da6e")
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
import torch.nn.functional

torch.manual_seed(0)

dtype_from_string = {'float32': torch.float32, 'float64': torch.float64, 'float16': torch.float16, 'bfloat16': torch.bfloat16, 'int64': torch.int64, 'int32': torch.int32, 'int16': torch.int16, 'int8': torch.int8, 'bool': torch.bool, 'uint8': torch.uint8}

dtype_to_string = {v: k for k, v in dtype_from_string.items()}

def maybe_dtype_to_maybe_string(x):
    return dtype_to_string.get(x)

# Test with a valid dtype
ARGS = {
    'x': torch.float32
}
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
normalize_index Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/algebric_rewrite.py
code served (permissive licence) · get_code("35ca6e3dd2e5742c")
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 numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - normalize_index takes two parameters: i (int) and count (int)
# - i is an index that can be positive or negative
# - count is the size/length
# - The function validates that i is within valid range and returns i % count

# Valid test case: positive index within range
i = 2
count = 5

ARGS = {
    "i": i,
    "count": count
}
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 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
scalar_to_tensor Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/rr_util/rust_circuit_type_utils.py
code served (permissive licence) · get_code("32014b3f5ce2b2b7")
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 3, dtype family float, shape (2, 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 torch.nn.functional

torch.manual_seed(0)

# Define a stand-in class for device_dtype that has device and dtype attributes
class DeviceDtype:
    def __init__(self, device, dtype):
        self.device = device
        self.dtype = dtype

# Create arguments for the function
scalar = 5.0
shape = (2, 4, 3)
device_dtype = DeviceDtype(device='cpu', dtype='float32')

ARGS = {
    'scalar': scalar,
    'shape': shape,
    'device_dtype': device_dtype
}
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 3, dtype family float, shape (2, 4, 3) — shape (2, 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
unwrap Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/optional.py
code served (permissive licence) · get_code("4cab52cbaf461422")
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
from typing import Optional, TypeVar

T = TypeVar('T')

def unwrap(x: Optional[T], error: str='') -> T:
    assert x is not None, error
    return x

# The function takes an optional value x and an optional error message
# It asserts that x is not None, optionally using the error message
# Then returns x

# Setup: create valid arguments
test_value = 42  # A non-None value
error_message = 'Value cannot be None'

ARGS = {
    'x': test_value,
    'error': error_message
}
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
unwrap_or Ran
ran on a synthesized input
redwoodresearch/rust_circuit_public/python/rust_circuit/optional.py
code served (permissive licence) · get_code("0b29322d64014266")
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
from typing import Optional, TypeVar

torch.manual_seed(0)

T = TypeVar('T')

def unwrap_or(x: Optional[T], default: T) -> T:
    if x is None:
        return default
    return x

# Test with different types
# Case 1: x is None, default is an int
x_value_1 = None
default_value_1 = 42

# Case 2: x is a string, default is also a string
x_value_2 = "hello"
default_value_2 = "world"

# Case 3: x is a tensor, default is also a tensor
x_tensor = torch.randn(2, 4)
default_tensor = torch.randn(2, 4)

# Case 4: x is a list, default is also a list
x_list = [1, 2, 3]
default_list = [4, 5, 6]

# Build ARGS for the primary test case
ARGS = {
    'x': None,
    'default': 42
}
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
from_converted Not yet run
unverified (harvested, no recorded run)
redwoodresearch/rust_circuit_public/python/rust_circuit/jax_to_module.py
code served (permissive licence) · get_code("383f1fbd21776cf4")
How it ran

no invocation recorded.

from_converted_tup Not yet run
unverified (harvested, no recorded run)
redwoodresearch/rust_circuit_public/python/rust_circuit/jax_to_module.py
code served (permissive licence) · get_code("d3d17b52b27c0023")
How it ran

no invocation recorded.

py_generalfunction_get_shape Not yet run
unverified (harvested, no recorded run)
redwoodresearch/rust_circuit_public/python/rust_circuit/interop_rust.py
code served (permissive licence) · get_code("ea9e811ba6f76498")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 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 13 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

Localizing behaviors of neural networks to a subset of the network's components or a subset of interactions between components is a natural first step towards analyzing network mechanisms and possible failure modes. Existing work is often qualitative and ad-hoc, and there is no consensus on the appropriate way to evaluate localization claims. We introduce path patching, a technique for expressing and quantitatively testing a natural class of hypotheses expressing that behaviors are localized to a set of paths. We refine an explanation of induction heads, characterize a behavior of GPT-2, and open source a framework for efficiently running similar experiments.

For agents

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

get_harvested_code_for_paper("2304.05969")
get_code_for_paper("2304.05969")
have("2304.05969")

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

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

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

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

Connect an agent — have() is free.