Redwood Research and UC Berkeley researchers traced how GPT-2 small completes sentences like “When Mary and John went to the store, John gave a drink to” with “Mary” down to 26 attention heads across 7 functional classes, representing just 1.1% of all (head, token position) pairs in the 12-layer model. Rather than stopping at attention heatmaps, Kevin Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt introduced path patching to separate direct from mediated causal routes, and formalized faithfulness, completeness, and minimality as falsifiable checks on circuit claims.

This paper became the field’s canonical “model organism” for language-model circuit analysis. It proved that end-to-end reverse engineering works on natural English grammar in a pretrained transformer, while exposing three surprises that reshaped path patching and automated circuit discovery: pointer-based induction heads, self-hedging negative heads, and silent backup heads that step in only when primary heads are knocked out.

  • Full-model baseline: Across 100,000 prompts from 15 templates (p_IOI), GPT-2 small averages a logit difference of 3.56, ranking the indirect object (IO) above the subject (S) 99.3% of the time with 49% mean IO probability.
  • 26 heads, 87% faithful: Isolating the 26-head circuit by mean-ablating every other (head, position) pair on template-matched three-name prompts (p_ABC) stays within 0.46 of the full model’s 3.56 logit difference.
  • Pointers plus inhibition: Duplicate Token Heads and Induction Heads detect S2 = S1 and send a relative position signal (2.31 S_pos + 0.99 S_tok) through S-Inhibition Heads to suppress Name Mover attention to S1.
  • Hidden redundancy and hedging: Knocking out all three Name Mover Heads reduces logit difference by only 5% because eight Backup Name Mover Heads compensate, while two Negative Name Mover Heads deliberately write against the answer.
How 26 attention heads route names to solve Indirect Object Identification
Stage 1: At S2 (“John”)
Detect repeated subject and emit S1 pointer.
Duplicate & Induction Circuits
Previous Token Heads (2.2, 4.11) tag S1+1 (“went”). Duplicate Token Heads (0.1, 3.0; fuzzy 0.10) attend to S1, and Induction Heads (5.5, 6.9; fuzzy 5.8, 5.9) attend to S1+1, signaling S1’s position.
Stage 2: At END (“to”)
Suppress the duplicated name in later queries.
S-Inhibition Heads (7.3, 7.9, 8.6, 8.10)
Attend to S2 (0.51 avg attention), read value/key signals, and write position plus token offsets into Name Mover queries so they avoid S1.
Stage 3: To Logits
Copy remaining name, hedge, or back up failures.
Name Movers, Negatives, and Backups
Name Movers (9.6, 9.9, 10.0) copy IO (0.59 avg attention, over 95% copy score); Negatives (10.7, 11.10) push down logits; 8 Backups cover if movers fail.

Circuit diagram from Wang et al. (2022), Figure 2 and Section 3.

Working backward from logits with path patching

GPT-2 small has 12 layers and 12 heads per layer (144 heads total). To isolate the subgraph solving Indirect Object Identification (“When Mary and John went to the store, John gave a bottle of milk to”), the authors had to solve two methodological problems that break naive ablation studies. First, zero ablation (setting a head’s output to zero) injects an arbitrary out-of-distribution vector that breaks downstream layers relying on mean activations as implicit biases. Second, mean ablation on the p_IOI distribution itself fails to erase task-constant information such as “one name in this sentence is duplicated.” Their fix was template-matched mean ablation on p_ABC, an otherwise identical distribution using three unrelated random names A, B, and C so no unique indirect object exists while grammar aligns token-for-token.

Even with clean counterfactuals, standard activation patching mixes direct and indirect pathways. To isolate direct routes h -> R (paths passing only through residual connections and MLPs, never through other attention heads), the authors introduced path patching: run forward passes on x_orig (p_IOI) and x_new (p_ABC), freeze all attention heads at x_orig except sender h patched to x_new, recompute MLPs and receiver nodes R to capture h’s direct effect on R, and then run a final forward pass on x_orig with R patched to those saved activations.

