Wang et al. 2022; Goldowsky-Dill et al. 2023
Path patching recovers a circuit by patching along specific routes. Rather than measuring whether one internal value matters overall, it patches a value only where it flows along a chosen path to the output, so it can separate a direct effect from an indirect one that passes through other components. This is the technique behind the well-known indirect-object-identification circuit in GPT-2, where it isolated exactly which heads send signals to which. We apply it to the VCS by patching along directed edges of the candidate data-flow and comparing the recovered edge set to the true routine from the disassembly. The idea is powerful because it targets the wiring, not just the nodes. On the VCS its limit is recall in a single frame. When we run it as a one-step directed do-operation, it recovers only the paths that carry a surviving signal in that single step. Many true dependencies are re-derived within the frame through other cells, so a one-step path does not carry them and the method misses them. On some games where the direct circuit is genuinely empty it matches perfectly; on others it recovers little. Path patching is thus precise about what it finds but silent about dependencies that flow through intermediate cells, a recall limit we can measure exactly against the known routine.
Two adjacency matrices over the candidate RAM cells: the true data-flow graph and the graph this method recovered. A bright cell (row = cause, column = effect) is an edge; the difference between the two panels is the error. path_circuit_F1_vs_true_routine = 0.000 — this example only (pong, state gameplay(seed=0,prefix=90)+15); the audit aggregate is below.
New to explainable AI? This block explains the method as it is used on neural networks, then how we run the very same method on an Atari 2600, where — unlike for a network — we know the right answer. Every implementation step links to the code. See also the XAI primer for the shared vocabulary.
Activation patching tells you that a component matters. It does not tell you how its influence reaches the output. Component A might act on the output directly, or it might only matter because it changes component B, which then changes the output. A circuit is the answer to that question: the small set of components and the edges (connections) between them that carry out a behaviour. To find edges you need a sharper tool.
Path patching is that tool. You change a sender component, but you let the change reach only one chosen receiver. Every other component downstream of the sender is held at the value it had in the normal run. If the output still moves, the signal must have travelled along the sender→receiver edge. This is how Wang et al. mapped the indirect-object-identification (IOI) circuit in GPT-2: which attention heads send which information to which other heads to complete “When Mary and John went to the store, John gave a drink to…” with “Mary”. On the VCS the true wiring between memory cells can be measured exactly, so we can check how much of it a path patch actually recovers.
Think of the network as a directed graph of components. A transformer’s components all read from and write to the residual stream, so every earlier head can influence every later one. Pick a sender \(s\) and a receiver \(r\). Path patching runs the clean input \(x\) with three rules: \(s\) takes its value from the corrupted input \(\tilde x\); the receiver \(r\) is recomputed normally, so it sees the corrupted \(s\); and every other component that \(s\) could reach is frozen to its clean value. Then
\[ \Delta_{s \to r} \;=\; y\big(x \,\big|\, s := s(\tilde x),\; \text{others frozen},\; r \text{ recomputed}\big) \;-\; y(x). \]A non-zero \(\Delta_{s\to r}\) means the edge \(s \to r\) carries part of the behaviour. Repeating this over pairs, working backwards from the output, builds the circuit. The result is scored as a set of edges.
Toy example. Let \(b = 2a\), \(c = a + b\), and output \(y = c\). Clean \(a = 1\): \(b = 2\), \(c = 3\). Corrupt \(a := 2\). Plain activation patching of \(a\) gives \(b = 4\), \(c = 6\), so \(\Delta_a = 3\). Now path-patch the edge \(a \to b\): let \(b\) see \(a = 2\) (so \(b = 4\)), but freeze \(a\)’s direct input to \(c\) at its clean value 1. Then \(c = 1 + 4 = 5\) and \(\Delta_{a\to b} = 2\). Path-patch the direct edge \(a \to c\) instead: \(b\) stays at 2, \(c = 2 + 2 = 4\), \(\Delta_{a\to c} = 1\). The total effect of 3 splits into an indirect part (2, via \(b\)) and a direct part (1). That split is what node-level patching cannot give you.
| A component (head) | A candidate RAM cell: a byte the game uses as a variable. |
|---|---|
| Layers | Video frames. The sender lives at frame \(f^*\), the receiver at frame \(f^*{+}1\). |
| Sender corruption | Write base+17 into the sender cell at \(f^*\). |
| Freeze all other components | After one frame, overwrite every other candidate cell with its clean value at \(f^*{+}1\); only the receiver keeps the sender’s signal. |
| Metric | Does the receiver cell’s own value differ from the clean run at the end of the 15-frame horizon? |
| Reference circuit | The true routine: the same path patch with an exhaustive set of sender values (0, base+17, base+37). An edge is true if any value fires it. |
The nodes are the game’s candidate RAM cells. Everything starts from the shared gameplay checkpoint at \(f^*\) with a 15-frame horizon. The first frame of the horizon is the sender→receiver hop, using the gameplay stream’s own next action.
base+17), the classical
single-shot path patch, over all ordered pairs of cells.Two differences from the transformer original matter. First, our “layer” is a whole frame of thousands of CPU instructions, and a cell can be read and rewritten many times inside it. Second, we freeze only the candidate cells, not every byte, CPU register or TIA register. A signal can also leak through those unfrozen parts. The runner also counts transient receivers: cells the program recomputes from scratch, so no single-frame path into them can survive to the end of the horizon.
XAI the interpretability method substrate the bit-exact emulator it runs on (jutari, Julia).
path_patching.jl:310 — One path patch: corrupt the sender, step one frame, freeze every other candidate cell, run the rest.path_patching.jl:377 — The method: single-shot path patch with one sender value per edge.path_patching.jl:353 — The reference: the same edge-restricted patch with the exhaustive value set.path_patching.jl:263 — The transitive (multi-hop) data-flow graph, recorded for context.path_patching.jl:424 — Circuit precision, recall and F1 over off-diagonal edges.path_patching.jl:493 — The sender→receiver hop uses the gameplay stream’s next action.jutari_oracle.jl:176 — The byte write used for both the sender corruption and the freeze-restore.shared_testbed_impl.jl:115 — The shared gameplay checkpoint and action stream.StellaEnvironment.jl:259 — One bit-exact frame: the one-frame hop and the remaining horizon.oracle_intervene.jl:163 — Reads the candidate cells that become the circuit’s nodes.Each game’s figure compares two adjacency matrices: the recovered edges and the true routine. Expect low recall on most games. A single sender value often fails to trip an edge that another value would. Many cells are also rebuilt by the program within the frame through other cells, so the one-step path carries no surviving signal. On games where the direct circuit is genuinely empty the method trivially matches it. On others, including the Pong state shown here, it can recover almost nothing. The positive control shows this is a real limit of the single-shot method, not a scoring bug.
julia --project=jutari tools/xai_study/phaseC_mechanistic/path_patching.jl --games core
Writes path_patching_<game>.json/.npz and a core summary into tools/xai_study/phaseC_mechanistic/out/. The exhaustive reference needs up to three re-runs per ordered cell pair, so this is the slowest of the patching runners; it can be sharded per game on the cluster (--shard i --nshards n).
Read next: Activation patching / causal mediation · ACDC — automatic circuit discovery · Attribution / edge patching · A1 · Connectomics / data-flow graph
The score is the F1 of the recovered path or circuit against the true routine's data-flow. We patch along directed edges of the candidate data-flow and compare the recovered edge set to the true routine from the disassembly, taking the harmonic mean of edge precision and recall. The grading is always against the intervention oracle's true wiring. Faithfulness for this method is that circuit F1. Run as a single-frame, one-step directed do-operation, the method recovers only the paths that carry a surviving signal in that single step. Many true dependencies are re-derived within the frame through other cells, so a one-step path does not carry them and recall suffers, which is the main limit the score reflects. On some games the direct circuit is genuinely empty and the method matches it perfectly; on others it recovers little. There is no sprite-position hard-case here, because the output is a circuit, not a coordinate. The grading is always against the oracle, never against another method. The audit box reports the measured triad across the scored games, so the F1 is an average over the scored set. Path patching is precise about the paths it finds but silent about dependencies that flow through intermediate cells.
The score is measured against the §1 intervention oracle — never against another interpretability method. F (faithful) is always vs the oracle; see the execution stack. How each of F / S / M is actually computed for this method (and whether it matches the paper) is in the box just below; the numbers are in the In the audit box under it.
The exact formula this method uses for each score, read from its runner, and
whether it matches the paper's §3 (F ∧ S ∧ M triad) definition.
From the committed audit
fsm_math_phaseC.json.
| Axis | Formula (as computed) | What it measures | Matches §3? |
|---|---|---|---|
| F faithfulness | \(F = F_1^{\mathrm{edge}}(\hat{E}, E^{\star})\) | Edge-F1 of the recovered path circuit against the true direct-path routine (exhaustive edge-restricted path patch). | ✓ matches path_patching.jl (F = clamp(score.f1)); metric_name path_circuit_F1_vs_true_routine. Exactly the paper's circuit-discovery F = edge F1 vs the true data-flow/routine. Record: extra.triad.F / value (pong F=0.0 — no path edges recovered; battery mean F=0.580, n=42). how it's measured — call stack:
|
| S sufficiency | S = null (undefined) | Not scored: the recovered path circuit is a graph structure, not a per-do(u) predictive map. | — n/a path_patching.jl (S = nothing). n/a for a graph-valued explanation is consistent with the paper (S defined for predictive maps). Record: extra.triad.S = null. |
| M minimality | \(M = |U^{\star}| / |\hat{U}| = |E^{\star}| / |\hat{E}| \in (0,1]\) | True-routine edge count over the number of discovered path edges. | ✓ matches path_patching.jl (M = min(1, ntrue/nrec)). This is the paper's |U*|/|U_hat| applied to edges. n/a when |U_hat|=0 discovered edges (emitted as null, e.g. pong M_named_size=0 -> M=null). Record: extra.triad.M, M_true_minimal_size/M_named_size (battery mean M=1.0 over the n=18 games with >=1 discovered edge). how it's measured — call stack:
|
✓ matches = the same quantity as §3; ◐ partial = the same kind of estimator but a differing detail; ✗ does not match = a different quantity (see the note). Definitions: F = agreement with the oracle's true causal effects Δy(u); S = held-out predictive score in [−1, 1]; M = |U*|/|Û| (true-minimal-set size / named-set size).
This is the method's entry in the actual cross-method audit — scored on the paper's correctness triad, each axis a mean over 44 of the 44 scored games (44 committed §R records), not the single example shown above. Tradition: causal. The example figure (Pong) is one of those records.
F faithfulness (scored vs the oracle for every method) · S sufficiency (held-out predictive score in [−1, 1]; a negative value means the explanation predicts held-out interventions worse than the unperturbed baseline; reported for the predictive methods across all three phases where the calibration/held-out split is defined) · M minimality (true-minimal-set / named-set; where the method names a cause set) — n/a otherwise, per the paper's F ∧ S ∧ M triad.
Source: leaderboard.json · the whole leaderboard is on the
methods page and the
Paper 2 audit.
This method's faithfulness on each of the 44 scored games (all-regime F; this method has no content-vs-position split (see the note below)). Click a header to
sort. Every number is read from site_data.json
(methods.path_patching.per_game).
content-F and position-F are n/a for this method. The content-vs-position split applies only to pixel-attribution methods — those that produce an attribution map over the framebuffer, whose score can be read separately on the smooth content outputs and the discrete position outputs (where the naive gradient is provably zero). This method does not attribute to a pixel output; it is graded by its own fidelity metric (path_circuit_F1_vs_true_routine), reported as the F column, so there is no content or position regime to separate.
M is n/a on 23 of these games. Minimality is M = |U*|/|Û|, the size of the true minimal cause set over the size of the set the method actually names. On a game where the method names nothing (|Û| = 0 — it discovers no circuit, its attribution map is all-zero, or it decodes no cell), that ratio is undefined, so M is left blank rather than scored. The aggregate M is the mean over the 21 games where the method did name a cause set.
| Game | F (all) | content-F | position-F | S | M | Note |
|---|---|---|---|---|---|---|
| Air Raid | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Bank Heist | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Boxing | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Centipede | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Double Dunk | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Fishing Derby | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Freeway | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Gopher | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Ice Hockey | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Kangaroo | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Krull | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Kung-Fu Master | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Name This Game | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Phoenix | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Q*bert | 1.000 | n/a | n/a | n/a | n/a | recovers the true causes |
| Skiing | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Venture | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Video Pinball | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Yars' Revenge | 1.000 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Tennis | 0.941 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Riverraid | 0.909 | n/a | n/a | n/a | 1.000 | recovers the true causes |
| Bowling | 0.800 | n/a | n/a | n/a | 1.000 | |
| Enduro | 0.800 | n/a | n/a | n/a | 1.000 | |
| Montezuma's Revenge | 0.800 | n/a | n/a | n/a | 1.000 | |
| Carnival | 0.667 | n/a | n/a | n/a | 1.000 | |
| Asterix | 0.400 | n/a | n/a | n/a | 1.000 | |
| Hero | 0.400 | n/a | n/a | n/a | 1.000 | |
| Road Runner | 0.333 | n/a | n/a | n/a | 1.000 | |
| Berzerk | 0.298 | n/a | n/a | n/a | 1.000 | |
| Chopper Command | 0.286 | n/a | n/a | n/a | 1.000 | |
| Space Invaders | 0.286 | n/a | n/a | n/a | 1.000 | |
| Private Eye | 0.222 | n/a | n/a | n/a | 1.000 | |
| Demon Attack | 0.200 | n/a | n/a | n/a | 1.000 | |
| Seaquest | 0.200 | n/a | n/a | n/a | 1.000 | |
| Alien | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Assault | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Atlantis | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Breakout | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Frostbite | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Jamesbond | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Ms. Pac-Man | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Pacman | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Pitfall | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
| Pong | 0.000 | n/a | n/a | n/a | n/a | no true-cause signal |
The path from this method's runner (run_game) into the bit-exact VCS substrate, and the
computation it involves. Every step links to the exact source on main. From
callstack_phaseC.json.
env_reset!(env; boot_noop_steps = 60, boot_reset_steps = 4) jutarienv_step!(env::StellaEnvironment, action::Integer) jutaribuild_shared_testbed(game; ... intervene_ram = intervene_ram!, run_intervention = run_intervention, soft_ram_peek = soft_ram_peek, ...) runnersnapshot(env::StellaEnvironment, frame::Integer) jutaripath_patch(checkpoint, clean_next, nodes, sender_i, receiver_j, sender_value, rest_tail; hop_action) -> intervene_ram!; env_step! runner intervene_ram! @ path_patching.jl:314 & :319, env_step! @ :316 & :322node_dataflow_graph(checkpoint, tail, nodes, at_target) -> intervene_ram! runner intervene_ram! @ :272recovered_path_circuit(checkpoint, clean_next, nodes, ...) -> edge_fires -> path_patch runner true_routine_graph @ :353, score_circuit @ :424Scored against the exact intervention oracle Δy(u): run_intervention(checkpoint, actions, target_frame, horizon, cause).
The figure is generated from the committed record by
docs/gen_method_figures.py; the game frame
and each RAM cell's screen footprint are produced by
render_scenes.jl /
cell_footprints.jl.