Chapter 5

Causal tools: ablation and patching

Looking at activations shows what is correlated with a behaviour. To find what causes it, you must reach into the model, change one thing, and watch the output. This chapter explains how.

In short

  • Every causal method does three things: pick a part of the model, replace its value, and measure the change in the output.
  • Ablation removes a part. The result depends a lot on what value you put in its place: zero, the mean, or a value from another input.
  • Activation patching copies an activation from a "clean" run into a "corrupted" run. It shows where the information that decides the answer lives. You can try it below on real numbers from GPT-2 small.
  • Path patching, causal scrubbing and ACDC test connections and whole circuits. Attribution patching makes all of this fast with gradients.
  • DAS searches for directions (not neurons) that act like variables in a simple program.
  • All of these tools have traps: off-distribution values, self-repair, and "illusions" that you create yourself.
Learning path · Chapter 5 of 12 · about 50 min · 5 widgets · 4 quizzes

Before you start: Chapter 4: the residual stream and attention heads (heads, logits, direct logit attribution), and Chapter 1: observe, then intervene.

You will learn:

  • the three steps of every causal method: pick a part, replace its value, measure the change
  • why the type of ablation (zero, mean or resample) changes the answer
  • how activation patching works, on real GPT-2 small data
  • how path patching, causal scrubbing, ACDC and attribution patching test whole circuits
  • the traps: off-distribution values, self-repair and subspace illusions

Why correlation is not enough

Chapter 4 gave us stories about heads and circuits, such as the induction head. How do we test such a story in a real model? This chapter gives the tools, which the field built mostly from 2020 to 2024. First, why looking is not enough. In Chapter 7 we meet probes. A probe reads information from activations. But a probe can find information that the model never uses. A neuron can fire on French text and still have no effect on the output. To show that a part matters, you must change it and see the output move.

This idea is old. Neuroscientists damage a brain region and watch which skill is lost. Doctors run trials where they change one thing and keep the rest fixed. In a neural network, this is much easier. We can change any number we like, and we can run the same input again and again with no noise.

Every method in this chapter follows the same three steps:

  1. Pick a part. This can be a neuron, an attention head, the residual stream at one token, an edge between two parts, or a direction in activation space.
  2. Replace its value. Use zero, an average, a value from a different input, or a value with noise added.
  3. Measure the change. Look at how much the output moves.

The methods differ in three ways: what value they put in, what unit they change (a node, an edge, or a subspace), and how they make it fast (real reruns or gradients).

OBSERVE: watch INTERVENE: poke input model output "it fires on French" input ↺ model output Δ? replace value
Figure 5.1. Observation tells you that a part is active. Intervention tells you whether the output depends on it.
Key idea

Correlation: watch. Causation: poke. A mechanistic claim is only as strong as the interventions that test it.

Ablation: turn it off and see what breaks

The simplest intervention is an ablation. You remove the output of one part and measure how much worse the model gets. But there is a hard question. What does "remove" mean? During training, a part never outputs "nothing". It always outputs some number. So you must choose a replacement value. There are four common choices.

TypeReplacement valueGoodBad
Zero ablationAll zerosVery simpleZero can be a value the model never sees. Then you measure "the model is confused", not "this part mattered".
Mean ablationThe average activation of this part over a reference datasetKeeps the typical value. Less off-distribution.Removes all input-specific information at once. The result depends on the dataset you average over.
Resample ablationThe activation from a different, random inputAlways a real value the model can produceNoisy. You must average over many samples.
Optimal ablation (Li & Janson, 2024)The one constant that makes the loss go up the leastMeasures only the information the part carriesNeeds an optimization for each part

The choice really matters. Some parts of GPT-2 small output a large, almost constant vector. This vector acts like a bias. If you set it to zero, the model breaks, even though the part carries no information about the input. Mean ablation shows the truth: the part is not important for the task. The IOI paper (Chapter 6) used mean ablation over an "ABC" dataset of prompts with three different names. The ACDC authors found that zero ablation and resample ablation can give different circuits.

Interactive · Three ways to "remove" a neuron
A toy neuron. Its activation is about 5 on every input (a large constant), plus a small part that depends on the input. The rest of the model expects values near 5. Pick an input, then pick an ablation. Compare how much damage each one reports. (Toy model, made for this page.)

Necessary or sufficient?

Ablation of one part tests whether that part is necessary: does the model still work without it? You can also ablate everything except a proposed circuit. This tests whether the circuit is sufficient: is it enough on its own? A good circuit claim needs both tests. Wang et al. (2022) named three criteria for circuits:

Limit

Ablation can underestimate how important a part is. When you remove one part, other parts sometimes change their behaviour to make up for it. This is called self-repair. We return to it in the section on pitfalls.

The root idea: causal mediation analysis

