Part II, Sparse autoencoders
How latents switch on
Most of the architecture work since 2024 replaces the L1 penalty. Gated, TopK, JumpReLU and BatchTopK change the activation function; p-annealing, end-to-end training and Matryoshka change the objective.
Assumes pieces 6 and 7, and the straight-through estimator.
Write the pre-activation as . Every architecture below is a different rule for turning into a sparse code .
Shrinkage, measured
Piece 6 claimed that the L1 penalty shrinks what it keeps. The figure checks this on trained SAEs. Two SAEs are trained on the toy data of piece 7, one with an L1 penalty and one with TopK. Then we take inputs where exactly one true feature is active and ask how far the reconstruction reaches along that feature’s direction.
At 0.30 the L1 cloud runs parallel to the diagonal but below it, by a roughly constant amount. Every feature that fires is under-reported, and small ones vanish entirely. The shortfall grows with . The TopK cloud sits on the diagonal: the SAE chooses which latents fire by rank, so it never needs to bias their values to keep the code sparse. Now set TopK’s to 2 and look at the last row of the table. In two dimensions any two latents can reconstruct any point, so TopK reconstructs perfectly and stops finding the features. Faithful magnitudes and correct features are separate questions.
Three rules, idealised
To see the trade-offs, idealise. Suppose the dictionary is orthonormal, so is the true code plus noise. Then the L1 objective has a closed-form optimum, the soft threshold : every latent that survives is lowered by . A hard threshold keeps magnitudes intact. TopK keeps the largest entries.
With L1 at 0.40, every blue bar on the second row sits below its tick, by exactly . Lower to remove the bias and spurious latents appear. The penalty cannot both filter noise and leave magnitudes alone. JumpReLU separates the two jobs: the threshold 0.40 filters, and what passes keeps its size. TopK needs no threshold, but is fixed, so it over-fires when fewer than latents are truly active and under-fires when more are.
Four activation functions
Gated separates whether a latent is on from how large it is, and applies the L1 penalty only to the gate. It needs about half as many firing features for comparable reconstruction, in models up to 7B.Rajamanoharan et al., Improving Dictionary Learning with Gated Sparse Autoencoders, 2024.
TopK fixes directly, which is what made clean scaling laws possible. It initialises the encoder to and adds an auxiliary loss to revive dead latents.Gao et al., 2024.
JumpReLU learns a threshold per latent and penalises itself. The step function has no useful gradient, so is trained with straight-through estimators. On Gemma 2 9B it matched or beat Gated and TopK on reconstruction at a given sparsity, and it is the architecture of Gemma Scope.Rajamanoharan et al., Jumping Ahead, 2024.
BatchTopK keeps a fixed average across a batch, so easy tokens can use few latents and hard ones many. At inference it is replaced by a single learned threshold. It beat TopK on GPT-2 Small and Gemma 2 2B and roughly matched JumpReLU.Bussmann, Leask and Nanda, 2024.
Three changes to the objective
p-annealing replaces with and anneals from 1 toward 0 during training, starting convex and moving toward the count we want. It was tested on models trained on chess and Othello.Karvonen et al., 2024.
End-to-end SAEs stop asking for faithful reconstruction and ask for unchanged behaviour:
They need fewer total and fewer active features for the same downstream loss, but the whole model has to be in the training loop, and the dictionary is tied to the layers after it.Braun et al., Apollo Research, 2024. Their motivation: ordinary SAEs may learn “more about the structure of the dataset than the computational structure of the network.”
Matryoshka SAEs require every prefix of the dictionary, from a set of sizes , to reconstruct the input alone:
General features are forced into the early latents, where specific ones cannot absorb them. This reduces feature absorption (piece 12) at a small cost in reconstruction. Matryoshka SAEs are part of Gemma Scope 2.Bussmann, Nabeshima, Karvonen and Nanda, 2025; independently Zaigrajew, Baniecki and Biecek, 2025, for CLIP.
Every comparison in this piece is a comparison on the sparsity–fidelity frontier. Whether that frontier predicts usefulness is the question of piece 11.
In the figure, set the true number of active latents to 12 and leave . What does TopK do? Now set noise to its maximum. Which rule degrades most gracefully, and why?
Show that for an orthonormal dictionary the minimiser of subject to is .
Solution
With orthonormal, , which separates over . Minimise over : the derivative vanishes at , clipped at zero. (In the figure λ is defined so that the shift is λ itself.)