TL;DR
This paper introduces a unified distributional framework to match and compress Sparse Autoencoder (SAE) features across different layers of Large Language Models (LLMs) by framing the challenge as an Optimal Transport problem. Instead of comparing static feature vectors, the authors represent features as activation-weighted probability distributions and use Wasserstein distance to compute true semantic distances across distinct activation manifolds. This approach enables automated, scalable feature matching and circuit compression, significantly outperforming vector-centric and LLM baselines.
What Problem Does This Paper Address?
Mechanistic interpretability aims to reverse-engineer LLMs into human-understandable components. Sparse Autoencoders (SAEs) are a popular tool for this, decomposing dense hidden states into sparse, interpretable features. However, scaling up SAE analysis faces two major bottlenecks:
- Feature Matching: Tracking how a concept evolves or persists across different layers.
- Circuit Compression: Grouping hundreds of causal feature nodes into high-level "supernodes" to make causal graphs readable.
Existing methods try to compare features using their static decoder vectors. However, because different layers process different data distributions (activation manifolds), direct vector comparison becomes highly inaccurate across non-consecutive layers. Manual grouping by humans works but does not scale. This paper addresses the fundamental need for a mathematically rigorous, automated way to compute "semantic distances" between features residing on different manifolds.
Methods
The authors abandon the standard vector-centric paradigm and turn to Optimal Transport (OT):
- Distributional Representation: Instead of representing an SAE feature as a single decoder vector, they represent it as an activation-weighted empirical distribution over the hidden states where it fires most strongly (using its top-$K$ activation contexts).
- Shared Reference Space Projection: To compare distributions from different layers, they project them into a shared reference space. For feature matching, they align tokens across layers. For circuit compression, they concatenate hidden states across all layers.
- Wasserstein Distance: They compute the semantic distance between these projected distributions using the Wasserstein distance (via the Sinkhorn algorithm), which finds the minimal "cost" to transform one activation profile into another.
The authors provide theoretical proofs showing this method is invariant to activation rescaling, stable under data perturbations, and guaranteed to recover true semantic matches under explicit margin conditions.
Datasets
- Models & SAEs: Open-source JumpReLU SAEs trained on the MLP outputs of Gemma-2-2b and custom TopK SAEs trained on the residual stream of GPT2-small.
- Evaluation Corpus: Prompts sampled from the validation set of The PILE dataset (chunked into 1000 sequences of 128 tokens).
- Custom Benchmark: A "two-number addition" dataset (
p1 + p2 =) used to evaluate the model's ability to distinguish subtle functional meanings.
Key Insights and Ideas
- Features are Behaviors, Not Vectors: A feature's meaning isn't just a static direction in space; it is defined by context—where it activates and how strongly. Moving to a distributional representation preserves this vital context.
- Unified View of Matching and Compression: The authors realize that cross-layer feature matching and circuit compression are actually the same core problem: estimating semantic distances across different activation manifolds.
- Geometry over Raw Magnitudes: By utilizing normalized activation weights, the framework ensures that arbitrary numerical scaling differences between layers do not distort the semantic comparison.
Key Results
- Superior Feature Matching: On both GPT2 and Gemma-2-2b, the proposed method significantly outperformed baselines like SAE Match (L2 distance of decoders) and Feature Flow (cosine similarity) in LLM-judged semantic similarity and accuracy, especially across distant layers (e.g., Layer 0 to Layer 25).
- Automated Circuit Compression: The method compressed complex causal circuits into intuitive supernodes automatically, matching the quality of human-curated manual compressions (like those on Neuropedia) while scaling effortlessly to circuits without existing manual baselines.
- Subtle Meaning Capture: In the digit addition experiment, the method successfully distinguished features with highly specific mathematical roles (e.g., "first number is 5") where standard vector-based and even LLM-selection methods failed by merely matching the general "math" context.
Limitations and Future Work
- Ground Cost Assumptions: The current implementation computes the Wasserstein distance using standard $L_2$ (Euclidean) distance in the shared reference space. This implicitly assumes a flat geometry and might not fully capture the complex, non-linear manifold structure of LLM representations.
- Future Directions: The authors suggest replacing the $L_2$ metric with a more geometry-aware ground cost, potentially leveraging velocity fields derived from flow-matching models to align feature distributions along the continuous dynamics of the latent space.
Summary updated