2020
Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, Stuart Shieber · NeurIPS 2020
Borrowed "mediation analysis" from statistics to ask which neurons and attention heads carry gender bias in GPT-2.

Vig and colleagues gave the field its first clear causal recipe. They used a prompt like "The nurse said that". Then they compared the probability of "she" and "he". They asked: which internal parts carry the effect of the word "nurse"?

Statistics has words for this. A mediator is a variable that sits between a cause and an effect.

They found that the gender effect was sparse. A small number of attention heads in middle layers, plus some neurons, carried most of it. The effect was also synergistic (some parts amplify it, others damp it) and split into a direct part and a part that flows through the mediators.

Why it matters

"Set an internal variable to the value it would take under a different input" is exactly what activation patching does. Mediation analysis is its parent.

Activation patching

Activation patching is the main workhorse of mech interp. Three communities found it at about the same time, so it has three names:

The three runs

We use the IOI task as the example. IOI means "indirect object identification". The model must finish a sentence with the right name. Chapter 6 tells the full story of the circuit that GPT-2 small uses. In short: some heads notice which name is repeated (S-inhibition heads pass this signal on), and other heads copy the other name to the output (name mover heads). We will meet these names below.

Clean run. Use an input where the model does the behaviour. "When Mary and John went to the store, John gave a drink to" → the model predicts " Mary". Save (cache) every activation.

Corrupted run. Use an input that is almost the same, but where the answer changes. "When Mary and John went to the store, Mary gave a drink to" → now the model prefers " John". Save every activation.

Patched run. Run the corrupted input again. But at ONE place (one layer, one token position, one component), paste in the clean activation. Measure how far the output moves back toward " Mary".

Repeat step 3 for every layer and every position. Each result fills one cell of a heatmap. Bright cells show where the information that decides the answer lives.

CLEAN CORRUPTED PATCHED copy one activation × every layer and position → heatmap
Figure 5.2. The three runs of activation patching. Each circle is the residual stream at one token in one layer. Use the buttons above to step through.

Denoising and noising

You can patch in two directions. They answer different questions. Heimersheim and Nanda (2024) gave them clear names.

"OR" circuit: either path is enough "AND" circuit: both paths needed in path A path B OR Noising A (break A only): output stays → A looks unimportant Denoising A (restore A only): output returns → A looks important in path A path B AND Noising A (break A only): output breaks → A looks important Denoising A (B still broken): nothing → A looks unimportant
Figure 5.3. Noising and denoising are not symmetric. With redundant ("OR") paths, noising misses each path. With paths that must work together ("AND"), denoising misses each one. Use both when you can.

What to measure

You need one number that says "how much the model prefers the right answer". There are several choices.

Most heatmaps show a normalized score:

score = (LD_patched − LD_corrupted) / (LD_clean − LD_corrupted)

A score of 0 means "patching did nothing; the output is still corrupted". A score of 1 means "fully restored to clean". Scores can be below 0 or above 1.

Try it: real activation patching on GPT-2 small

The widget below uses real numbers. We computed them for this survey. We ran GPT-2 small (12 layers, 12 heads per layer) with the Hugging Face transformers library. We used denoising: run the corrupted prompt, paste in one clean activation, and read the normalized logit difference. On the clean prompt, the logit difference is +2.01 (the model prefers " Mary"). The scores come from one prompt pair, so they are an example, not an average.

Interactive · Activation patching heatmap (real GPT-2 small data)
Each cell = one patched run. Rows are layers (0 at top). Columns are token positions. Colour = normalized score: orange = restores the clean answer, blue = pushes the other way. Hover a cell to see its exact value.
Clean prompt (patched position highlighted)
Corrupted prompt (tokens that differ are boxed)
Hover a cell.

Here is what to look for.

Zooming in: one cell per attention head

The heatmap above tells us where. Now we ask who. We patch the output of each of the 144 attention heads, one at a time. Hover a head to see the role that the IOI paper gave it.

Interactive · Patching each attention head (real GPT-2 small data)
Rows = layers, columns = head index. Head "L.H" means layer L, head H. Corruption follows the choice in the widget above.
Hover a head.
Heads with a known role in the IOI circuit have a dark outline.

The two corruptions light up different heads, because they test different information.

This matches the paper

Our quick run on one prompt pair recovers the same head classes that Wang et al. found with many prompts and careful path patching. That is a good sign: the IOI circuit is a stable, real feature of GPT-2 small.

What patching can and cannot see

Patching shows where the information that makes the clean and corrupted runs different is used. If both prompts share a feature, patching cannot see it. For example, both of our prompts contain "gave a drink to", so the heads that notice "a name comes next" do not light up. Choose the corruption to match your question.

Best practices

2023
Fred Zhang, Neel Nanda · ICLR 2024
A careful study of how the choices in patching change the results.

