Phase A · neuroscience battery

A2 · Single-unit lesions

cf. Jonas & Kording 2017

← back to the method catalogue

What it does?

A lesion study asks what breaks when a part is removed. It is the oldest tool in neuroscience: damage one region, see what behaviour is lost, and infer that region's role. We apply the same idea to memory. We freeze one RAM cell at a time, hold it at a fixed value, re-run the program, and measure how much the screen changes. A cell whose freezing wrecks the picture is judged important; a cell whose freezing does nothing is judged irrelevant. Ranking every cell this way gives a per-unit importance map. The appeal is that the test is causal: we do not just watch the cell, we intervene on it and see the effect. This is why the single-unit lesion is the one classical method that scores near the top of our battery. Its weakness is that it changes one cell at a time. It is therefore blind to causes that only act together, where two cells matter jointly but neither matters alone. So it recovers a correct ranking of which units matter, but not the way they combine into the actual computation.

A2 · Single-unit lesions result

Left: the frame. Middle: each cell's lesion importance painted on the screen via its footprint. Right: lesion importance vs the cell's true causal role. lesion_importance_spearman_vs_oracle_role = 1.000 — this example only (pong, state gameplay(seed=0,prefix=90)+15); the audit aggregate is below.

Phase A · neuroscience battery · knock one unit out

Learn the method — a beginner's guide

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.

The idea in plain words

The oldest question in brain science is: what stops working if this part is gone? In 1848 an iron rod destroyed part of Phineas Gage's frontal lobe. He survived, but his personality changed. Doctors concluded that this region had something to do with self-control. That is a lesion study: remove or silence one part, watch which behaviour is lost, and credit the part with that behaviour.

The appeal is that a lesion is an intervention, not an observation. You do not just watch a unit fire together with a behaviour; you take the unit away and see whether the behaviour goes too. That is a causal test. Its weakness is that it tests one unit at a time. If two units do a job together, or back each other up, removing one may show nothing, or something misleading. On the Atari we can measure both sides: how well single lesions rank the units, and how much of the joint behaviour they cannot see.

How it works on a neural network

Neuroscience origin. Lesions come from accidents (Gage), strokes and surgery, and in animals from deliberate damage, cooling or drugs. Modern tools such as optogenetics can switch a cell type off for a few milliseconds. Jonas & Kording “lesioned” the transistors of a simulated 6502 chip one by one (the VCS CPU, the 6507, is a 6502 variant) and found some that broke only one game. They warned that this does not mean the transistor is a “Donkey Kong transistor”.

Neural-network analogue. An ablation study: set one unit's activation to zero (or to its mean) and measure the drop in accuracy or in a logit. Dropout does random ablations during training. Written as an intervention on unit \(u\) with a set of clamp values \(V\):

\[ I(u) \;=\; \max_{v \in V}\; \big|\,y\big(\mathrm{do}(h_u := v)\big) - y\,\big| . \]

Rank the units by \(I(u)\) and you have an importance map. To test it, compare its ranking with a trusted ranking by Spearman's \(\rho\), the correlation of the two rank lists (\(+1\) = same order).

Toy example. Let \(y = a\cdot b + c\) at \(a=b=c=1\), so \(y = 2\). Lesion \(a\) to 0: \(y = 1\), \(I(a) = 1\). Likewise \(I(b) = 1\) and \(I(c) = 1\). The map says all three matter equally. Now lesion \(a\) and \(b\): \(y = 1\), a drop of 1, not \(1+1 = 2\). The interaction term

\[ \Delta_{\text{int}}(a,b) = E(a,b) - \big(E(a)+E(b)\big) = 1 - 2 = -1 \]

is non-zero: \(a\) and \(b\) work as a team (a product), \(c\) works alone (a sum). No single-unit map can tell those two kinds of units apart.

