Skip to content

BatchTopK sparse autoencodersBatchTopK Sparse Autoencoders

arXiv· arXiv:2412.06410· Bart Bussmann, Patrick Leask, Neel NandaDepartment of Computer Science, Durham UniversityIndexed by this site · 2026-10-15· Originally publishedAlignment

Quick read

Interpretability

Based on the paper PDF (AI-generated); refer to the original

BatchTopK selects top activations over a batch; the authors state reconstruction on GPT-2 Small and Gemma 2 2B is better than TopK SAE.

Questions
TopK SAE fixes the number of active latents per sample to k. The authors consider this too strict because different activations contain different numbers of analysis units; meanwhile, JumpReLU cannot directly specify average sparsity and requires hyperparameter search to match a target sparsity.
Methods
During training, only the largest n×k activations are kept over a batch of n samples, with the rest zeroed, so the active count per sample can vary while the average is approximately k. At inference, batch dependence is removed: the mean of the minimum positive activations per batch is used as a threshold, and activations below it are zeroed.
Experiments and results
The authors state that at L0=32, BatchTopK has better NMSE and CE degradation than TopK on GPT-2 Small layer 8 and Gemma 2 2B layer 12. On GPT-2 it is also better than JumpReLU at all k; on Gemma, CE degradation is better only at k=16.
Limitations and future work
The conclusion states that human interpretability was not directly evaluated and expects future work to continue approaching the underlying structure of activations. Experiments cover two models' residual streams and TopK, JumpReLU; NMSE/CE values, repetition counts, and the number of batches used to estimate the threshold are not reported.
Experimental setupGPT-2 Small、Gemma 2 2B · OpenWebText · NMSE、CE degradation et al.
Evaluated models
GPT-2 SmallGemma 2 2B
Benchmarks
OpenWebText
Metrics
NMSECE degradationL0
AI summaryThe researchers propose the BatchTopK sparse autoencoder training method, relaxing TopK's fixed top-k constraint to the batch level so that each sample can activate a different number of features. On GPT-2 Small and Gemma 2 2B, BatchTopK consistently outperforms TopK in reconstruction and is comparable to the current state-of-the-art JumpReLU SAE. Its advantage is that the average number of activated features can be specified directly, without needing costly hyperparameter search for approximate tuning. Training and evaluation code has been open-sourced on GitHub.

The researchers propose the BatchTopK sparse autoencoder training method, relaxing TopK's fixed top-k constraint to the batch level so that each sample can activate a different number of features. On GPT-2 Small and Gemma 2 2B, BatchTopK consistently outperforms TopK in reconstruction and is comparable to the current state-of-the-art JumpReLU SAE. Its advantage is that the average number of activated features can be specified directly, without needing costly hyperparameter search for approximate tuning. Training and evaluation code has been open-sourced on GitHub.

Related events and news

0 events · 4 news mentions

News that mentions this paper

