Abstract
Recent work has found that sparse autoencoders (SAEs) are an effective technique for unsupervised discovery of interpretable features in language models' (LMs) activations, by finding sparse, linear reconstructions of LM activations. We introduce the Gated Sparse Autoencoder (Gated SAE), which achieves a Pareto improvement over training with prevailing methods. In SAEs, the L1 penalty used to encourage sparsity introduces many undesirable biases, such as shrinkage -- systematic underestimation of feature activations. The key insight of Gated SAEs is to separate the functionality of (a) determining which directions to use and (b) estimating the magnitudes of those directions: this enables us to apply the L1 penalty only to the former, limiting the scope of undesirable side effects. Through training SAEs on LMs of up to 7B parameters we find that, in typical hyper-parameter ranges, Gated SAEs solve shrinkage, are similarly interpretable, and require half as many firing features to achieve comparable reconstruction fidelity.
Introduction: The Challenge of Shrinkage
Mechanistic interpretability aims to decompose the complex activations of Large Language Models (LLMs) into interpretable features. Sparse Autoencoders (SAEs) are a leading technique for this, leveraging the superposition hypothesis—the idea that models represent more concepts than they have dimensions by using sparse, non-orthogonal directions.
However, standard SAEs face a fundamental trade-off. To enforce sparsity, they employ an L1 penalty during training. This penalty acts as a "tax" on feature activations, systematically pushing their magnitudes toward zero. This phenomenon, known as shrinkage, results in a systematic underestimation of feature strengths, which degrades reconstruction fidelity. Essentially, the model is forced to choose between being sparse and being accurate.
Methodology: Decoupling Detection and Estimation
The Gated SAE architecture addresses shrinkage by separating the encoder's functionality into two distinct roles:
- Gating (Detection): Determining which features are active.
- Magnitude (Estimation): Estimating how strong those active features are.
By using a gated architecture (inspired by Gated Linear Units), the L1 sparsity penalty is applied only to the gating path. This allows the magnitude path to estimate feature strengths without the biasing pressure of the L1 "tax." Mathematically, this architecture is equivalent to using a Jump ReLU activation function—a discontinuous function that stays at zero until a threshold is met, then "jumps" to a linear activation.
Because the gating function (a Heaviside step) has no gradient, the authors use an auxiliary loss that forces the gating path's pre-activations to be useful for reconstruction, ensuring the "gate" learns to open for the right features.
Results: Pareto Improvements Across Activation Sites
The researchers evaluated Gated SAEs across several models, including Pythia-2.8B and Gemma-7B, testing various activation sites such as MLP outputs, attention layer outputs, and residual stream activations.
Key findings include:
- Pareto Improvement: Gated SAEs consistently outperform baselines, typically requiring half as many active features (L0) to achieve comparable reconstruction fidelity.
- Solving Shrinkage: Quantitative analysis confirms that Gated SAEs produce virtually unbiased reconstructions, effectively eliminating the shrinkage observed in baseline models.
- Interpretability: Blinded human evaluations indicate that features discovered by Gated SAEs are at least as interpretable as those from standard SAEs, ensuring that performance gains do not compromise clarity.
- Compute Trade-off: While Gated SAEs require about 50% more compute per training step due to the auxiliary loss, this is a small price to pay for the massive gain in feature quality and sparsity.
Conclusion
Gated SAEs represent a significant advancement in dictionary learning for mechanistic interpretability. By decoupling feature detection from magnitude estimation, they overcome the inherent biases of L1 regularization. While the training process is more complex, the resulting improvement in feature quality provides a more accurate and efficient lens into the internal representations of LLMs. Future work will explore applying these techniques to even larger models and complex circuit-finding tasks.
Reference: Rajamanoharan, S., Conmy, A., et al. (2024). Improving Dictionary Learning with Gated Sparse Autoencoders. arXiv:2404.16014v2.
Summary updated