Activation Patching
An interpretability technique that replaces an internal activation in one model run with a value from another and measures how the output changes.
Which hidden state changed the answer?
Imagine two matched prompts about differently colored boxes. A researcher saves a hidden activation from the blue-box run and substitutes it at the corresponding position in the red-box run.
- Baseline
- Record the unmodified model’s scores for the candidate colors on both prompts. Keep the model, token positions and scoring rule fixed.
- Intervention
- Replace the chosen activation and rerun the remaining computation. Measure how far the output moves toward the blue-box result.
What the comparison supports
A shift implicates that activation in this setup. Repeat across examples and control sites before assigning a general function to a component.
Choose a comparison that isolates the question
Align the positions and activation sites across both runs. Record the output score before and after the intervention. A replacement drawn from a mismatched position may change the result for reasons unrelated to the feature under study.
What a patch can reveal
A change in the chosen score supplies causal evidence about the intervention in this particular model and input pair. A small effect can also arise when several components carry overlapping information. Compare sites and test alternative input pairs before describing a component as necessary or sufficient.
Follow the idea
Interpretability · Compare interventions with explanations based only on observed behavior.
Transformer · Locate the layers where a hidden state can be compared.
Source · Zhang and Nanda on interpreting activation patching
Return to Activation Patching in the A–Z glossary