TL;DR
Single neurons in a language model are hard to read, because each one mixes many unrelated things. This paper splits a model's internal activations into sparse autoencoder features, each meant to track one human-readable idea. It then finds the small set of features, and the links between them, that causally carry out a behaviour, which the authors call a sparse feature circuit. They use circuits in two ways: to explain how a model handles subject-verb agreement, and to remove a classifier's dependence on gender without any extra labelled data.
Builds on: Sparse Autoencoder, Attribution Patching, Integrated Gradients, Causal Tracing · Leads to: later circuit-discovery work that uses learned features rather than neurons
Why it mattered
The paper shows that interpretability results can be used to change a model, not only to describe it. Its Shift method took a classifier that had learned gender as a shortcut for profession, removed the features a human judged irrelevant, and raised the worst-group accuracy of a Pythia-70M classifier from 24.4 to 76.0 without retraining, and to 89.0 with a retrained head. The same idea applied to Gemma-2-2B raised the worst-group accuracy from 18.2 to 92.9 after retraining.
The work also made interpretability tools easier to reuse. The authors released code, data and autoencoders, and they used open-weights models throughout. Their experiments depend on public sparse autoencoders: they trained their own for Pythia-70M and used the Gemma Scope suite (Lieberum et al., 2024) for Gemma-2-2B. The features can be browsed on Neuronpedia, and the clusters and circuits on a separate site, feature-circuits.xyz.
The problem
Mechanistic interpretability tries to explain a network by finding its internal parts and the paths between them. Two obstacles made that hard for language models.
The first is the unit of analysis. Coarse parts such as attention heads or MLP blocks are polysemantic: each one responds to several unrelated things, so a finding about a head is hard to apply. Single neurons have the same problem, and the paper notes that they are rarely interpretable. Methods that work on finer units, such as probes, usually need a hypothesis written down before the search starts. Those hypotheses are often missing when a model does something surprising.
The second is scale. Testing whether each unit matters with a separate forward pass is slow when there are tens of thousands of units. A causal test here means changing one internal value and checking whether the output changes. Setting a value to zero or to its average over the data is called ablation. The indirect effect of a unit is the change in a chosen metric, such as the log probability of the correct verb, when that unit alone is set to its value from a different input.
The paper keeps the causal test but makes it cheap enough to run on every candidate unit, and it runs it on sparse features.
How it works
The method turns a model into a graph whose nodes are features and whose edges are the links between them. Here is the pipeline for one contrastive dataset.
- Start with a language model , a sparse autoencoder for each sublayer, a dataset of input pairs that differ in one way (for example, "The parents" and "The parent"), and a metric that scores the output, such as the log probability of the correct verb minus the log probability of the wrong one.
- Write each hidden state as a sum of sparse features plus an error term that the autoencoder does not capture. Features and errors become nodes of the graph.
- Run the model on the clean input and the patch input, and store every node's value.
- Run one backward pass to get the gradient of with respect to every node at the clean values. Multiply each node's gradient by the change in its value from clean to patch. This gives an estimated indirect effect for every node at once.
- Average each node's estimate over inputs and keep the nodes whose size is above a threshold. Scores below the threshold are dropped.
- Estimate the effect of each edge with an analogous linear approximation, and keep the edges above a second threshold. The details are in the paper's appendix.
- The kept nodes and edges form the circuit. Check it by measuring its faithfulness and completeness (see The math).
- To apply Shift, a person reads each feature in the circuit, decides which ones are task-irrelevant, ablates them, and optionally fine-tunes the model.
flowchart LR A["Clean and patch input pairs"] --> B["Cache activations at each feature and error node"] B --> C["One backward pass for gradients at clean values"] C --> D["Score each node with the linear estimate"] D --> E["Average over inputs and keep nodes above threshold"] E --> F["Score edges and keep those above threshold"] F --> G["Sparse feature circuit"]
Here is one tiny instance of step 4. Take a single node whose value is 2.0 on the clean input and 3.0 on the patch input. Suppose the gradient of the metric at the clean value is 0.5. The estimated effect is 0.5 times (3.0 minus 2.0), which is 0.5. If the true effect of setting the node to 3.0 is close to 0.5, the linear estimate is good for this node. The paper finds that the estimate is good for most features, but underestimates the effect for nodes in the layer 0 MLP and the early residual stream, so it uses integrated gradients for those.
The math
Step 1 in symbols: the sparse autoencoder decomposition
For a hidden state , the autoencoder writes
where is the number of features, each is a unit-length feature direction, each is how strongly feature is active on this input, is a bias, and is what the features do not reconstruct. The Pythia autoencoders use , and the Gemma Scope autoencoders use . The paper keeps as a node so that the circuit accounts for everything the model computes.
Step 4 in symbols: the indirect effect and its estimates
The exact indirect effect of a node is
that is, the output on the clean input after setting the node to its patch value, minus the clean output. Computing this for every node needs one forward pass per node, which is too many. The first-order estimate, called attribution patching, is
The gradient is the vector of partial derivatives of the metric with respect to the node's values. The paper's more accurate version, from integrated gradients, averages the gradient along the straight path between the clean and patch values:
with equally spaced values of . The integral form is the same one used in the integrated gradients lesson. The attribution form needs only two forward passes and one backward pass for all nodes; the integrated form costs roughly times as much, because it takes gradients.
Step 7 in symbols: faithfulness and completeness
Let be the average metric when every node outside the circuit is set to its average value over the data. Then
where is the empty circuit and is the full model. A faithfulness of 1 means the circuit reproduces the whole model's behaviour. Completeness is the faithfulness of the complement , and its ideal value is 0, which means that removing the circuit removes all of the behaviour.
Worked examples
- The node's value on the clean input is , and on the patch input it is .
- The gradient of the metric at the clean value is .
- The change in the node's value is .
- The estimate is .
Interpretation: patching this node should raise the metric by about 0.5. A node whose estimate is large in size (ignoring the sign) matters more, and the sign says whether the change raises or lowers the metric.
- The full model scores . The empty circuit scores .
- The circuit , with the rest mean-ablated, scores .
- Faithfulness is .
- The complement , with the circuit mean-ablated, scores .
- Completeness is .
Interpretation: the circuit explains about two thirds of the behaviour above the baseline. The complement still carries about a sixth, so the circuit is not complete. Ideal values would be 1 and 0.
The paper's Table 2 reports worst-group accuracy, which is the lowest accuracy among the four groups of profession and gender. For Pythia-70M, the original classifier scores 24.4, and after Shift it scores 76.0. For Gemma-2-2B, the original classifier scores 18.2.
- Compute the Pythia gain: points.
- Compare Pythia's gender accuracy before and after Shift: it drops from 87.4 to 54.0, so the classifier relies much less on gender.
- Compute the Gemma gain before retraining. Shift gives Gemma a worst-group accuracy of 50.0.
- Compute the difference: points.
Try it: after retraining, Gemma's worst-group accuracy rises to 92.9. How many points is that above the Shift-only result of 50.0? Answer: points. The retrained result is close to the oracle, which reaches 93.1 worst-group accuracy when trained on ground-truth labels for the balanced set.
Results
Interpretability. Crowdworkers rated the Pythia sparse features as more interpretable than neurons, and features that take part in circuits as more interpretable than random features. The paper relies on earlier work for the Gemma features.
Faithfulness. On Pythia-70M, about 100 feature nodes explain most of the model's performance on subject-verb agreement. On Gemma-2-2B, about 500 nodes do. To explain half the performance with neurons, the paper reports about 1,500 neurons for Pythia and about 50,000 for Gemma.
Completeness. Ablating a few nodes of the feature circuit removes the task performance, even when all SAE error terms stay in place. Neuron circuits need hundreds of neurons for Pythia and thousands for Gemma.
Case study. The Pythia circuit for agreement across a relative clause has 86 nodes and faithfulness 0.21. The Gemma circuit has 223 nodes and faithfulness 0.21. Both circuits route the number of the subject through a detector for the start of a prepositional phrase or relative clause, and then promote the matching verb form.
Shift. Shift removed 55 Pythia features and 43 Gemma features judged task-irrelevant. On the balanced set, Pythia's gender accuracy fell from 87.4 to 54.0, and its profession accuracy rose from 61.9 to 88.5. After retraining, Pythia reaches 93.1 profession accuracy and 89.0 worst-group accuracy. Ablating random SAE features had essentially no effect, and Shift with neurons was dropped because almost no neurons were interpretable. A neuron baseline that picked the most spurious neurons automatically was worse than Shift.
Unsupervised discovery. On a large subset of The Pile with Pythia-70M, the authors clustered inputs by the behaviour they show and found feature circuits for thousands of clusters. Many clusters match narrow behaviours such as predicting "to" as an infinitive object, or commas in dates.
Limits. The method needs sparse autoencoders for the model, which take a large one-time compute cost to train. Much of the evaluation is qualitative, and feature labels depend on the annotator and the task. Model components the autoencoders do not capture stay uninterpretable.
Reading guide
- Section 1, Introduction. Read after Mechanistic Interpretability and Sparse Autoencoder. It states the two obstacles and the three contributions.
- Section 2, Formulation. Needs Sparse Autoencoder, Attribution Patching, Integrated Gradients and Taylor Series. Equations (1) to (4) are the core of the paper.
- Section 3.1, Method. Needs Causal Tracing for the idea of an indirect effect and Residual Stream for the hidden states the features are taken from. Appendix A covers the edge estimates.
- Section 3.2 and 3.3, Subject-verb agreement. Needs Transformer and Attention Mechanism to follow the circuit diagrams.
- Section 4, Shift. Needs Sparse Autoencoder and the idea of a linear classification head trained on activations. Read Table 2 with Example 3 in mind.
- Section 5, Unsupervised discovery. Needs Language Model and the gradient ideas from Integrated Gradients.
- Section 6, Related work and Section 8, Limitations. Read Causal Tracing and Toy Models of Superposition first to place the causal and polysemantic claims.
Check yourself
QuestionIn one sentence, what is a sparse feature circuit?Show answer
QuestionA node has clean value 1.0, patch value 4.0 and gradient at the clean value. What is its attribution estimate?Show answer
QuestionWhy does the paper use sparse autoencoder features rather than neurons as the nodes of its circuits?Show answer
QuestionA classifier learned to use gender as a shortcut for profession. Describe the steps of Shift and what you would check to see if it worked.Show answer
Sources
- Marks, Rager, Michaud, Belinkov, Bau and Mueller, "Sparse Feature Circuits: Discovering and Editing Interpretable Causal Graphs in Language Models," arXiv:2403.19647. https://arxiv.org/abs/2403.19647
- Sundararajan, Taly and Yan, "Axiomatic Attribution for Deep Networks," arXiv:1703.01365. https://arxiv.org/abs/1703.01365
- Elhage et al., "Toy Models of Superposition," arXiv:2209.10652. https://arxiv.org/abs/2209.10652