Zhang and Nanda tested the choices one by one. They found:

  1. How you corrupt matters. Gaussian noise on the embeddings (the ROME method) can push the model off-distribution. It can point to different layers than a natural corruption. They recommend symmetric token replacement: swap in a similar token, such as another name or another city.
  2. The metric matters. Probability can miss negative components, such as the negative name movers. Logit difference shows them.
  3. Patching many layers at once (a "sliding window", as in ROME) can make an effect look more localized than it is.
2024
Stefan Heimersheim, Neel Nanda
A practical guide: denoising vs noising, choice of prompts and metrics, and how to read the results.

Their main advice: start coarse, then refine. First patch the residual stream by layer and position. Then split into attention and MLP. Then go to single heads. Then use path patching to test connections.

Causal tracing: where are facts stored?

2022
Kevin Meng, David Bau, Alex Andonian, Yonatan Belinkov · NeurIPS 2022
Used noise-based patching to find where GPT recalls facts, then edited one fact with a rank-one weight change.

Meng and colleagues asked where a model stores facts. They used prompts like "The Space Needle is in downtown" → "Seattle". Their version of patching is called causal tracing.

  1. Clean run: the model says "Seattle".
  2. Corrupted run: add Gaussian noise to the embeddings of the subject tokens ("The Space Needle"). The noise had a standard deviation of 3 times the normal spread of embeddings. Now the model usually cannot recall "Seattle".
  3. Restore one clean hidden state at one (token, layer). Measure how much the probability of "Seattle" comes back. They did this for the residual stream, for MLP outputs and for attention outputs.
Figure 5.4. Schematic of the ROME causal-tracing result (drawn for this page, not the real data). Rows are tokens; asterisks mark the noised subject tokens. There are two hot spots: an early site in middle layers at the last subject token ("le*"), strongest for MLP outputs, and a late site at the last token.

They read the early site as: "middle-layer MLPs store the fact, keyed by the last token of the subject." Then they built ROME (Rank-One Model Editing). ROME changes one MLP weight matrix with a small, rank-one update to change one fact, for example to make the model say the Space Needle is in Paris. They used GPT-2 XL (1.5B parameters) and GPT-J.

Limits

Hase et al. (2023), "Does Localization Inform Editing?", found that the layer where causal tracing puts a fact does not predict which layer is best to edit. And Zhang & Nanda showed that Gaussian noise is off-distribution and can mislead. Causal tracing finds where information flows on this input. That is not always where it is "stored".

Interchange interventions and causal abstraction

Atticus Geiger, Christopher Potts, Thomas Icard and colleagues built a formal theory around patching. They call it causal abstraction.

2021
Atticus Geiger, Hanson Lu, Thomas Icard, Christopher Potts · NeurIPS 2021
Defines when a neural network "implements" a simple high-level program.

The idea works like this.

  1. Write a small high-level program with named variables. For the task "is (a + b) > c?", the program has a variable S = a + b, and then the output is "S > c".
  2. Guess which neurons in the network hold the variable S.
  3. Take two inputs. Run the network on input 1, but swap in the "S neurons" from input 2. This swap is an interchange intervention.
  4. Ask the program what should happen if S had input 2's value. Compare with what the network did.

If the network matches the program on most swaps, then the program is a good description of the network. The fraction of matches is called interchange intervention accuracy (IIA). This gives a clear, testable meaning to "the network implements this algorithm".

The same group later used these swaps as a training signal (Interchange Intervention Training, ICML 2022), and wrote a full theory paper, "Causal Abstraction: A Theoretical Foundation for Mechanistic Interpretability" (2023).

Path patching: test a connection, not a node

Activation patching asks "does this node matter?". But a circuit is made of connections. Path patching asks "does the connection from node A to node B matter?".

Here is the trick. Patch A's clean output, but feed it only into B. Every other part after A still sees A's corrupted value. This isolates one edge.

LAYER 7LAYER 9OUTPUT A = head 7.3(sender) B = head 9.9(receiver) other heads, MLPs logit diff clean value corrupted value Only the A → B edge gets the clean signal. If the output recovers, that edge matters.
Figure 5.5. Path patching isolates one edge. Here the sender is an S-inhibition head and the receiver is a name mover head, as in the IOI circuit.
2022
Kevin Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, Jacob Steinhardt · ICLR 2023
Introduced path patching and used it to find a 26-head circuit in 7 classes.
2023
Nicholas Goldowsky-Dill, Chris MacLeod, Lucas Sato, Aryaman Arora
A general, formal version of path patching.

The IOI team used path patching backwards from the output. First they found the heads that write the answer directly (the name movers). Then they asked which heads feed the name movers' queries (the S-inhibition heads). Then which heads feed those (duplicate token and induction heads). Step by step, they built the full circuit. Chapter 6 tells the story.