Recipe

  1. Freeze the system in one state and record a baseline run of the outputs you care about.
  2. For each unit \(u\): restore the state, clamp \(u\) to a lesion value (zero, or a very different value), re-run, record the outputs.
  3. Turn the change into one number per unit: the lesion importance \(I(u)\). Take the largest effect over the lesion values tried.
  4. Rank the units by \(I(u)\). This is the importance map.
  5. Score the map against a trusted reference ranking with Spearman's \(\rho\).
  6. Lesion selected pairs too and compare \(E(i,j)\) with \(E(i)+E(j)\) to expose interactions the map hides.

From a neural network to the Atari

The neuronOne candidate RAM byte: one of the 128 bytes of VCS working memory that published annotations (OCAtari / AtariARI) link to a game concept such as ball x or score.
The lesionintervene_ram! at frame \(f^*\): overwrite the byte with \(0\) (“silence”) or with base XOR 255 (every bit flipped, a maximally different value).
The behaviourAfter 15 frames of re-run: the absolute change of every candidate byte plus the number of screen pixels that differ from the un-lesioned run.
The neurologist's ground truthThe oracle role of each byte: the same measurement with a larger set of interventions \(\{0,\ +17,\ +37,\ \text{XOR }255\}\), each a real re-run of the real ROM (the cartridge program).
Patients with two lesionsPairs of the most important bytes, both flipped at once, to measure the interaction term.

How we apply it to the VCS

The runner A2_lesions.jl works on the same frozen game state as every method in the study: the cartridge is booted (60 no-op plus 4 reset frames), then 90 frames of seeded random joystick input are played. That frame is \(f^*\); the horizon is the next 15 frames. Two fresh replays must agree byte for byte before anything is scored.

How this differs from a brain lesion. Our “lesion” is a one-time write at \(f^*\), not a clamp held for the whole horizon. The game program is free to overwrite the byte on the next frame, much as a brain can compensate. Also note that the lesion's two clamps are a subset of the oracle's four interventions, measured with the same footprint. A high rank correlation is therefore expected by design; the interaction count is the informative part.

Read the code

XAI the interpretability method   substrate the bit-exact emulator it runs on (jutari, Julia).

Reading the result

The figure shows the game frame, a heat-map of where on the screen the lesions changed pixels, and a bar chart with two bars per candidate byte: the oracle's true causal role and the lesion importance, both scaled so the largest is 1. A faithful map has bars of matching height. In Pong they match exactly: the score bytes and the ball bytes are tall, the paddle bytes are zero. That is why this is the one classical method near the top of the battery. What the bars do not show is how the bytes combine. Look in the record's interaction block for the pairs whose joint lesion is far from the sum of the singles.

Pitfalls

Try it yourself

julia --project=jutari tools/xai_study/phaseA_kording/A2_lesions.jl --games core

Writes A2_lesions_<game>.{json,npz} per game and a combined A2_lesions.{json,npz} into tools/xai_study/phaseA_kording/out/. --max-pairs K caps the interaction budget (default 60); --shard i --nshards n runs one game per cluster task.

Original papers & further reading

Read next: Occlusion · Activation patching / causal mediation · A1 · Connectomics / data-flow graph · A3 · Tuning curves

How it's scored

The score is a rank correlation between each cell's lesion importance and its true causal role. Lesion importance is how much the screen changes when the cell is frozen; the true role comes from the intervention oracle. We rank the cells by each and take the Spearman correlation of the two rankings, so the metric asks whether lesioning orders the cells the same way the oracle does. Faithfulness for this method is that rank correlation, and it is high, because lesioning is itself a real intervention on the machine. The grading is always against the oracle, not against any other method. The important limit the score does not penalise on its own is interactions. A single-unit lesion changes one cell at a time, so it is blind to causes that only act together. On some games the per-unit ranking misses a large fraction of the joint effects the oracle records, where a pair of cells swings the behaviour far beyond the sum of the two single lesions. So a near-perfect ranking still hides the way the cells combine. There is no position hard-case for this method; its output is a ranking, not a sprite coordinate. The audit box reports the measured correlation across the core games.

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.

