TL;DR
This paper introduces rigorous, quantitative metrics to test the "sparsity hypothesis"—the idea that language model activations are composed of only a few active features at a time. By applying these metrics to both synthetic data and real-world models like BERT and GPT-2, the authors provide empirical evidence that activations are indeed sparse and linear, with the highest levels of sparsity occurring in the models' first and final layers.
What Problem Does This Paper Address?
Modern language models are notoriously difficult to interpret. One major hurdle is polysemanticity: a single neuron often fires for multiple, unrelated concepts (e.g., a neuron might respond to both "legal documents" and "cat photos"). Researchers suspect this happens because models use superposition, cramming more features into a hidden layer than there are neurons by representing them as sparse linear combinations of vectors.
While recent work has used sparse autoencoders to "untangle" these features, evaluating their success has been largely subjective, often relying on whether a human finds the resulting features "interpretable." This paper addresses the lack of objective, quantitative tools to measure how well the underlying assumptions of linearity and sparsity actually hold up in real models.
Methods
The authors propose and evaluate four metrics for measuring sparsity, focusing on those that are scale-invariant (meaning the metric doesn't change just because you multiply all activations by a constant):
- Average Coefficient Norm ($S_p$): The average $L_p$ norm of the feature coefficients, normalized by the maximum coefficient.
- Normalized Loss ($L_{norm}$): The sparse coding loss normalized by the average magnitude of feature coefficients. This metric proved to be the most robust in practice.
- Non-zero entries ($N_0$): A simple count of active features (found to be less robust).
- Final loss value: The raw error of the sparse decomposition (not scale-invariant).
To calculate these, they use a sparse coding algorithm (a variant of iterative optimization) to decompose model activations into a dictionary of potential feature vectors. They first validate these metrics on synthetic data where the "true" sparsity is known before applying them to actual language models.
Datasets
- Synthetic Datasets: Used to verify the metrics. These included "sparse linear" data (generated with a known number of active features) and "non-sparse" control distributions like Gaussian, Rademacher, and Isotropic Cauchy.
- Language Models:
- BERT family: Tiny, Mini, Small, and Medium.
- TinyStories: 1M, 3M, and 33M parameter models.
- GPT series: GPT-2 and GPT-Neo 125M.
- Text Data: Wikipedia abstracts were used to generate activations for the later-layer experiments.
Key Insights and Ideas
- Validation via Synthetic Data: The authors proved that their "Normalized Loss" metric accurately tracks the true number of active features in synthetic data, at least for low sparsity levels (under ~20 features).
- LLMs are Genuinely Sparse: Real model activations are significantly more sparse than random Gaussian distributions, providing strong evidence for the linear representation hypothesis.
- The "U-Shaped" Sparsity Curve: Sparsity is not uniform across a model. It is highest in the embedding (first) layer and the final layers.
- Interpretation: The model starts with sparse input tokens, builds complex, dense combinations of features in the middle layers to process context, and then narrows back down to a sparse set of features to predict the next specific token.
- Disentangling Meaning: The sparse coding approach successfully split polysemantic tokens. For example, the token "season" was decomposed into distinct features representing "TV/Radio shows," "Yearly seasons," and "Lengths of time."
Key Results
The metrics clearly distinguish between sparse linear data and other distributions. As seen in the verification experiments, the proposed metrics closely follow the ground truth for synthetic data.
When applied to real models, the authors found that as the "Hidden Size" (embedding dimension) of a model increases, the number of active features also increases, but at a much slower rate. This suggests that larger models use their extra dimensions to disentangle semantic meanings more effectively rather than just adding more active features per token.
Finally, the layer-wise analysis revealed a consistent trend across different BERT model sizes: a dip in sparsity in the middle layers followed by an increase toward the end.
Limitations and Future Work
- Dictionary Size: The metrics are somewhat sensitive to the size of the feature dictionary used for decomposition. While the authors found their results robust up to a 4x misspecification, choosing the "right" dictionary size remains an open challenge.
- Computational Cost: Calculating these metrics requires running an optimization procedure, which can be expensive for very large models or when using adaptive hyperparameter schemes.
- Future Directions: The authors suggest using these metrics to investigate what factors (like training data or architecture) influence the degree of superposition in a model, potentially leading to more naturally interpretable AI.
Summary updated