Evaluating and Designing Sparse Autoencoders by Approximating Quasi-Orthogonality

Sewoong Lee, Adam Davies, Marc E. Canby, Julia Hockenmaier

TL;DR

This paper introduces a theoretical framework for understanding and designing Sparse Autoencoders (SAEs) by approximating the relationship between dense input embeddings and sparse feature activations. They propose a novel evaluation metric and an adaptive activation function, top-AFA, that removes the need for manually tuning the sparsity hyperparameter $k$, leading to improved reconstruction performance.

What Problem Does This Paper Address?

Sparse Autoencoders (SAEs) are a powerful tool for understanding the internal workings of large language models (LLMs) by decomposing dense embeddings into interpretable sparse features. However, current SAE training and evaluation methods, particularly those using $k$-sparse autoencoders, lack a strong theoretical foundation for selecting the crucial sparsity hyperparameter $k$. This hyperparameter dictates the number of active features, and its arbitrary selection can lead to suboptimal feature representations and hinder interpretability. The paper aims to bridge this gap by establishing a theoretical link between input embeddings and their sparse feature representations, leading to principled methods for SAE design and evaluation.

Methods

The authors introduce Approximate Feature Activation (AFA), a closed-form theoretical approximation of the $\ell_2$-norm of sparse feature activations. This approximation relates the $\ell_2$-norm of the sparse feature vector to the $\ell_2$-norm of the original dense input embedding, with a provable error bound. This theoretical insight leads to two main contributions:

  1. $\epsilon$-Quasi-Orthogonality and ELBO: They formalize $\epsilon$-quasi-orthogonality as a geometric constraint on the decoder matrix and propose ELBO (Epsilon Lower Bound) as a novel evaluation metric. ELBO directly assesses the alignment between input embeddings and feature activations, offering a more principled evaluation than existing metrics that focus solely on reconstruction or sparsity in isolation.
  2. Top-AFA Activation Function: They propose top-AFA, an adaptive activation function that dynamically determines the number of active features for each input. Instead of a fixed $k$, top-AFA aims to match the $\ell_2$-norm of the sparse feature vector to a theoretically derived target, effectively removing the need for manual $k$ tuning. This is combined with a norm-matching loss function, LAFA.

Datasets

The authors train and evaluate their proposed methods on:

  • GPT-2 Small: Intermediate layers of GPT-2 Small.
  • Gemma Scope 2B: Intermediate layers of Gemma 2B.
  • OpenWebText: Over 80 million tokens from the OpenWebText dataset were used for training.

The paper does not introduce a new benchmark dataset but rather proposes a new evaluation metric (ELBO) that can be applied to existing SAE models and datasets.

Key Insights and Ideas

  • The Missing Link: The core insight is that the relationship between input embeddings and their sparse feature activations has been overlooked. Existing methods treat sparsity as an independent property, ignoring how it should ideally be driven by the input itself.
  • Theoretical Grounding for Sparsity: AFA provides a theoretical basis for understanding the magnitude of sparse activations and their relationship to the input, moving beyond heuristic choices for $k$.
  • ELBO as a Superior Metric: ELBO offers a more informative evaluation of SAE quality by directly assessing the input-feature alignment, revealing different model rankings compared to traditional metrics like Mean Squared Error (MSE).
  • Adaptive Sparsity is Key: The success of top-AFA demonstrates that adaptively determining the number of active features per input, rather than using a fixed $k$, leads to better reconstruction and a more principled approach to sparsity.

Key Results

  • Improved Reconstruction: The proposed top-AFA SAE architecture outperforms state-of-the-art $k$-sparse SAEs (top-k and batch top-k) in terms of reconstruction loss (Normalized MSE) across tested layers of GPT-2. For instance, in Table 1 (Layer 6), Top-AFA achieves NMSE values around $1.76 \times 10^{-4}$ to $3.43 \times 10^{-5}$, while top-k and batch top-k methods often yield higher NMSEs, especially at lower sparsity levels.
  • Better ELBO: Figure 6 shows that top-AFA consistently achieves lower ELBO values compared to top-k and batch top-k, indicating better feature activation alignment with input embeddings.
  • No Fixed $k$ Needed: Top-AFA successfully removes the need to manually tune the $k$ hyperparameter, simplifying the SAE design process.
  • Comparable Training Time: Despite its novel approach, top-AFA's training time is comparable to existing methods, as shown in Table 4.

Limitations and Future Work

  • Linear Representation Hypothesis: The theoretical analysis of AFA is primarily limited to the linear representation hypothesis (LRH). Extending AFA to more general superposition settings (e.g., two-layer neural networks or other complex SAE variants) remains an open question.
  • Simplifying Assumptions: The analysis makes a simplifying assumption by treating the embedding norm as its expectation. Removing this assumption could lead to a more rigorous bound.
  • New Hyperparameter: While top-AFA removes the $k$ hyperparameter, it introduces a new hyperparameter ($\lambda_{AFA}$) for the loss function, which requires tuning. However, the paper notes that a stable coefficient value of 1/16 was observed across layers.
  • High $\ell_0$ Values: The paper notes that top-AFA can result in high $\ell_0$ values in certain settings, which warrants further investigation.
  • Future Work: The authors suggest exploring tighter versions of the JL lemma, investigating more general superposition settings, and further investigating the necessity and tuning of the $\lambda_{AFA}$ coefficient.

Summary updated

BibTeX
@inproceedings{lee2025evaluating,
  author = {Sewoong Lee and Adam Davies and Marc E. Canby and Julia Hockenmaier},
  title = {{Evaluating and Designing Sparse Autoencoders by Approximating Quasi-Orthogonality}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=XhdNFeMclS},
}
Figure