Tracing backward from the logits at the END token (“to”) immediately surfaced two opposing groups:

  • Name Mover Heads (9.6, 9.9, 10.0): Patching their direct path to logits sharply drops the IO - S logit difference. They direct 0.59 average attention to IO, their output projection onto W_U[IO] correlates strongly with attention (rho > 0.81 over 500 samples), and their OV matrices place the attended name inside the top 5 logits on over 95% of samples (versus under 20% for an average head).
  • Negative Name Mover Heads (10.7, 11.10): Patching them increases logit difference; they share the same attention targets but carry a 98% negative copy score (versus 12% average), seemingly hedging predictions to avoid catastrophic cross-entropy penalties on mistakes.

Patching into the queries of the Name Mover Heads uncovered four S-Inhibition Heads (7.3, 7.9, 8.6, 8.10) at END, which attend primarily to S2 (0.51 average attention). Counterfactual experiments flipping token identity and S1 position across six datasets showed their signal decomposes linearly as 2.31 S_pos + 0.99 S_tok (with 7% mean error): relative position between S1 and S2 drives more than twice the effect of the name token itself, and lengthening sentence prefixes while keeping S1-S2 distance fixed leaves logit difference untouched (3.56 before vs 3.57 after).

Tracing into S-Inhibition values and keys at S2 exposed how GPT-2 small repurposes known mechanisms. Alongside Duplicate Token Heads (0.1, 3.0, fuzzy 0.10) that attend directly from S2 to S1, the circuit uses Induction Heads (5.5, 6.9, fuzzy 5.8, 5.9) paired with Previous Token Heads (2.2, 4.11) attending from S2 to S1+1. Instead of copying S1+1 to predict the next token as documented in Olsson et al.’s induction study, these induction heads act as pointers: patching altered position signals drops logit difference by at least 88% of S-Inhibition’s drop, while swapping name identity at fixed positions changes it by under 8%.

Redundancy, backup heads, and the three validation tests

Knocking out all three primary Name Mover Heads at once produced the paper’s biggest surprise: logit difference fell by only 5%. Rerunning h -> Logits path patching after that knockout revealed eight Backup Name Mover Heads (9.0, 9.7, 10.1, 10.2, 10.6, 10.10, 11.2, 11.9) stepping in to move names to the output, while Negative head 10.7 flipped sign to contribute positively. Before knockout, those eight backup heads behave diversely (four resemble Name Movers, two attend equally to IO and S, 11.2 prefers S1, and 9.7 writes negatively from S2), suggesting training-time dropout built fault-tolerant redundancy.

That shock proved that faithfulness alone cannot validate an explanation. Indeed, a naive 11-head baseline omitting Backups and Negatives stays within 0.1 of the full model’s logit difference, even closer than the full 26-head circuit’s 0.46 gap (87% of 3.56). To catch missing or redundant machinery, the authors formulated three quantitative criteria:

Three criteria for circuit explanations, and how the 26-head graph scored
Faithfulness

Circuit C matches full model M: |F(M) - F(C)| = 0.46 (87% of 3.56). Necessary, but a naive 11-head subset scores 0.1.

Completeness

Match under knockouts |F(C\K) - F(M\K)|. Passes random and class knockouts, yet greedy search finds mixed-class gaps up to 3.09.

Minimality

Every head v matters for some subset K: all 26 heads recover at least 1% of F(M) when restored against their class or backup set.

Validation framework from Wang et al. (2022), Section 4 and Appendix K.

The circuit also yielded a concrete adversarial prediction. Because GPT-2 small identifies S via duplicate detection rather than deep syntactic parsing, duplicating IO in an unrelated middle sentence (“John and Mary went to the store. Mary had a good day. John gave a bottle of milk to”) confuses the suppression mechanism. Across those double-IO prompts, mean logit difference plunges from 3.55 to 1.23 (IO probability drops from 0.49 to 0.36), and GPT-2 small predicts the wrong name S 23.4% of the time (up from 0.7%). In the control where S appears three times instead, logit difference actually rises to 3.64 and errors fall to 0.4%.

