Abstract
Understanding and mitigating the potential risks associated with foundation models (FMs) hinges on developing effective interpretability methods. Sparse Autoencoders (SAEs) have emerged as a promising tool for disentangling FM representations, but they struggle to capture rare, yet crucial concepts in the data. We introduce Specialized Sparse Autoencoders (SSAEs), designed to illuminate these elusive dark matter features by focusing on specific subdomains. We present a practical recipe for training SSAEs, demonstrating the efficacy of dense retrieval for data selection and the benefits of Tilted Empirical Risk Minimization as a training objective to improve concept recall. Our evaluation of SSAEs on standard metrics, such as downstream perplexity and sparsity, show that they effectively capture subdomain tail concepts, exceeding the capabilities of general-purpose SAEs. We showcase the practical utility of SSAEs in a case study on the Bias in Bios dataset, where SSAEs achieve a 12.5% increase in worst-group classification accuracy over the pretrained general-purpose SAE when applied to remove spurious gender information. SSAEs provide a powerful new lens for peering into the inner workings of FMs in subdomains.
Introduction
Mechanistic interpretability aims to decode the "black box" of Foundation Models (FMs) by identifying human-understandable features within high-dimensional activations. Sparse Autoencoders (SAEs) are currently the gold standard for this task. However, they face a significant "tail" problem. Due to superposition—where models pack many concepts into few neurons—rare concepts may only activate once in a billion tokens. Standard SAEs, which minimize average reconstruction error, often ignore these "dark matter" features in favor of frequent "head" concepts. While scaling to billion-feature SAEs is one solution, it is computationally prohibitive. This work explores whether specialization can more efficiently capture these elusive tail concepts.
Methodology: The SSAE Recipe
We propose a practical framework for training Specialized Sparse Autoencoders (SSAEs) by focusing on specific subdomains rather than universal representation.
Data Selection Strategies
To specialize an SAE for a domain (e.g., Physics), we begin with a small "seed" dataset and retrieve relevant training data from a larger corpus. We evaluated three strategies:
- Sparse Retrieval (BM25): Keyword-based matching.
- Dense Retrieval (Contriever): Semantic embedding matching.
- SAE TracIn: Reranking data based on its influence on the SAE’s loss.
Dense retrieval proved particularly effective at identifying relevant tokens across the frequency spectrum, capturing features that would be invisible in a general-purpose model of the same size.
Tilted Empirical Risk Minimization (TERM)
Standard training (Empirical Risk Minimization, or ERM) minimizes average loss, which naturally favors common patterns. We introduce a "tilt" parameter ($t$) via TERM. At high values of $t$, the objective shifts toward minimizing the maximum loss (minimax), forcing the model to prioritize "hard" examples—the rare tail concepts—improving overall concept recall.
Efficient Specialization via Finetuning
Rather than training from scratch, we finetune a General SAE (GSAE) on specialized data. This approach significantly reduces computational costs, making high-quality interpretability accessible without massive compute clusters. The authors show that indexing a corpus for dense retrieval takes just a few hours and a few dollars, whereas training a wide SAE from scratch can cost thousands.
Experimental Setup
Our approach was evaluated across several domains and models:
- Models: Gemma-2b and Pythia-70M.
- Domains: arXiv Physics (technical specialization), Pile Toxicity (harmful content detection), and Bias in Bios (fairness interventions).
- Corpora: OpenWebText (OWT) and The Pile were used as source pools for data retrieval.
Key Results
Enhanced Tail Capture and Performance
SSAEs trained with dense retrieval captured a significantly higher proportion of "tail" tokens compared to general-purpose models. Furthermore, specialized strategies consistently outperformed the baseline in terms of relative perplexity at various sparsity levels (L0).
Fairness and Interpretability
In a case study using the SHIFT (Spurious Human-interpretable Feature Trimming) framework on the Bias in Bios dataset, SSAEs achieved a 12.5% increase in worst-group classification accuracy by more effectively identifying and removing features associated with spurious gender bias. Automated scoring via Claude 3.5 Sonnet also indicated that TERM-trained SSAEs produced more predictive and interpretable features.
Discussion and Limitations
While SSAEs offer a path beyond brute-force scaling, they are dependent on the quality of the initial seed data. Additionally, TERM training is more computationally intensive than standard ERM due to the need for exponentiating losses, which can introduce numerical instability. Future work will explore applying SSAEs to targeted concept unlearning, potentially allowing for the surgical removal of harmful behaviors without degrading general model performance.
Summary updated