Limit

The number of possible paths explodes as the model grows. You need a good hypothesis to know which paths to test. This is why people built automatic methods, such as ACDC.

Causal scrubbing: test a whole hypothesis

2022
Lawrence Chan, Adrià Garriga-Alonso, Nicholas Goldowsky-Dill, Ryan Greenblatt, Jenny Nitishinskaya, Ansh Radhakrishnan, Buck Shlegeris, Nate Thomas · Redwood Research
Turns an explanation into a strict test using resampling.

Redwood Research wanted a strict test for a full explanation. Their method is called causal scrubbing. It works like this.

  1. Write your hypothesis as a map. Each model part maps to a step in a simple computation. Also say what information each part depends on. For example: "this head only uses the previous token".
  2. For each part, find other inputs that your hypothesis says are equivalent. For the example: any input with the same previous token.
  3. Replace the part's activation with its value on one of those equivalent inputs. Do this for everything at once. This "scrubs" away all information your hypothesis says does not matter.
  4. If the hypothesis is right, the model should still perform well.

The score is the fraction of loss recovered: how much of the gap between the full model and a fully scrambled model your hypothesis keeps. They tested it on induction heads in a small attention-only model and on a model that checks if parentheses are balanced.

Hypothesis: "head X only uses the previous token" Loss recovered high = hypothesis survives
Figure 5.6. Causal scrubbing. Inputs are grouped by the feature that the hypothesis says matters (here, the previous token, shown by colour). The head's activation on one input is swapped for its activation on another input of the same colour. If the hypothesis is right, the loss barely changes.
Limit

Causal scrubbing is strict and costly. It needs a very precise hypothesis. And a hypothesis that is only partly right can sometimes pass, because errors can cancel out.

ACDC: automatic circuit discovery

2023
Arthur Conmy, Augustine N. Mavor-Parker, Aengus Lynch, Stefan Heimersheim, Adrià Garriga-Alonso · NeurIPS 2023 (spotlight)
Automates path patching: delete every edge whose removal barely changes the output.

Finding the IOI circuit by hand took months. ACDC (Automatic Circuit DisCovery) does the search automatically.

  1. Treat the model as a graph. Nodes are heads and MLPs. Edges connect them.
  2. Start at the output and move backwards. For each edge, replace its value with the value from the corrupted input.
  3. Measure the KL divergence between the new output and the original output. If it goes up by less than a threshold τ, delete the edge for good. Otherwise, keep it.
  4. The edges that remain are the circuit.

ACDC found the circuits that people had found by hand: IOI, greater-than, docstring, induction, and Tracr programs. For greater-than in GPT-2 small, it kept 68 of about 32,000 edges, and all of them had also been found manually.

Interactive · ACDC on a toy graph
A made-up model graph. Each edge has an "effect" (how much the KL divergence goes up if you corrupt it). ACDC visits edges from the output backwards and deletes each edge whose effect is below τ. Press Step or Run. Change τ and reset to see bigger or smaller circuits.
Limits

ACDC needs one forward pass per edge, so it is slow on large models. The threshold is a free choice. The greedy order can change the result. And it can miss parts whose effects cancel out, such as a positive head and a negative head that balance each other.

Attribution patching: patching at the speed of gradients

Activation patching needs one forward pass for every cell in the heatmap. For a large model with millions of possible patches, this is far too slow. Attribution patching uses a shortcut from calculus.

2023
Neel Nanda · blog post
Estimate every patching result at once with one backward pass.

The idea: if you change an activation a by a small amount, the metric changes by about the gradient times that amount. So:

Δmetric ≈ (a_clean − a_corrupted) · ∂metric/∂a  (gradient taken on the corrupted run)

You need one clean forward pass, one corrupted forward pass and one backward pass. Then you get an estimate for every component at once. This is a first-order Taylor approximation: it replaces the true curve by a straight line.

Interactive · When the straight-line estimate fails
The curve shows the metric as we slide one activation from its corrupted value (α = 0) to its clean value (α = 1). The true patching effect is f(1) − f(0). Attribution patching uses the slope at α = 0 (orange line). Integrated gradients averages the slope at several points (purple). Make the curve steeper, like a saturated softmax, and watch the plain estimate fail.

The family of fast methods

2023
Aaquib Syed, Can Rager, Arthur Conmy · BlackboxNLP 2024
Applies attribution patching to edges. Matches or beats ACDC, and is far faster.

Edge Attribution Patching (EAP) scores each edge u → v as (clean output of u − corrupted output of u) · (gradient of the metric with respect to the input of v). Two forward passes and one backward pass give scores for all edges. Keep the top edges.

