What is activation patching?
Author: Mehdi Sadriu, independent educator. Last reviewed: 25 November 2026. How we check claims: methodology.
Activation patching tests whether an internal value is used, not only whether a probe can read it. You run a clean prompt and a corrupted prompt, copy one activation from one run into the other, and see whether the behaviour comes back. Meng et al. (2022) call a version of this causal tracing; Heimersheim & Nanda (2024) is a practical how-to.
In one paragraph. Patching: replace activation a_corrupted[c] with a_clean[c] (or the reverse) at component c, and measure the change in output.
| Run | Prompt sketch | logit(Mary) − logit(John) |
|---|---|---|
| Clean | … John gave a drink to ___ | +3.2 |
| Corrupted | names swapped / scrambled | −0.4 |
| Patched name-mover head | corrupted + clean head activation | +2.7 |
If patching one component restores most of the logit difference, that component carried information the model used (the logic of Meng et al., 2022, and Wang et al., 2022). These particular numbers are not from those papers.
What is the plain-language experiment?
Two performances of the play. In one, the actor says the right name. In the other, the script is scrambled. You dub one internal line from the good performance into the bad one. If the ending is restored, that line mattered.
What should you watch for?
A high patching score can mean the component carries a copy of information that other components also carry. Corruption that is too narrow can flatter one site. McGrath et al. (2023) document self-repair: knock out one path and another compensates. Heimersheim & Nanda recommend reporting the metric (often logit difference), the corruption, and a no-op baseline.
How did ROME use this?
Meng et al. (2022) trace which MLP activations mediate a factual prompt ('The Eiffel Tower is in'), then apply a rank-one edit. The result is about the facts and models they tested. It does not imply every fact lives in one editable cell.
What is the math?
Let L(y*) be a scalar such as logit(correct) − logit(incorrect). Causal indirect effect of component c ≈ L(corrupted-with-c-patched) − L(corrupted). Path patching restricts which downstream nodes see the patched value (used in circuit papers such as Wang et al., 2022).
Worked example
IOI template: clean logit difference +3.2, corrupted −0.4, name-mover head patched back +2.7. Most of the behaviour rode on that head in this teaching table. A real experiment would average many name pairs and report variance. mej7.com does not run two model forwards; it has nothing to copy.
Check your understanding
Five questions. Answers are in the disclosure under each item, so this page still works if JavaScript is off.
Further reading
- Locating and Editing Factual Associations in GPT — Meng et al. (2022). NeurIPS.
- How to Use and Interpret Activation Patching — Heimersheim & Nanda (2024). arXiv.
- Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 Small — Wang et al. (2022). arXiv.
- The Hydra Effect: Emergent Self-repair in Language Model Computations — McGrath et al. (2023). arXiv.