How F, S, M are computed here

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_phaseA.json.

AxisFormula (as computed) What it measuresMatches §3?
F
faithfulness
\(F = \rho_{\mathrm{Spearman}}\!\left(\mathrm{attr},\ \Delta y(u)\right)\)Spearman rank correlation between the single-unit lesion importance map and the exact-oracle per-unit causal role over 8 units.✓ matches Rank correlation of attribution vs oracle causal effects; matches the paper's ranked-output correlation primitive. A2_lesions.jl,,; record out/A2_lesions_pong.json triad.F=1.0.
how it's measured — call stack:
  1. F = Spearman(lesion importance, oracle causal role) — A2_lesions.jl:645
  2. oracle_role: per-unit causal role over the full-horizon do-set — A2_lesions.jl:621
  3. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242
S
sufficiency
\(S = \rho_{\mathrm{Spearman}}\!\left(\mathrm{attr},\ \Delta y_{\mathrm{held\text{-}out}}(u)\right) \in [-1,1]\)Rank correlation of the lesion map (built on {0, alt}) vs the per-unit role under the held-out clamp value base+37.✓ matches Rank correlation in [-1,1] of the lesion map (built on {0,alt}) vs the per-unit role under the held-out clamp value base+37: a non-null held-out predictive correlation, the §3 (sec:triad) form. A2_lesions.jl; record S=0.836.
how it's measured — call stack:
  1. S = Spearman(lesion map, per-unit role under held-out do(base+37)) — A2_lesions.jl:648
  2. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242
M
minimality
\(M = |U^{\star}| / |\hat{U}| \in (0,1]\quad U^{\star}=\{u:\Delta y(u)>0\},\ \hat{U}=\{u:|\mathrm{attr}(u)|>\tau\}\)Number of oracle-causal units over the number of units the lesion map names above threshold.✓ matches Runner now emits M = |U*|/|U_hat| (M_note '|U*|=4 (oracle movers) / |U_hat|=4 (method above-threshold)'), the paper's set-size ratio. Record out/A2_lesions_pong.json extra.triad.M=1.0. Replaced the former 1 − false-specificity rate.
how it's measured — call stack:
  1. minimality_score(lesion names, oracle movers) — A2_lesions.jl:655
  2. minimality_score: |U*| oracle movers / |U_hat| named units — triad_sm.jl:57
  3. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242

✓ 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).

In the audit

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: intervention. The example figure (Pong) is one of those records.

0.964F — faithfulness vs oracle (mean over 44 games, ±0.026 CI95)
0.610S — sufficiency: held-out predictive (n/a where the paper does not define this axis)
1.000M — minimality: true-minimal-set / named-set (n/a otherwise)
44committed records aggregated
0.00human-plausibility proxy

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.

Results per game

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.A2_lesions.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 (lesion_importance_spearman_vs_oracle_role), reported as the F column, so there is no content or position regime to separate.

S is negative on 2 of these games. Sufficiency asks whether the explanation can predict the outcome of held-out interventions it was not fit on; for this method S is the held-out predictive correlation between its claim and the true effect, so it lies in [−1, 1]. A value near 0 means the explanation predicts no better than the unperturbed output; a negative value means it predicts worse — its held-out claim is anti-correlated with the truth (named yet causally unused). The aggregate S is the mean over the scored games.

