Disentangling Dense Embeddings with Sparse Autoencoders

Charles O'Neill, Christine Ye, Kartheik Iyer, John F. WuarXiv 2024 · DOI

Abstract

Modern text embeddings are powerful but opaque, representing meaning across hundreds of uninterpretable dimensions. This paper explores the application of Sparse Autoencoders (SAEs) to disentangle these representations into a sparse, human-readable basis. By training SAEs on over 420,000 scientific abstracts from arXiv, we demonstrate that these models can extract high-fidelity semantic features. Using a k-sparse approach and an automated interpretability pipeline, we show that these features are not only human-readable but also causal, allowing for precise steering of semantic search results with significantly higher accuracy than traditional query rewriting.

1. Introduction

Modern Natural Language Processing relies heavily on dense embeddings—mathematical vectors that represent the meaning of text. While effective for tasks like semantic search, these embeddings are essentially "black boxes." A single dimension in a 1536-element vector does not correspond to a specific concept; instead, meaning is distributed across the entire vector. This lack of interpretability makes it difficult to explain search results or precisely tweak queries. We address this by applying Sparse Autoencoders (SAEs) to disentangle these dense vectors into a sparse, interpretable basis.

2. Methodology

We employ Sparse Autoencoders to reconstruct input embeddings using a small number of active features from a much larger dictionary.

2.1 Top-k Sparsity

Instead of traditional L1 regularization, we use a "k-sparse" approach, forcing the model to use only the $k$ most important features for any given input. This ensures that the representation remains sparse and interpretable without sacrificing reconstruction quality.

2.2 Auto-interpretability

To label the thousands of learned features, we utilize a two-LLM system. An Interpreter LLM (GPT-4o) generates labels based on text that activates a feature, while a Predictor LLM (GPT-4o-mini) validates these labels by predicting activations on unseen text, providing a quantitative interpretability score.

The SAE architecture and the automated interpretability pipeline used to label and score semantic features.

3. Experimental Setup

The study focused on two specialized domains from arXiv: astrophysics (astro-ph, ~272,000 abstracts) and machine learning (cs.LG, ~153,000 abstracts). Embeddings were generated using OpenAI’s text-embedding-3-small model. These technical fields provide a rigorous testbed for evaluating whether learned features capture genuine, nuanced scientific concepts.

4. Results and Discussion

4.1 Interpretability and Feature Hierarchies

Features in the astrophysics domain showed particularly high interpretability, with median Pearson correlations between predicted and actual activations reaching up to 0.98. We also observed "feature splitting," where broad parent features (e.g., "Optimization") branch into more granular child features (e.g., "Stochastic Gradient Descent") as model capacity increases.

Pearson correlations between ground-truth and predicted activations (left) and a conceptual graph of optimization feature hierarchies (right).

4.2 Search Steerability

A key finding is that these features are "causal." By manually adjusting the activation of specific features in a query's sparse representation, search results can be shifted precisely toward desired topics. SAE-based interventions achieved approximately 20% higher accuracy in steering search results compared to natural language query rewriting.

5. Conclusion

Sparse Autoencoders offer a promising path toward making dense embeddings interpretable. By transforming black-box vectors into a sparse, causal basis, we enable fine-grained control over semantic search and a deeper understanding of how models represent complex concepts. Future work will explore scaling these methods to general-purpose embeddings and larger latent spaces.

Summary updated

BibTeX
@misc{oneill2024disentangling,
  author = {Charles O'Neill and Christine Ye and Kartheik Iyer and John F. Wu},
  title = {{Disentangling Dense Embeddings with Sparse Autoencoders}},
  year = {2024},
  eprint = {2408.00657},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.00657},
}
Figure