Show 1 more news items

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    TopK fixes the number of active latents per sample; BatchTopK instead allocates them per batch to improve reconstruction.

    TopK SAE enforces the same number of active latents for each sample; BatchTopK moves this constraint to the batch level.

    • Context: The paper states that SAEs can decompose language model activations into sparse, interpretable, and often monosemantic directions, but reconstruction and sparsity trade off against each other.
    • Limitation of existing work: TopK keeps only the k largest activations per sample, so the number of active latents is fixed. JumpReLU uses per-latent thresholds; the authors state that sparsity cannot be specified directly, and targeting a desired sparsity requires expensive hyperparameter search.
    • Hypothesis: The authors hypothesize that fixed TopK is too restrictive, because the number of active dictionary units varies across samples.
    • Method: They propose BatchTopK. During training, the number of active latents is allocated per batch, with average sparsity still controlled by k; at inference, a global threshold removes the batch dependence. The authors state that the average number of active latents can be specified directly without sacrificing average sparsity.
  2. What related research exists?

    Related work includes SAE decomposition and architectures such as TopK, JumpReLU, and Gated; this paper relaxes TopK's per-sample k.

    The introduction and Section 2 discuss SAE decomposition and several activation functions, with no separate Related Work section.

    Interpretability directions

    • Dictionary-learning-style SAEs: Bricken et al. (2023), Cunningham et al. (2023), and Templeton et al. (2024) are cited as work finding interpretable directions or features in activation space. The introduction uses these citations as evidence that SAEs can find interpretable directions.

    Reconstruction–sparsity tension

    • ReLU SAE (Bricken et al., 2023): Uses L1 to approximate L0. The paper states that although L1 is differentiable, it suppresses activations and harms reconstruction (citing [6]), and scaling the decoder can make L1 arbitrarily small; [1] constrains decoder directions to unit norm.
    • Gated SAE (Rajamanoharan et al., 2024): Listed with JumpReLU and TopK as architectures proposed to alleviate the above tension.

    TopK and JumpReLU

    • TopK SAE (Gao et al., 2024): Keeps the k largest activations per sample, with no explicit sparsity penalty. The paper states this fixed constraint is too strict. Dead latents use an auxiliary loss; background states k_aux is typically 512 and the coefficient typically 1/32. Makhzani and Frey (2014) is cited as a k-sparse autoencoder.
    • JumpReLU SAE (Rajamanoharan et al., 2024): Zeroes below-threshold values, loss is L2 plus L0, uses a straight-through estimator, no auxiliary loss. The paper notes sparsity cannot be explicitly set, and matching a target sparsity depends on hyperparameter search; it also states that after [7] selects the SAE closest to the target sparsity, the SAEs compared together do not have the same sparsity level.

    Experimental baselines

    • Baselines and data: Baselines are TopK and JumpReLU. Data is OpenWebText. Locations are the residual streams of GPT-2 Small and Gemma 2 2B.

    The authors position BatchTopK as relaxing TopK's per-sample constraint to the batch level and state it can directly specify the average active count, without needing hyperparameter search to approximate a target sparsity as with JumpReLU.

  3. How does the paper address this problem?

    During training, the n×k largest activations are kept over the entire batch; at inference, a global threshold removes the batch dependence.

    The overall approach is BatchTopK: during training, top truncation is done within a batch rather than within each sample, and at inference a global threshold removes batch dependence.

    Activation decomposition

    • An SAE encodes the activation x at a location into a non-negative sparse vector, then linearly decodes it into a reconstruction. In Section 2, n is the activation dimension and m is the dictionary size.
    • Latent i is active if and only if that dimension is greater than 0. The general loss includes reconstruction and sparsity penalties; some architectures add an auxiliary loss.
    • TopK zeroes all activations except the k largest in that sample, thereby no longer using λ times a sparsity penalty.

    Batch-level truncation

    • For a batch of n samples (here n is the number of samples, not the same symbol as the activation dimension n), keep the largest n×k activations across the whole batch, zero the rest, and leave the selected values unchanged.
    • Thus some samples can have more than k active latents and some fewer, with the batch average still approximately k.
    • The training objective is written as Equation (6):

    L(X)=|X−BatchTopK(WencX+benc)Wdec+bdec|22+α Laux

    This is the squared L2 error between the input and the reconstruction obtained by decoding the BatchTopK encoding through the decoder and bias, plus α times the auxiliary loss.

    Inference threshold

    • BatchTopK during training makes samples within the same batch dependent on each other. At inference, it switches to JumpReLU, zeroing activations below a threshold.
    • The threshold is the average of the minimum positive activations per batch, i.e., Equation (7):

    θ=EX[min{zi,j(X)∣ zi,j(X)>0}]

    z_i,j is the j-th latent of the i-th sample in the batch. The paper does not state how many batches were used to estimate θ.

    Auxiliary loss

    • L_aux is the same as TopK's, used to reduce dead latents. The paper writes L_aux as the L2 distance between e and ê, where ê is the reconstruction using only the top-k_aux dead latents; the main text does not define e. Background states k_aux is typically 512 and α typically 1/32.
    • Appendix A.1 does not restate the actual α and k_aux used in this run.

    What is compared

    • The paper compares NMSE, downstream CE degradation, and the number of active latents. The main text does not give formulas for the first two metrics, nor does it set numerical success thresholds.
  4. What experiments did the paper conduct?

    The authors state that BatchTopK outperforms the two baselines on GPT-2; on Gemma, the CE is better than JumpReLU only at k=16.

    Experimental setup

    • Models and locations: GPT-2 Small, residual stream layer 8; Gemma 2 2B, residual stream layer 12.
    • Data and optimization: OpenWebText, sequences up to 128 tokens. Adam, learning rate 3×10^-4, β1=0.9, β2=0.99, batch size 4096, trained to 1×10^9 tokens.
    • Scale: GPT-2 Small dictionary sizes 3072, 6144, 12288, 24576; Gemma 2 2B 16384. k is 16, 32, 64 for both sets of experiments (Appendix A.1).
    • Baselines: TopK and JumpReLU. JumpReLU sparsity coefficients are 0.004, 0.0018, 0.0008 on GPT-2 Small and 0.02, 0.005, 0.001 on Gemma 2 2B; bandwidth is 0.001 for all, used to make sparsity close to the corresponding k. The paper does not state which coefficient corresponds to which k.
    • Metrics: NMSE and CE degradation, plus the number of active latents (also written as L0 in the text). The paper does not report the number of repetitions and does not use a separate evaluation model.

    Main results

    The main text and figure captions do not give specific values for NMSE or CE degradation, so no table is provided. The following follows the authors' statements. The experimental k values are 16, 32, 64.

    • Relative to TopK: Section 4 states that at L0=32, BatchTopK has lower NMSE and lower CE degradation on GPT-2 (Figure 1) and Gemma 2 2B (Figure 2). With the dictionary fixed at 12288, it is also better than TopK at different k. The left caption of Figure 1 is weaker: with active count fixed at 32 and dictionary size varying, BatchTopK is largely better than standard TopK; JumpReLU is omitted on that side because its L0 cannot be fixed.
    • Relative to JumpReLU: Section 4 states that on GPT-2 Small, NMSE and CE are better than JumpReLU at all sparsity levels. The right caption of Figure 1 corresponds to dictionary 12288 with k varying, and both metrics are better than TopK and JumpReLU. On Gemma 2 2B, reconstruction is better at all k, and CE degradation is better only at k=16; the paper calls this setting the lowest sparsity setting. The Figure 2 caption is the same. The introduction states that on large models with high active counts, JumpReLU has lower downstream CE degradation. The authors do not explain this exception.
    • Abstract and experimental scope: The abstract states reconstruction is consistently better than TopK and comparable to what it calls state-of-the-art JumpReLU. The introduction states reconstruction is consistently better than TopK and JumpReLU, while acknowledging the above CE exception. The appendix varies dictionary size only on GPT-2 Small; Gemma's dictionary size is 16384, and the Figure 2 caption does not state the dictionary size.

    Active count distribution

    • Figure 3 shows the distribution of active latent counts per sample on one BatchTopK model. The text states some samples activate only 1 latent and some over 80; the left peak is activation on <BOS> tokens.
    • The authors state that BatchTopK does not activate many latents when information is scarce, whereas TopK uses the same number regardless of input. The authors state this supports the assumption that fixed TopK is too strict and samples contain variable numbers of active units.
    • Neither the caption nor the main text states the model, dictionary size, or k for this figure.

    Other ablations and analyses

    • The paper does not report ablations beyond dictionary size and k; the comparison across k and dictionary size is the main experiment.
    • The conclusion states that only reconstruction loss and sparsity metrics are used, with no direct evaluation of human interpretability.
    • JumpReLU's sparsity coefficients and bandwidth are in Appendix A.1, with no accompanying numerical results table.
  5. What are some points that can be further explored?

    In the conclusion, the authors state that they did not directly evaluate the human interpretability of the latents.

    Limitations and future directions noted by the authors

    • No human interpretability evaluation: The conclusion states that human interpretability was not directly evaluated, and because the architecture is similar to TopK, these latents should remain roughly as interpretable (Section 5).
    • Future directions: The authors expect future work to continue finding improvements to better approach the underlying structure of model activations (Section 5).

    The paper has no separate Limitations or Future Work section. The two points above are the omissions and future expectations stated in the conclusion.

    Experimental coverage

    • Activations come from GPT-2 Small residual stream layer 8 and Gemma 2 2B residual stream layer 12 (Section 4).
    • GPT-2 Small dictionary sizes are 3072, 6144, 12288, 24576, and Gemma 2 2B is 16384; k is 16, 32, 64 (Appendix A.1).
    • Baselines are TopK and JumpReLU; data is OpenWebText, sequences up to 128 tokens, batch size 4096, trained to 1×10^9 tokens (Appendix A.1).
    • Reported metrics are NMSE, CE degradation, and the per-sample active count distribution in Figure 3. The paper does not report specific values for these two errors, nor the number of repetitions.
    • The inference threshold is estimated by Equation (7). The paper does not report the number of batches used for estimation; the appendix also does not state the α and k_aux used in this run.
  6. Summarize the main content of the paper

    BatchTopK trains the SAE with batch-level top activations; the authors state that at equal average sparsity, reconstruction is better than with fixed TopK.

    BatchTopK is a TopK SAE variant for decomposing language model activations.

    • The problem to address: TopK fixes the number of active latents per sample to k. The authors believe different samples have different numbers of analysis units, making this constraint too strict; JumpReLU uses a learnable threshold but cannot directly specify average sparsity.
    • Training keeps the n×k largest activations over the whole batch, allowing the number of active latents per sample to vary while the average remains approximately k, and retains TopK's dead-latent auxiliary loss. At inference, the mean of the minimum positive activations is used as a threshold, and activations below it are zeroed, removing batch dependence.
    • Experiments are trained on OpenWebText, at GPT-2 Small residual stream layer 8 and Gemma 2 2B residual stream layer 12, compared against TopK and JumpReLU, with NMSE and CE degradation as metrics. The main text does not give specific error numbers.
    • The authors state that at L0=32, both metrics are better than TopK (Figure 1, Figure 2). On GPT-2 Small, it also outperforms JumpReLU at all sparsity levels compared. On Gemma 2 2B, reconstruction is better at all k, and CE degradation is better only at k=16; the introduction states that on large models with high active counts, JumpReLU has lower CE degradation.
    • On one BatchTopK model, the number of active latents per sample ranges from 1 to over 80, with the left peak corresponding to <BOS> (Figure 3). The authors state this supports allocating capacity per sample and believe the latents should be roughly as interpretable as TopK's, but no human evaluation was done. The authors expect future work to continue approaching the underlying structure of activations.
Read originalarxiv.org