TL;DR
The paper trains sparse autoencoders on the internal activations of language models and keeps exactly latents active for each input, using a rule called TopK instead of an L1 penalty. With this change, the reconstruction error follows clean scaling laws in the number of latents and the sparsity, and the authors train a 16 million latent autoencoder on GPT-4 activations. They also propose new metrics that test whether the learned features are useful, not just whether they reconstruct well.
Builds on: Autoencoder, Rectified Linear Unit (ReLU), L1 penalty · Leads to: later work on training and evaluating sparse features in large language models
Why it mattered
The method made large sparse autoencoders practical to train. Before it, training wide and sparse autoencoders often produced many latents that never activated again, and the usual sparsity penalty shrank every useful activation. The paper shows that its TopK version avoids the shrinkage and keeps dead latents rare, with 7% of the latents dead in the 16 million latent model.
The paper also states that it releases training code and autoencoders for open-source models, plus a feature visualizer, so other groups could test the same features. Its evaluation ideas, such as downstream loss and explanation-based scores, ask whether a feature matters for the model's predictions, not only whether the autoencoder fits the activations.
History
Sparse coding over an overcomplete dictionary was introduced by Mallat and Zhang in 1993. Olshausen and Field in 1996 proposed learning that dictionary from data without supervision. Hinton and Salakhutdinov proposed the autoencoder for dimensionality reduction in 2006. Combining them, sparse autoencoders with sparsity priors were developed in the years the paper cites, 2007 to 2014 (Lee et al. 2007, Le et al. 2013, Konda et al. 2014).
Makhzani and Frey introduced the -sparse autoencoder in 2013, which replaces the penalty with a TopK activation. In 2023, Bricken et al. applied sparse autoencoders to the residual streams of language models, and this paper extends that line of work to much larger models and widths.
It caught on because it gave researchers a concrete way to split a model's internal state into many features, and a way to test them. The paper's contribution is the scaling study and the evaluation metrics, which let later work compare methods on something other than reconstruction alone.
The problem
A language model stores many concepts in a fixed number of numbers. The residual stream, which is the running vector that each layer reads from and writes to, holds the information the model uses for its next prediction. Interpretability researchers want to split that vector into features, each one a human-readable concept such as a language, a topic or a quotation pattern.
A sparse autoencoder tries to do this. It takes an activation vector, encodes it into many latents, keeps only a few of them active, and decodes it back. If the model has many concepts, the autoencoder needs many latents. The paper names three difficulties.
First, the reconstruction and sparsity goals pull against each other, so tuning the penalty weight is hard. Second, many latents die: in the authors' ablations, up to 90% of latents stopped activating during training. Third, reconstruction is not the end goal. A small reconstruction error does not prove that the latents are meaningful.
How it works
The authors' method is a chain of stages. We trace a toy version with three latents and two input numbers. This is an illustration of the mechanics, not a trained model.
flowchart LR A["Activation x from the residual stream"] --> B["Encoder: pre-activations W_enc x"] B --> C["TopK: keep the k largest, zero the rest"] C --> D["Decoder: sum of latent times decoder column"] D --> E["Reconstruction x hat and error"]
- Start with an activation. Let , a two-number vector standing in for one residual stream activation. Check: it has entries.
- Encode. Apply the encoder rows , and . The three pre-activations are , and . Check: the third row gives .
- Keep the top . The rule is TopK with : keep the one largest value and set the others to zero. The largest is in latent 3, so . Check: exactly one entry is nonzero, as requires.
- Decode. The decoder columns are for latent 1, for latent 2 and for latent 3. Only latent 3 is active, so . Check: the decoder adds one column scaled by its latent value.
- Measure the error. The error is . The mean squared error over the two entries is . Check: both entries have size 1.
- Read the result. One active latent reconstructs the first entry too large and misses the second entirely. A real autoencoder has thousands of latents, each with its own direction, so it can use more than one active latent. The paper studies how the reconstruction error changes as the number of latents and the value of change.
Worked example: the TopK rule
Apply TopK with to the pre-activations .
- The two largest values are and , at positions 2 and 4.
- Keep them: positions 2 and 4 stay and .
- Set the others to zero: position 1 becomes , position 3 becomes (the value is not kept).
- Result: .
- Check: exactly two entries are nonzero, as requires.
- Interpretation: TopK fixes the number of active latents, so the same applies to every input, however large the other pre-activations are.
The math
Let be an activation, the number of latents, and the number of latents allowed to be active. With encoder weights , decoder weights , and a pre-encoder bias , the TopK autoencoder is
where keeps the largest entries of its input and sets the others to zero. Training minimises the reconstruction error alone.
The paper uses the same symbols. Here is the vector of latent activations, and is the reconstruction. The bias is initialised to the geometric median of the data.
Step 2 in symbols: the encoder and TopK
The toy example used and , so . TopK with keeps only the largest, . The paper's version uses ReLU as well, so that all kept activations are non-negative. The paper notes that the training curves are indistinguishable from TopK alone, because the largest values are almost always positive.
Step 3 in symbols: the decoder
The decoder adds up the decoder columns, weighted by the latent values:
The paper normalises each decoder column to unit length after each step. In the toy example, the columns are unit length, so the decoder is a direct sum.
Step 4 in symbols: the loss
The TopK loss is . The paper compares it with the baseline ReLU autoencoder, whose loss adds an L1 penalty on the latents:
The authors argue that the L1 penalty shrinks all active latents toward zero, while TopK removes the need for the penalty and so avoids the shrinkage. They support this with an experiment: refining the TopK activations with a fixed decoder does not increase them on average, while the same refinement does increase the ReLU activations.
Step 5 in symbols: the scaling law
The paper fits the reconstruction error of GPT-4 autoencoders with a joint law:
with fitted values , , , , and . The paper says is negative, so the law gets steeper as grows. It also says is negative, so the irreducible term decreases with .
Token budget to convergence
The number of training tokens needed to converge grows as approximately for GPT-2 small and for GPT-4. The learning rate that converges scales with . The paper notes that a sublinear token budget would eventually leave each latent with almost no gradient signal, so this trend must break at some scale.
Worked example: the scaling law
Using the fitted values, compute the first term of when and . The paper's , , , , and are used directly. The paper does not state the logarithm base, so this example assumes natural logarithms.
- Write the first term's exponent: .
- Logarithms: , and .
- Terms: ; ; .
- Sum with : , so the first term is .
- Second term: , so .
- Check: the two terms add to . This is my arithmetic on the fitted law for these values of and ; the paper does not report this number.
- Interpretation: the law is a sum of two exponential terms, and the example shows how the fitted exponents combine to give a predicted loss.
Results
The paper's main findings, with its numbers:
- Scaling laws. The reconstruction error follows a joint law in the number of latents and the sparsity . The fitted parameters are given in The math.
- Dead latents. The 16 million latent autoencoder has 7% dead latents. In the authors' ablations, up to 90% of latents were dead.
- Scale. The 16 million latent model was trained on GPT-4 activations for 40 billion tokens, and it is the largest model in the paper.
- Downstream loss. Substituting the 16 million latent autoencoder into GPT-4 gives a loss corresponding to 10% of GPT-4's pretraining compute, and its zero-ablation fidelity is 98.2%.
- Probes. The authors test 61 binary classification datasets with a one-dimensional logistic probe on each latent. The baseline score from using the residual stream channels directly is 0.600 (Figure 32).
- Explanations. On GPT-2 small, the TopK models have N2G explanations with recall more than 1.5 times that of the ReLU models with the same , and precision only slightly lower (more than 0.9 times).
- Sparse effects. Latents have values of 10 to 14% for the effect on logits, compared with 60% for ablating residual stream channels. The trend reverses at .
Limits. The paper says that, because of compute constraints, the 16 million latent model was not trained to the token budget, so it is not part of the consistent series. The authors also report that a large fraction of the random activations of their features, especially in GPT-4, are not yet adequately monosemantic.
Worked example: measuring fidelity and dead latents
A sparse autoencoder with 16 million latents is trained on GPT-4 activations. The authors check how many latents died during training, what fraction of the model's zero-ablation loss its reconstruction recovers, and how much pretraining compute a model with that reconstruction would be worth. Use the paper's reported numbers and reason through what each one says about the autoencoder.
- Dead latents: the paper reports that only 7% of the latents in the 16 million latent autoencoder are dead. So about 93% of the latents still activate in training, which is what the AuxK loss was added to achieve.
- Zero-ablation fidelity: replacing the residual stream with zeros is a poor baseline, because it destroys most of the loss. The 16 million latent model recovers 98.2% of the zero-ablation baseline, which is high but partly a consequence of the poor baseline.
- Compute-equivalent: the paper says that substituting the autoencoder into GPT-4 gives a language modeling loss matching a model trained with 10% of GPT-4's pretraining compute. This is the more natural measure the authors propose, since it is in units of compute.
- Check: the 7% and 98.2% are two different numbers, one for training health and one for fidelity, and neither says that the features are interpretable. Both must be read with the caveats in the Results section.
- Interpretation: the autoencoder is useful for analysis, but the paper argues the features also need the explanation and probe metrics, because a high fidelity alone does not show that the features are meaningful.
Try it: an autoencoder has 1000 latents and 3% of them are dead. How many latents are alive?
Answer: latents are alive.
Common misreadings
It is tempting to think a lower reconstruction error means a better set of features. In fact the paper argues that reconstruction is not the end goal: a small error does not show that the latents are meaningful, which is why it adds probe, explanation and ablation-sparsity metrics.
It is tempting to think a dead latent is harmless because the model still reconstructs well. In fact a dead latent is a wasted part of the dictionary, so the paper adds an AuxK loss that uses the top dead latents (typically 512) to reconstruct the error and so trains them.
It is tempting to think a TopK model is the same as a ReLU model with a small L1 penalty. In fact the paper's refinement experiment shows that an L1 penalty shrinks ReLU activations, while TopK activations are not biased toward shrinkage.
It is tempting to think TopK gives a fixed-quality code at every sparsity. In fact a TopK model trained at one overfits to that value. Its reconstruction gets worse for larger at test time, and the paper's Multi-TopK loss, , is their fix.
When to use it: when you want a fixed number of active latents per input, a simple tuning knob, and no shrinkage from an L1 term.
When not to use it: the paper names its own limits. TopK uses exactly latents for every token, whereas JumpReLU lets the number of active latents vary across tokens. The paper also says a context length of 64 tokens is potentially too few to show the most interesting behaviour. Near with , the learned latents become dense and less interpretable.
Alternatives named in the paper: gated sparse autoencoders, ProLU (also called JumpReLU), and per-latent scale fitting, all of which address the L1 shrinkage in different ways.
Reading guide
- TL;DR and Introduction (Sections 1 and the abstract): read with Autoencoder and superposition in mind, since the goal is to split the residual stream into features.
- Methods, Sections 2.1 to 2.4: the setup needs Rectified Linear Unit (ReLU) for the baseline, L1 penalty for the penalty it removes, and Mean Squared Error for the loss. The dead-latent discussion uses Gradient Descent and Adam Optimizer.
- Scaling laws, Section 3: needs Power Law and Neural Scaling Laws. The joint law is a power law in and inside an exponential.
- Evaluation, Section 4: needs Kullback–Leibler Divergence for downstream KL, Logistic Regression for the probes, and Log-Odds for why logit differences are the measured quantity.
- TopK analysis, Section 5: the shrinkage argument needs the L1 penalty above. The Multi-TopK loss only needs the TopK definition.
- Appendix D (Systems): needs Model Parallelism and Data Parallelism to read the sharding and the all-gather for the TopK forward pass.
Check yourself
QuestionWhat does TopK with do to the pre-activation vector ?Show answer
It keeps the three largest values, which are , and , and sets the other entries to zero. The result is , which has exactly three nonzero entries.
QuestionAn autoencoder has 16 million latents and 7% are dead. How many latents are alive?Show answer
latents are alive.
QuestionWhy does the paper argue that a TopK autoencoder avoids the shrinkage of a ReLU autoencoder with an L1 penalty?Show answer
The L1 penalty pushes every active latent toward zero, which shrinks the activations. TopK removes the penalty and fixes the number of active latents directly, so the kept activations are not pulled toward zero. The paper's refinement experiment shows that refining TopK activations does not increase them on average, while it does for ReLU, which is consistent with this.
QuestionWhy does an excellent reconstruction not settle whether a sparse autoencoder has found good features?Show answer
Reconstruction measures how well the activations are rebuilt, not whether each latent means something. The paper therefore adds feature-quality tests: probe scores on known features, explanation scores, and the sparsity of ablation effects on the logits.