2024
Michael Hanna, Sandro Pezzelle, Yonatan Belinkov · COLM 2024
Replaces the single gradient with integrated gradients. Argues that circuits should be judged by faithfulness.

EAP-IG averages the gradient along the straight line from corrupted to clean activations (often 5 to 50 steps). This fixes much of the error of the straight-line estimate. The authors also argued that we should judge a circuit by faithfulness (does it reproduce the model's behaviour?), not by how much it overlaps with a "true" circuit. EAP-IG became a strong default method.

2024
János Kramár, Tom Lieberum, Rohin Shah, Neel Nanda · Google DeepMind
Finds two ways that attribution patching misses important parts, and fixes both.

The DeepMind team found that attribution patching (AtP) is the best fast method, but it has two kinds of false negatives (important parts that it scores as unimportant):

  1. Saturated attention. When the softmax is saturated, its gradient is tiny. The fix: for queries and keys, really recompute the attention pattern, and only then use the straight-line estimate.
  2. Cancellation. A part's direct effect and indirect effect can cancel. The fix, called GradDrop: switch off the gradient through one layer at a time and average the results.

They tested it on Pythia models up to 12B parameters.

Key idea

By 2024 the "gradient" world and the "patching" world had merged. Attribution patching is gradient × (activation difference). EAP-IG is integrated gradients applied to components. The same math reappears in the attribution graphs of Chapter 9.

Distributed Alignment Search: patch directions, not neurons

Because of superposition, a variable may not live in single neurons. It may live in a direction or a subspace that mixes many neurons. Patching single neurons will then miss it.

2023
Atticus Geiger, Zhengxuan Wu, Christopher Potts, Thomas Icard, Noah D. Goodman · CLeaR 2024
Learns a rotation so that a few rotated dimensions behave like a variable of a high-level program.

DAS learns a rotation of activation space. The model's weights stay frozen. Only the rotation is trained. The training goal: when you do interchange interventions on the first k rotated dimensions, the network should act like the high-level program. In other words, DAS searches for the subspace that holds the variable.

Neuron basis neuron 1 neuron 2 "S is big" is spread across both neurons ⟳ learned rotation Rotated basis axis 1 = S patch only axis 1 → swaps the value of S
Figure 5.7. DAS. In the neuron basis, the variable is spread over two neurons. After a learned rotation, one axis lines up with the variable. Interchange interventions on that axis then swap the variable cleanly.
2023
Zhengxuan Wu, Atticus Geiger, Thomas Icard, Christopher Potts, Noah D. Goodman · NeurIPS 2023
Makes DAS scale to a 7B model by learning the size of the subspace.

Boundless DAS learns the size of the subspace with soft masks, so it scales to a 7-billion-parameter model. The task was "Price Tagging": "Please say yes only if it costs between [1.30] and [8.55] dollars, otherwise no." They found that Alpaca (7B) uses two clear boolean variables: "is the price above the lower bound?" and "is the price below the upper bound?". This held even when the inputs and instructions changed.

Pitfalls: when interventions mislead

Interventions are stronger than observation. But they can still mislead. Here are the main traps.

When you put a value into the model that it never sees in training, you test the model in a strange state. Zero ablation and Gaussian noise are common causes. The model may break for reasons that have nothing to do with your question. Fix: prefer mean or resample ablation, and natural corruptions such as swapping one name for another.

2023
Thomas McGrath, Matthew Rahtz, János Kramár, Vladimir Mikulik, Shane Legg · DeepMind
Ablate one attention layer and later layers change to compensate.

McGrath and colleagues ablated an attention layer in a 7B Chinchilla model on a factual recall task. Later attention layers changed their behaviour to make up for the loss, like a hydra growing a new head. They also found late MLP layers that act as "erasers" and push down the most likely token. This happened even in models trained without dropout.

Rushing and Nanda (ICML 2024, "Explorations of Self-Repair in Language Models") found self-repair in many model families and sizes. It is imperfect (it does not fully restore) and noisy (it varies a lot by prompt). They found two causes. First, LayerNorm scaling: removing a head changes the vector's size, and the final LayerNorm rescales it. Second, anti-erasure: neurons that were erasing the answer stop doing so.

The IOI circuit shows this too. When you ablate the name movers, backup name movers take over.

Result: the drop you measure after an ablation can be smaller than the part's real importance. The direct effect and the total effect can differ.

2023
Aleksandar Makelov, Georg Lange, Neel Nanda · ICLR 2024
Patching a learned direction can change behaviour through a path the model never normally uses.

Suppose you find a direction, patch along it, and the behaviour changes. Is the direction really where the model keeps the variable? Not always. The direction may mix two parts:

  • a part that changes with the feature but that no later layer reads ("causally disconnected"), and
  • a part that later layers do read, but that is normally inactive ("dormant").

Patching along the mix switches on the dormant path. You see the behaviour change, but you caused it through a road the model never takes. The authors showed this in a toy model, in IOI, and in factual recall. Geiger's group replied (Wu et al. 2024) that this risk applies to every causal analysis, not only to DAS.

feature direction (no later layer reads it) dormant direction (read later, normally 0) learned patch direction patched point is now off-axis later-layer reader lights up!

Probability saturates, so it hides negative components. KL divergence is general but mixes many effects. Logit difference is usually best, but only when there is a clear "right" and "wrong" answer. Always say which metric you used, and check that your conclusion holds with another one.

Patching only sees the difference between clean and corrupted inputs. A badly chosen corruption tests the wrong question. Our widget shows this: the S2 swap finds S-inhibition heads, and the replace-all-names corruption finds name movers. Neither one alone shows the whole circuit. Also, results from one prompt can differ from averages over many prompts.

You zero-ablate a head and the model's accuracy falls from 95% to 20%. Mean ablation of the same head gives 94%. What is the most likely explanation?
If replacing the head by its average output keeps performance, the head carries little input-specific information for this task. The big drop under zero ablation comes from removing its constant "bias-like" output, which the model never expects to be zero.

Testing the testers: ground truth and benchmarks

How do we know if a circuit-finding method works? In a normal model, we do not know the true circuit. So researchers built models where they do know it.

2023
David Lindner, János Kramár, Sebastian Farquhar, Matthew Rahtz, Thomas McGrath, Vladimir Mikulik · DeepMind · NeurIPS 2023
Compiles human-written programs directly into transformer weights.

Tracr takes programs written in RASP, a small language that describes what transformers can do (Weiss, Goldberg and Yahav, 2021, "Thinking Like Transformers"). It compiles them straight into transformer weights. Examples include sorting, counting tokens, reversing a list, and checking balanced brackets. Because a person wrote the program, we know the true circuit. Limit: compiled models are not trained, so they look unnatural. For example, they have no superposition unless you add a compression step.

2024
Rohan Gupta, Iván Arcuschin, Thomas Kwa, Adrià Garriga-Alonso · NeurIPS 2024 Datasets & Benchmarks
Trained models that are forced to implement a known circuit.

InterpBench trains small transformers with "Strict Interchange Intervention Training" (SIIT). Each model is trained to implement a known circuit, but with realistic trained weights. The authors used them to compare ACDC, EAP and other methods.

2025
Aaron Mueller, Atticus Geiger, Sarah Wiegreffe, Yonatan Belinkov, David Bau and many others · ICML 2025
A shared benchmark with two tracks: circuit localization and causal variable localization.

MIB gives the field a shared test. It has two tracks:

The main results: attribution methods (such as EAP-IG) and mask-learning methods (which learn which edges to keep) did best at circuit localization. Supervised DAS did best at causal variable localization. And, surprisingly, features from sparse autoencoders were not better than plain neurons on that track. (A sparse autoencoder, or SAE, splits an activation into many readable feature directions.) (Chapter 8 discusses this debate.)

Update (2024–2025): circuits are less certain than one number suggests

Three later results add caution. First, Edge Pruning (Bhaskar et al., NeurIPS 2024, arXiv:2406.16778) learns a mask over edges with gradients. It found circuits with fewer edges than earlier methods, and it scaled to CodeLlama-13B. Second, Miller, Chughtai and Saunders (COLM 2024, arXiv:2407.08734) showed that faithfulness scores change a lot with small changes in the ablation method. So a faithfulness number is only meaningful together with the exact ablation that produced it. Third, Méloux et al. (ICLR 2025, arXiv:2502.20914) found that, even in small networks, many different circuits can produce the same behaviour. One circuit that passes the tests is not always the circuit.

Direct logit attribution: a cheap first look

Some questions do not need any intervention. In a transformer, the final residual stream is a sum: the embeddings plus the output of every attention head and every MLP (Chapter 4). So we can split the final logit difference into one piece per component.

The recipe: take each component's output at the final position. Apply the final LayerNorm scale (frozen from the full run). Then take the dot product with the difference of unembedding vectors, W_U[" Mary"] − W_U[" John"]. The result is that component's direct effect on the logit difference. All the pieces add up (about) to the total.

Figure 5.8. Direct logit attribution as a waterfall chart (schematic, made for this page). Name mover heads add to the "Mary − John" logit difference. Negative name movers take some away. Heads that act only by changing other heads, such as S-inhibition heads, show almost zero here, even though they matter.
Limits

Direct logit attribution only sees direct effects. A head that matters by steering later heads gets a score near zero. Freezing LayerNorm is an approximation. Self-repair also muddles the picture. Its cousins, the logit lens and the tuned lens, are covered in Chapter 4.

A note on gradient attribution

Older attribution methods also exist for language models. Gradient × input scores each input token by the gradient times its embedding. Integrated Gradients (Sundararajan, Taly and Yan, 2017) integrates gradients along a path from a baseline, so the scores add up to the full output difference. Raw attention weights are not reliable explanations; this was the subject of the 2019 debate "Attention is not Explanation" (Jain and Wallace) and its reply (Wiegreffe and Pinter). Newer decomposition methods, such as information flow routes (Ferrando and Voita, 2024), build a graph of important edges in one forward pass. All of these methods have the same weak points: gradients are local, they can be saturated or noisy, and the baseline is an arbitrary choice.

All methods side by side

MethodUnitCostWhat it testsMain trap
Zero / mean / resample ablationNode1 pass per nodeNecessityOff-distribution values; self-repair
Activation patchingNode (layer × position, head)1 pass per nodeSufficiency (denoising) or necessity (noising)Only sees the clean/corrupted difference
Causal tracing (ROME)Node1 pass per nodeWhere facts flowGaussian noise is off-distribution
Path patchingEdge or path1 pass per pathWhether a connection mattersToo many paths to test
Causal scrubbingWhole hypothesisMany passesWhether an explanation keeps performanceNeeds a precise hypothesis; errors can cancel
ACDCEdges1 pass per edgeAutomatic circuitSlow; threshold; misses cancelling parts
Attribution patching / EAPNodes or edges2 forward + 1 backwardFast estimate of patchingStraight-line error; saturation
EAP-IG / AtP*Nodes or edgesA few passesBetter fast estimateStill approximate
DAS / Boundless DASSubspaceTraining a rotationWhether a direction acts as a variableSubspace illusions
Direct logit attributionNode1 passDirect effect on outputMisses indirect effects
Why is EAP-IG usually more accurate than plain attribution patching?
Plain attribution patching uses the slope at one point (the corrupted value). If the response curves, as in a saturated softmax, that slope can be near zero. Integrated gradients averages the slope along the whole path, which tracks the true change much better.
In the real GPT-2 heatmap with the S2 swap, why are all columns except the second " John" and the final " to" near zero?
Patching a position where clean and corrupted activations are identical changes nothing. In layer 0 only S2 differs. Information spreads to other positions only when attention heads move it, and in IOI it moves to the final token.

A practical recipe

Here is a checklist for a causal study of one behaviour. It follows the advice of Heimersheim & Nanda and Zhang & Nanda.

  1. Define the behaviour with many prompts, not one. Make sure the model does it reliably.
  2. Pick a metric. Prefer logit difference between a right and a wrong answer.
  3. Design the corruption. Change only the thing you care about. Prefer natural token swaps over noise. Keep the token count the same.
  4. Start coarse. Patch the residual stream by layer and position.
  5. Refine. Split into attention and MLP outputs, then single heads. Use attribution patching to screen many parts quickly, then check the top ones with real patching.
  6. Test connections with path patching, or run ACDC / EAP-IG to propose a circuit.
  7. Test the circuit: faithfulness (ablate everything else), completeness and minimality. Use mean or resample ablation, not zero.
  8. Look for traps: try both noising and denoising; watch for self-repair and negative components; check that results hold across prompts.
  9. Explain the parts. Look at attention patterns, direct logit attribution, and what features the parts read and write.
DAS finds a direction in an MLP layer. Patching along it flips the model's answer exactly as your high-level program predicts. Which worry did Makelov et al. raise?
A learned direction can combine a part that changes with the feature (but is never read) and a part that later layers read (but is normally inactive). Patching along the mix activates the dormant path. The behaviour changes, but by a route you created.
Key takeaways
  • Correlation is not cause. To show that a part matters, change it and measure the output.
  • Ablation results depend on the replacement value. Mean or resample ablation is usually safer than zero ablation.
  • Activation patching (also called causal tracing or interchange intervention) copies an activation from a clean run into a corrupted run. The logit difference is the usual metric.
  • Path patching, causal scrubbing and ACDC test connections and whole circuits. Attribution patching and EAP-IG estimate patching with gradients, very fast.
  • DAS finds directions that act like variables. Every method has traps: self-repair, off-distribution values and illusions that you create yourself.

Where this leads: Chapter 6 uses these tools on real behaviours. The gradient ideas come back in the attribution graphs of Chapter 9.

References

  1. Vig, J., Gehrmann, S., Belinkov, Y., et al. (2020). Investigating Gender Bias in Language Models Using Causal Mediation Analysis. NeurIPS.
  2. Geiger, A., Lu, H., Icard, T., Potts, C. (2021). Causal Abstractions of Neural Networks. NeurIPS.
  3. Geiger, A., Wu, Z., Lu, H., et al. (2022). Inducing Causal Structure for Interpretable Neural Networks. ICML.
  4. Geiger, A., et al. (2023). Causal Abstraction: A Theoretical Foundation for Mechanistic Interpretability.
  5. Meng, K., Bau, D., Andonian, A., Belinkov, Y. (2022). Locating and Editing Factual Associations in GPT. NeurIPS.
  6. Hase, P., Bansal, M., Kim, B., Ghandeharioun, A. (2023). Does Localization Inform Editing? NeurIPS.
  7. Wang, K., Variengien, A., Conmy, A., Shlegeris, B., Steinhardt, J. (2022). Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 small. ICLR 2023.
  8. Goldowsky-Dill, N., MacLeod, C., Sato, L., Arora, A. (2023). Localizing Model Behavior with Path Patching.
  9. Chan, L., Garriga-Alonso, A., Goldowsky-Dill, N., et al. (2022). Causal Scrubbing. Redwood Research.
  10. Conmy, A., Mavor-Parker, A. N., Lynch, A., Heimersheim, S., Garriga-Alonso, A. (2023). Towards Automated Circuit Discovery for Mechanistic Interpretability. NeurIPS.
  11. Nanda, N. (2023). Attribution Patching: Activation Patching At Industrial Scale.
  12. Syed, A., Rager, C., Conmy, A. (2023). Attribution Patching Outperforms Automated Circuit Discovery.
  13. Hanna, M., Pezzelle, S., Belinkov, Y. (2024). Have Faith in Faithfulness: Going Beyond Circuit Overlap When Finding Model Mechanisms. COLM.
  14. Kramár, J., Lieberum, T., Shah, R., Nanda, N. (2024). AtP*: An efficient and scalable method for localizing LLM behaviour to components.
  15. Zhang, F., Nanda, N. (2023). Towards Best Practices of Activation Patching in Language Models: Metrics and Methods. ICLR 2024.
  16. Heimersheim, S., Nanda, N. (2024). How to use and interpret activation patching.
  17. Geiger, A., Wu, Z., Potts, C., Icard, T., Goodman, N. D. (2023). Finding Alignments Between Interpretable Causal Variables and Distributed Neural Representations. CLeaR 2024.
  18. Wu, Z., Geiger, A., Icard, T., Potts, C., Goodman, N. D. (2023). Interpretability at Scale: Identifying Causal Mechanisms in Alpaca. NeurIPS.
  19. Makelov, A., Lange, G., Nanda, N. (2023). Is This the Subspace You Are Looking For? An Interpretability Illusion for Subspace Activation Patching. ICLR 2024.
  20. Wu, Z., Geiger, A., et al. (2024). A Reply to Makelov et al. (2023)'s "Interpretability Illusion" Arguments.
  21. McGrath, T., Rahtz, M., Kramár, J., Mikulik, V., Legg, S. (2023). The Hydra Effect: Emergent Self-repair in Language Model Computations.
  22. Rushing, C., Nanda, N. (2024). Explorations of Self-Repair in Language Models. ICML.
  23. Li, M., Janson, L. (2024). Optimal ablation for interpretability. NeurIPS.
  24. Lindner, D., Kramár, J., Farquhar, S., et al. (2023). Tracr: Compiled Transformers as a Laboratory for Interpretability. NeurIPS.
  25. Weiss, G., Goldberg, Y., Yahav, E. (2021). Thinking Like Transformers. ICML.
  26. Gupta, R., Arcuschin, I., Kwa, T., Garriga-Alonso, A. (2024). InterpBench: Semi-Synthetic Transformers for Evaluating Mechanistic Interpretability Techniques. NeurIPS Datasets & Benchmarks.
  27. Mueller, A., Geiger, A., Wiegreffe, S., et al. (2025). MIB: A Mechanistic Interpretability Benchmark. ICML.
  28. Elhage, N., et al. (2021). A Mathematical Framework for Transformer Circuits. Anthropic.
  29. Sundararajan, M., Taly, A., Yan, Q. (2017). Axiomatic Attribution for Deep Networks (Integrated Gradients). ICML.
  30. Jain, S., Wallace, B. C. (2019). Attention is not Explanation. NAACL.
  31. Ferrando, J., Voita, E. (2024). Information Flow Routes: Automatically Interpreting Language Models at Scale. EMNLP.
  32. Bhaskar, A., Wettig, A., Friedman, D., Chen, D. (2024). Finding Transformer Circuits with Edge Pruning. NeurIPS.
  33. Miller, J., Chughtai, B., Saunders, W. (2024). Transformer Circuit Faithfulness Metrics are not Robust. COLM.
  34. Méloux, M., Maniu, S., Portet, F., Peyrard, M. (2025). Everything, Everywhere, All at Once: Is Mechanistic Interpretability Identifiable? ICLR.