GameF (all)content-Fposition-FSMNote
Alien1.000n/an/a0.4291.000recovers the true causes
Bank Heist1.000n/an/a0.4621.000recovers the true causes
Bowling1.000n/an/a0.6641.000recovers the true causes
Boxing1.000n/an/a0.4891.000recovers the true causes
Breakout1.000n/an/a0.7811.000recovers the true causes
Carnival1.000n/an/a0.4241.000recovers the true causes
Centipede1.000n/an/a0.7141.000recovers the true causes
Chopper Command1.000n/an/a0.8031.000recovers the true causes
Fishing Derby1.000n/an/a0.8531.000recovers the true causes
Ice Hockey1.000n/an/a0.7801.000recovers the true causes
Kangaroo1.000n/an/a0.6021.000recovers the true causes
Krull1.000n/an/a0.2311.000recovers the true causes
Ms. Pac-Man1.000n/an/a0.3951.000recovers the true causes
Name This Game1.000n/an/a0.7001.000recovers the true causes
Pacman1.000n/an/a0.4191.000recovers the true causes
Pitfall1.000n/an/a0.9171.000recovers the true causes
Pong1.000n/an/a0.8361.000recovers the true causes
Private Eye1.000n/an/a0.6111.000recovers the true causes
Seaquest1.000n/an/a0.8001.000recovers the true causes
Tennis1.000n/an/a0.7341.000recovers the true causes
Video Pinball1.000n/an/a-0.1261.000recovers the true causes
Yars' Revenge0.999n/an/a0.6931.000recovers the true causes
Q*bert0.998n/an/a0.1641.000recovers the true causes
Berzerk0.998n/an/a0.7561.000recovers the true causes
Phoenix0.993n/an/a0.5291.000recovers the true causes
Hero0.993n/an/a0.6241.000recovers the true causes
Demon Attack0.989n/an/a0.4381.000recovers the true causes
Space Invaders0.986n/an/a0.8121.000recovers the true causes
Jamesbond0.985n/an/a0.6001.000recovers the true causes
Air Raid0.984n/an/a0.9731.000recovers the true causes
Asterix0.983n/an/a0.9171.000recovers the true causes
Skiing0.983n/an/a0.6671.000recovers the true causes
Venture0.979n/an/a0.5471.000recovers the true causes
Double Dunk0.979n/an/a0.1551.000recovers the true causes
Assault0.973n/an/a0.7941.000recovers the true causes
Riverraid0.972n/an/a0.7131.000recovers the true causes
Road Runner0.963n/an/a0.8611.000recovers the true causes
Atlantis0.950n/an/a0.7461.000recovers the true causes
Montezuma's Revenge0.925n/an/a0.6961.000recovers the true causes
Kung-Fu Master0.870n/an/a0.6471.000recovers the true causes
Gopher0.818n/an/a0.6621.000
Frostbite0.803n/an/a0.7211.000
Freeway0.802n/an/a-0.6901.000
Enduro0.500n/an/a0.5001.000

Call stack — how it runs on jutari / jaxtari

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_phaseA.json.

Applied on the substrate

  1. assemble the shared gameplay-state testbed + cause-density gate for this game — build_a2_shared_state(game) -> build_shared_testbed(game; ...) runner
  2. build_shared_testbed definition: booted checkpoint + shared output + gate — function build_shared_testbed(game; ...) runner
  3. cause-density gate counts causes with |Delta_y|>floor via the oracle — cause_density = count(>(floor), deltas) runner
  4. boot the real ROM and replay to the target frame (runner-local boot_replay) — boot_replay(spec, actions, target_frame) runner
  5. step the real emulator one frame per action — env_step!(env, Int(actions[i])) jutari
  6. read the 128-byte RAM — get_ram(env) jutari

The computation

  1. lesion primitive: deepcopy the checkpoint, CLAMP one/more cells to a fixed value, re-run the tail, snapshot — lesion_continue(checkpoint, pokes, tail) runner
  2. clamp writes the fixed value into the RAM byte before re-running — intervene_ram!(env, idx, v) runner
  3. the lesion map (method under test): per-unit importance = best out-delta over the exhaustive single-unit clamp set {clamp->0, clamp->alt=base XOR 0xFF}, plus screen change and works-flag — lesion_map(checkpoint, tail, cands, at_target, ...) runner

Scored against the exact intervention oracle Δy(u): run_intervention(checkpoint, actions, target_frame, horizon, cause).

Implementation
tools/xai_study/phaseA_kording/A2_lesions.jl
Reference
cf. Jonas & Kording 2017
Record
A2_lesions_pong.json
All records
phaseA_kording/out

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.