TL;DR
Circuit analysis asks which parts of a language model, connected by which paths, produce a behaviour. The obstacle is the MLP sublayer inside each transformer block: its neurons are hard to read, and the features that sparse autoencoders find are spread over many neurons with nonlinearities in between. This paper trains a transcoder for each MLP, a wide, sparse, one-hidden-layer network that imitates the MLP's input-output behaviour. Because each transcoder feature has an encoder vector and a decoder vector, the link between a feature before the MLP and a feature after it splits into an input-dependent number and an input-independent number. The authors report that transcoders are at least as sparse and faithful as sparse autoencoders in their comparisons, and they use them to revisit a known circuit in GPT-2 small.
Builds on: Transcoder, Sparse Autoencoder, Mechanistic Interpretability, Residual Stream · Leads to: later circuit analyses that use transcoders as the stand-in for each MLP layer
This lesson describes research on the internal workings of AI models. It is not a claim about any product's safety.
Why it mattered
The paper introduced transcoders as a tool for mechanistic interpretability. Researchers who want to trace how a model turns an input into an output need features that they can name and follow across layers, and MLP layers are where much of the processing happens. Before this work, the usual route was to train sparse autoencoders on each layer and then try to connect their features through the MLP with gradients or causal patches. Those links depend on the input, so they describe one prompt at a time.
The paper's contribution is a way to make the link input-invariant. The weight-based part of the connection can be read off the trained weights and then inspected across all inputs at once. The paper also reports that the transcoder features it examined are about as interpretable as sparse autoencoder features on the same MLP, so the method does not cost clarity.
The problem
Three properties are wanted at once, and earlier methods had only two of them.
Interpretable units. A single MLP neuron is polysemantic: it fires for many unrelated concepts. Sparse autoencoders reduce this by finding directions in activation space, called features, that tend to mean one thing. But an SAE feature is usually a dense combination of many neurons, each with its own nonlinearity, so it is not a simple function of the features before the MLP.
Input-dependence. Circuit links between SAE features, computed by causal patching or by input-times-gradient, are numbers for one input. Averaging them over many inputs loses the per-input story, and the averages do not say how the MLP behaves in general.
Input-invariance. What is missing is a statement about the MLP's behaviour across all inputs. Suppose a feature after the MLP fires. A patch on one prompt may show that a pre-MLP feature for Polish surnames is important. A question of that kind is whether an English-surname feature would also fire the later feature on other prompts, and whether there are prompts where the Polish-surname feature fires but the later feature does not. Without input-invariance, such questions cannot be answered from the method.
The paper's task is therefore to find a stand-in for the MLP whose features are interpretable, whose links between features can be computed from weights, and which is faithful enough to put back into the model.
How it works
The method has two parts: train a transcoder for each MLP, then trace circuits through the trained transcoders. We follow one feature through this process using round, illustrative numbers. The values are not from the paper.
flowchart LR A["MLP input x"] --> B["Encoder: ReLU of W_enc x + b_enc"] B --> C["Sparse feature activations, few nonzero"] C --> D["Decoder: W_dec times activations + b_dec"] D --> E["Output approximating the MLP output"] E --> F["Loss: faithfulness plus L1 sparsity penalty"] F -->|"gradient step"| B
-
The MLP is a box with an input and an output. Take one MLP sublayer in a transformer block. It maps a vector of size 768 (in GPT-2 small) to an output of the same size, through a wide hidden layer of neurons with a nonlinearity. Its internals are what make it hard to read. Check: the goal is to imitate the input-output map, not the internals.
-
The transcoder has a wider hidden layer. It has 32 times as many features as the model has dimensions. With 768 dimensions, that is 24,576 features. Each feature has an encoder vector, a row of the encoder matrix, and a decoder vector, a column of the decoder matrix. Check: a feature's activation is a single number per token.
-
Encode the input. For a given token, the transcoder computes each feature's pre-activation as the dot product of its encoder vector with , plus a bias, and passes it through a ReLU. Most results are zero. Suppose a token produces three nonzero features, with activations 2.0, 0.5 and 1.0. Check: only three of the 24,576 features are active, so the code is sparse.
-
Decode into the output. Each active feature contributes its decoder vector, scaled by its activation. The output is the weighted sum of decoder vectors plus a bias. For the example, the output is plus the bias. Check: the output is a sparse linear combination of feature vectors.
-
Score the imitation. Two terms are minimised together. A faithfulness term penalises the squared distance between the true MLP output and the transcoder output. A sparsity term adds a penalty proportional to the sum of the activations. A weight sets the trade-off. Check: a larger gives fewer active features and a less faithful output.
-
Trace a link between two features. Now take a feature in the layer transcoder before the MLP and a feature in the layer transcoder after it. The contribution of to on one token is its current activation multiplied by one number: the dot product of 's decoder vector with 's encoder vector. Check: the activation depends on the input, but the dot product does not.
-
Read the link. If the activation of is 2.0 and the dot product is 0.4, the contribution is 0.8. The dot product can be computed once, from weights, and inspected for every input. Only the activation changes from prompt to prompt. Check: this is the factorisation into an input-dependent part and an input-invariant part.
-
Follow the chain. A circuit is a path of such links through several layers, and attention heads add their own links between residual-stream positions. The paper's circuit method keeps the links with the largest attributions, so the circuit is a small subgraph of feature links rather than the whole network. Check: the circuit is a subgraph, not the whole network.
The math
The paper writes the transcoder for layer as follows, with the input to the MLP sublayer.
A transcoder with features for an MLP with input is
where , , and sets negative entries to zero. The -th row of is the encoder feature vector , and the -th column of is the decoder feature vector . The -th entry of is the activation of feature .
Steps 1 to 4 in symbols: the forward pass
In symbols, the encoder maps to a vector of non-negative activations, and the decoder maps the activations back to the model's width. For the three active features of the example, has three nonzero entries, at positions , and the output is .
Step 5 in symbols: the loss
The paper trains with
The first term is the squared error between the MLP output and the transcoder output. The second is times the sum of the activations, which is the L1 norm because the activations are non-negative. Raising pushes toward fewer active features at the cost of a larger error.
Steps 6 and 7 in symbols: the input-invariant link
For a feature in the layer transcoder and a feature in the layer transcoder, with , the contribution of to on token is
The first factor is the activation of feature on this token. The second factor depends only on the weights. Since the paper's derivation treats the transcoders as fixed, the second factor is the same for every prompt. Check: with activation 2.0 and dot product 0.4, the contribution is . The paper describes this circuit method in its Appendix D.
Step 8 in symbols: sums over paths
A feature's total effect is the sum of its contributions along all paths that lead to it. Attention heads contribute their own terms, and the paper ranks the edges of a circuit by the size of these terms. The method treats attention patterns as fixed, a limitation the authors state.
Results
The results have three parts: an interpretability check, a sparsity and faithfulness comparison with SAEs, and a case study.
Interpretability. The authors manually inspected 50 random features from a Pythia-410M layer 15 transcoder and 50 random features from a layer 15 SAE on the MLP input. Features were shuffled so the rater did not know their source. The transcoder had 41 interpretable features, 8 possibly interpretable and 1 uninterpretable. The SAE had 38, 8 and 4. Among the interpretable features, 6 transcoder features and 16 SAE features were judged context-free, meaning they fire on a single token with no evident context-dependent pattern. The sample is small, so the result shows the two are comparable, not that one is better.
Sparsity and faithfulness. The authors trained SAEs and transcoders on GPT-2 small, Pythia-410M and Pythia-1.4B, with several values of for each. Faithfulness was measured as the rise in next-token cross-entropy loss when the model's MLP was replaced by the transcoder or SAE, evaluated on about 3.2 million tokens of OpenWebText. Sparsity was the mean number of active features per token. In the sparsity-accuracy plot, transcoders were equal to or better than SAEs in every case, and the gap appeared to widen on the larger models. The authors caution that compute limited the hyperparameter sweeps, and that the learning rate was tuned on transcoders and shared with the SAEs.
The greater-than circuit. Hanna and colleagues had found a circuit in GPT-2 small that makes the model predict a year later than the year it has just read, as in "The war lasted from 1737 to 17". The paper traces that circuit with transcoders. It finds that the highest-attribution features in MLP 10 are fed through attention head 1 in layer 9, which corroborates the original work. Across 100 prompts of the form "The war lasted from 17YY to 17", the features with the largest variance in MLP 10 have strong input-invariant links from MLP 0 features through the same head, and the top de-embedding tokens of those links include two-digit numbers. The authors call this somewhat unexpected, because the vocabulary of over 50,000 tokens contains only 100 two-digit number tokens.
Compared with MLP neurons, the transcoder gives a sparser account. When all but the top features are kept, the transcoder approach beats the neuron approach for below 24. Beyond that point, one feature with a flat direct logit attribution hurts performance, and removing it restores the trend. The transcoder does not recover the full performance of the original MLP, but a handful of features recover most of it.
Limits. The authors say transcoders are approximations and lose information. Their cross-entropy error is about as large as that of SAEs, and they leave a direct comparison of the errors to future work. The circuit method does not model how attention patterns are computed. The case studies are qualitative, a few in number, and the paper says more systematic analysis would make the claims stronger.
Reading guide
Read the paper in this order, and use the lessons listed for each section.
- Abstract and Section 1 (Introduction). Read for the three properties wanted in a circuit method. The needed background is polysemanticity, the tendency of one neuron to respond to many unrelated things, as explained in the superposition paper, and Sparse Autoencoder.
- Section 2 (Transformers preliminaries). Needs Transformer, Residual Stream and Multi-Head Attention.
- Section 3.1 (Architecture and training). Needs Transcoder, Feedforward Neural Network, Rectified Linear Unit (ReLU) and the L1 penalty as used in Sparse Autoencoder. Read the loss carefully: it is the paper's main equation.
- Section 3.2 (Circuit analysis). Needs Attribution Patching for the comparison, and Dot Product for the input-invariant term.
- Section 4 (Comparison with SAEs). Needs Cross-Entropy Loss for faithfulness and the SAE feature paper for the interpretability proxy.
- Section 5 (Case studies). Needs Mechanistic Interpretability and the indirect-object circuit work for the style of circuit analysis.