TL;DR
Mechanistic interpretability is the effort to explain what a trained neural network computes by reading its internal structure. Researchers look for units that carry a recognisable feature, follow the paths that connect them into a circuit, and check each claim by changing the internal values and seeing whether the output changes as predicted. The goal is an explanation that could be used to predict the network's behaviour on inputs nobody has tested.
Builds on: Causal Tracing, Autoencoder · Leads to: Toy Models of Superposition, Scaling and evaluating sparse autoencoders
Where it's used
Locating a stored fact. Given a language model that answers "The Eiffel Tower is in" with "Paris", researchers use Causal Tracing to find which hidden states and layers carry that answer. The result tells them where a fact is written in the network, which is the first step toward reading it or editing it.
Finding a circuit for a task. For a language model that completes a sentence such as "When Mary and John went to the store, John gave a drink to", the next word should be "Mary". Researchers have traced the attention heads that move the name and the heads that suppress the repeated name, and combined them into a circuit that accounts for the answer. The original study of this circuit, in GPT-2 small, is the indirect object identification circuit paper.
Auditing before deployment. A safety team wants to know whether a model uses a particular internal feature when it refuses a request. If an intervention on that feature changes the refusal and the feature can be identified across many prompts, the team has evidence about the mechanism. It is not a complete guarantee, and the limits are discussed below.
How it works
Take a tiny network so every number can be checked by hand. It has one input , two hidden neurons (each a ReLU of a shifted input) and one output.
- Neuron .
- Neuron .
- Output .
Suppose we want to know which neuron matters for the output on a clean input compared with a corrupted input .
- Run the clean input and record every internal value. At : , , and . Check: the output is 4, and both neuron values are recorded.
- Run the corrupted input and record its values. At : , , and . Check: the two runs differ in output by . That gap is what we want to explain.
- Patch one neuron. Run the corrupted input again, but overwrite with its clean value, 2, and keep at its corrupted value, 1. The output becomes . Check: patching moved the output from to , so recovers of the 5 units.
- Patch the other neuron. Run the corrupted input with overwritten by its clean value, 0, and left at its corrupted value, 0. The output becomes . Check: patching moved the output by , so recovers 1 unit.
- Add up the effects. The two patches account for units, which is the whole gap from step 2. Check: the explanation is complete for this pair of inputs, because the output is a sum of the two neuron paths.
- Write the circuit. The input drives and , and the output reads both with weights 2 and . The claim is testable: on any input, the output should equal with those neuron values. Check: at and the formula gives 4 and , matching the runs in steps 1 and 2.
flowchart LR X["Input x"] --> H1["h1 = max(x minus 1, 0)"] X --> H2["h2 = max(1 minus x, 0)"] H1 -->|weight 2| Y["Output y"] H2 -->|weight minus 1| Y
The math
Let be a component of the network (a neuron, an attention head, a layer). Let be its activation on input , and let be the output on input when that activation is replaced by . For a clean input and a corrupted input , the effect of component is The total difference between the two runs is .
Step 1 and 2 in symbols: the two runs
With and : so .
Step 3 and 4 in symbols: patching each neuron
For , and the patched corrupted output is , so .
For , and the patched corrupted output is , so .
Step 5 in symbols: additivity
In this network the output is linear in the two neurons, so the effects add: Real networks are not linear, and the effects need not add up. When they do not, the gap is evidence that paths interact, which is the signal to look for a larger circuit.
Step 6 in symbols: the circuit as a formula
The circuit claim is with and . The claim can be checked on every input, not only the two used to find it. Any input where the formula disagrees with the network refutes it.
Worked examples
The network is and . Clean input gives . Corrupted input gives .
- Clean activation of : .
- Patch into the corrupted run. The output becomes .
- The patch moves the output from 0 to 6, so .
- The total difference is , so accounts for all of it.
Interpretation: the single neuron is the whole mechanism for this input pair. The patch shows that, and it would be a mistake to conclude more about the network from it.
This is the network from "How it works": , , , with clean input and corrupted input .
- Total gap: .
- Patch : the corrupted output becomes , so .
- Patch : the corrupted output becomes , so .
- Share of the gap from : , or 80 percent. From : , or 20 percent.
Interpretation: the two shares add to 100 percent here because the network is linear in the neurons. The explanation says that carries most of the difference and carries the rest.
An auditor thinks one attention head is responsible for copying a name into an answer. On a clean prompt the model's score for the correct name is 4. On a corrupted prompt, where the name is changed, the score is . Patching the head's output from the clean run into the corrupted run moves the score to 2.
- Total gap: .
- Effect of the head: .
- Fraction of the gap restored by the head: .
- Repeat over 200 prompts and report the average and the spread, not one number.
Interpretation: patching this head restores 60 percent of the gap on this example. That is strong evidence the head is involved, but not proof that it is the whole mechanism, because other heads may also carry the name.
Try it: a patch moves the score from to , with clean score 4 and corrupted score . What fraction of the gap does the patched component restore? Answer: the effect is out of a gap of 5, so , or 40 percent.
Common mistakes and tradeoffs
It is tempting to think a neuron that fires on cat pictures means the network "knows" cats. In fact a correlation between an activation and a concept does not show that the network uses that activation. Patching or ablating the unit, and measuring the output change, is the test that separates use from coincidence.
It is tempting to think each neuron stands for one concept. In fact a network can pack more features than it has neurons by storing them as directions that overlap, which is the setting studied in [[superposition-paper|Toy Models of Superposition]]. A single neuron can therefore mix unrelated concepts. This is why researchers also look for feature directions, for example with sparse autoencoders, rather than only reading single neurons.
It is tempting to think a circuit found on one task explains the whole model. In fact a circuit is an explanation for the inputs tested. Networks often have backup paths, so removing one component can show little effect even when it matters in general, and the explanation may fail on new inputs.
When to use it: when you need a causal account for a specific behaviour, want to test a hypothesis about a mechanism, or need evidence for an audit. When not to use it: when you only need a model that works, or when the question is about aggregate behaviour across many inputs, where behavioural tests or statistical attribution are cheaper. The method gives precise answers on the cases it tests, but it is labour-intensive and does not yet scale to every behaviour of very large models.
History
Early work on understanding neural networks looked at what individual units responded to, and often found units that mixed several concepts. The idea that a network might be understood as a set of interacting parts, each doing a recognisable job, became a research program around 2020, with circuits as the central object. Causal Tracing gave researchers a way to test which internal states carry an answer, using interventions instead of correlations.
In 2022 the toy-models paper showed that networks can store more features than neurons by using superposition, which explained why single neurons are often hard to read. Sparse autoencoders were then proposed as one way to recover features from the activations. The field is still young, and its methods and claims are actively revised.
Recap
- Mechanistic interpretability explains a network by finding its internal parts and the paths between them.
- Claims are tested by intervening: patching a component's activation from one run into another and measuring the output change.
- The effects of components can be compared as shares of the total gap, but they add up only when the network is close to linear in them.
- Neurons often mix features because of superposition, so single neurons are not always the right units.
- Read next: Toy Models of Superposition for why features overlap, and Scaling and evaluating sparse autoencoders for one way to find them.
Check yourself
QuestionWhat is the difference between correlating an activation with an output and patching it?Show answer
Correlation shows that the activation and the output vary together, which can happen by coincidence or through another path. Patching replaces the activation with a value from a different run and measures how the output changes, which tests whether the output depends on it.
QuestionFor a network with clean output 6, corrupted output 2, and a component whose patch brings the output to 5, what fraction of the gap does the component restore?Show answer
The total gap is . The patch effect is . The fraction is , or 75 percent.
QuestionWhy can a single neuron appear to respond to several unrelated concepts, and why does that make it hard to read the network neuron by neuron?Show answer
In superposition, a network stores more features than it has neurons by using overlapping directions. Each neuron then takes part in several features at once, so its activation mixes them and no single neuron matches one concept.
QuestionAn explanation of a circuit was found using 50 prompts. A new prompt shows the circuit fails. What does that suggest, and what should the researcher do?Show answer
The explanation holds only for the inputs tested, or it missed a backup path. The researcher should treat the circuit as a hypothesis, examine the failing prompt with the same patching method, and extend or revise the circuit, rather than assuming the earlier 50 cases settle the question.