Inspect all seven head groups in the IOI circuit

Browse the functional roles below to see how each head class contributes, why naive ablations misread it, and what checks confirmed its behavior inside and outside p_IOI.

Functional anatomy of the 26-head IOI circuit in GPT-2 small

Select a component group (or use Left and Right arrow keys) to compare head IDs, mechanism, quantitative checks, and surprises.

Name Mover Heads (9.6, 9.9, 10.0)

Output (3 heads)

Active at END, they attend selectively to the uninhibited IO token (0.59 avg attention) and copy its embedding directly into logits.

Mechanism
OV matrices copy any attended name into the top 5 logits over 95% of the time; dot product with W_U[IO] correlates at rho > 0.81 with attention.
Why naive knockouts mislead
Ablating all three drops logit difference by only 5% because eight Backup Name Movers compensate silently.
Outside p_IOI
On repeated random 100-token sequences, Name Movers also project strongly onto next-token embeddings, confirming general contextual copying.
Query control
Without S-Inhibition signals writing to their queries, Name Movers shift attention onto S1 instead of IO.

Source: Wang et al. (2022), Sections 3 and 4, Appendices A through J.

For readers skipping the interactive tabs, the 26-head circuit splits into five key functional takeaways:

  • Name Movers (9.6, 9.9, 10.0): Read IO at END with 0.59 average attention and over 95% name-copying accuracy.
  • Negative Name Movers (10.7, 11.10): Counter-intuitively subtract from the attended name’s logit (98% negative copy score), likely to hedge cross-entropy risk.
  • S-Inhibition Heads (7.3, 7.9, 8.6, 8.10): Read S2 and emit a position-heavy offset (2.31 S_pos + 0.99 S_tok) into Name Mover queries to block S1.
  • Duplicate, Induction, and Previous Token Heads (0.1, 3.0, 0.10; 5.5, 6.9, 5.8, 5.9; 2.2, 4.11): Detect repetition at S2 and pass S1’s position as a pointer rather than predicting S1+1.
  • Backup Name Movers (8 heads): Compensate when primary Name Movers fail (keeping logit drop to 5%), illustrating why completeness tests matter as much as faithfulness.

Caveats, unmapped MLPs, and what came next

Three sharp limitations bound what this paper establishes. First, MLPs are left out of the 26-head graph, yet MLP0 is essential. Knocking out MLP0 alone reverses the sign of the logit difference (a -115% variation), and knocking out all MLPs after layer 0 drops logit difference to -1.1. The 26 attention heads clearly rely on MLP0 (and collectively later MLPs) to format token representations, even though no individual later MLP breaks the task on its own.

Second, the circuit fails the hardest completeness test. Random subset knockouts and whole-class knockouts look clean, yet greedy search over mixed-class subsets K uncovers discrepancies up to 3.09 logit difference (87% of the baseline) between C \ K and M \ K. In addition, the authors flag missing parameter-level weight checks on Duplicate Token and Induction Heads, as well as the unexplained mechanism behind S-Inhibition attention patterns and Backup Name Mover compensation.

Third, the findings target one 124M-parameter model on 15 synthetic templates. Preliminary checks on GPT-2 medium already revealed sparse logit-affecting heads that did not exclusively attend to IO and S, showing that circuits grow less tidy with scale. Even within GPT-2 small, natural prompts with repeated IO names trigger S-Inhibition attention patterns absent from p_IOI.

Still, this paper turned mechanistic interpretability into a testable discipline. Its path-patching algorithm and completeness metrics directly motivated ACDC automated circuit discovery and causal scrubbing. For builders evaluating interpretability claims today, the practical takeaway is clear: never trust a clean subgraph on clean prompts alone; test whether it breaks under adversarial predictions, survives mixed-node knockouts, and accounts for backup pathways.