Scaling and evaluating sparse autoencoders

## Abstract

Abstract Sparse autoencoders provide a promising unsupervised approach for extracting interpretable features from a language model by reconstructing activations from a sparse bottleneck layer. Since language models learn many concepts, autoencoders need to be very large to recover all relevant features. However, studying the properties of autoencoder scaling is difficult due to the need to balance reconstruction and sparsity objectives and the presence of dead latents. We propose using k-sparse autoencoders (Makhzani and Frey, 2013 ) to directly control sparsity, simplifying tuning and improving the reconstruction-sparsity frontier. Additionally, we find modifications that result in few dead latents, even at the largest scales we tried. Using these techniques, we find clean scaling laws with respect to autoencoder size and sparsity. We also introduce several new metrics for evaluating feature quality based on the recovery of hypothesized features, the explainability of activation patterns, and the sparsity of downstream effects. These metrics all generally improve with autoencoder size. To demonstrate the scalability of our approach, we train a 16 million latent autoencoder on GPT-4 activations for 40 billion tokens. We release code and autoencoders for open-source models , as well as a visualizer . 1 1 1 Our open source code can be found at https://github.com/openai/sparse_autoencoder and our visualizer is hosted at https://openaipublic.blob.core.windows.net/sparse-autoencoder/sae-viewer/index.html

## 1 Introduction

Sparse autoencoders (SAEs) have shown great promise for finding features (Cunningham et al., ; Bricken et al., ; Templeton et al., ; Goh, ) and circuits (Marks et al., ) in language models. Unfortunately, they are difficult to train due to their extreme sparsity, so prior work has primarily focused on training relatively small sparse autoencoders on small language models.

We develop a state-of-the-art methodology to reliably train extremely wide and sparse autoencoders with very few dead latents on the activations of any language model. We systematically study the scaling laws with respect to sparsity, autoencoder size, and language model size. To demonstrate that our methodology can scale reliably, we train a 16 million latent autoencoder on GPT-4 (OpenAI, ) residual stream activations.

Because improving reconstruction and sparsity is not the ultimate objective of sparse autoencoders, we also explore better methods for quantifying autoencoder quality. We study quantities corresponding to: whether certain hypothesized features were recovered, whether downstream effects are sparse, and whether features can be explained with both high precision and recall.

Our contributions:

- 1.
In Section 2, we describe a state-of-the-art recipe for training sparse autoencoders.
- 2.
In Section 3, we demonstrate clean scaling laws and scale to large numbers of latents.
- 3.
In Section 4, we introduce metrics of latent quality and find larger sparse autoencoders are generally better according to these metrics.

We also release [code](https://github.com/openai/sparse_autoencoder), a full suite of GPT-2 small autoencoders,
and [a feature visualizer](https://openaipublic.blob.core.windows.net/sparse-autoencoder/sae-viewer/index.html) for GPT-2 small autoencoders and the 16 million latent GPT-4 autoencoder.

Figure: Figure 1: Scaling laws for TopK autoencoders trained on GPT-4 activations. (Left) Optimal loss for a fixed compute budget. (Right) Joint scaling law of loss at convergence with fixed number of total latents $n$ and fixed sparsity (number of active latents) $k$. Details in Section 3.
Refer to caption: x1.png

## 2 Methods

### 2.1 Setup

Inputs: We train autoencoders on the residual streams of both GPT-2 small (Radford et al., ) and models from
a series of increasing sized models sharing GPT-4 architecture and training setup,
including GPT-4 itself (OpenAI, )(^2^22All presented results either have qualitatively similar results on both GPT-2 small and GPT-4 models, or were only ran on one model class.).
We choose a layer near the end of the network, which should contain many features without being specialized for next-token predictions (see Section F.1 for more discussion). Specifically, we use a layer $\frac{5}{6}$ of the way into the network for GPT-4 series models, and we use layer 8 ($\frac{3}{4}$ of the way) for GPT-2 small.
We use a context length of 64 tokens for all experiments.
We subtract the mean over the $d_{\text{model}}$ dimension and normalize to all inputs to unit norm, prior to passing to the autoencoder (or computing reconstruction errors).

Evaluation: After training, we evaluate autoencoders on sparsity L0, and reconstruction mean-squared error (MSE). We report a normalized version of all MSE numbers, where we divide by a baseline reconstruction error of always predicting the mean activations.

Hyperparameters: To simplify analysis, we do not consider learning rate warmup or decay unless otherwise noted. We sweep learning rates at small scales and extrapolate the trend of optimal learning rates for large scale. See Appendix A for other optimization details.

### 2.2 Baseline: ReLU autoencoders

For an input vector $x\in\mathbb{R}^{d}$ from the residual stream, and $n$ latent dimensions, we use baseline ReLU autoencoders from (Bricken et al., ). The encoder and decoder are defined by:

$$ $\displaystyle z$ $\displaystyle=\text{ReLU}(W_{\text{enc}}(x-b_{\text{pre}})+b_{\text{enc}})$ (1) $\displaystyle\hat{x}$ $\displaystyle=W_{\text{dec}}z+b_{\text{pre}}$ $$

with $W_{\text{enc}}\in\mathbb{R}^{n\times d}$, $b_{\text{enc}}\in\mathbb{R}^{n}$, $W_{\text{dec}}\in\mathbb{R}^{d\times n}$, and $b_{\text{pre}}\in\mathbb{R}^{d}$. The training loss is defined by $\mathcal{L}=||x-\hat{x}||^{2}_{2}+\lambda||z||_{1}$, where $||x-\hat{x}||^{2}_{2}$ is the reconstruction MSE, $||z||_{1}$ is an L1 penalty promoting sparsity in latent activations $z$, and $\lambda$ is a hyperparameter that needs to be tuned.

### 2.3 TopK activation function

We use a $k$-sparse autoencoder (Makhzani and Frey, ), which directly controls the number of active latents by using an activation function (TopK) that only keeps the $k$ largest latents, zeroing the rest. The encoder is thus defined as:

$$ $\displaystyle z$ $\displaystyle=\text{TopK}(W_{\text{enc}}(x-b_{\text{pre}}))$ (2) $$

and the decoder is unchanged. The training loss is simply $\mathcal{L}=||x-\hat{x}||^{2}_{2}$.

Using $k$-sparse autoencoders has a number of benefits:

- •
It removes the need for the L1 penalty. L1 is an imperfect approximation of L0, and it introduces a bias of shrinking all positive activations toward zero
(Section 5.1).
- •
It enables setting the L0 directly, as opposed to tuning an L1 coefficient $\lambda$, enabling simpler model comparison and rapid iteration. It can also be used in combination with arbitrary activation functions.(^3^33In our code, we also apply a ReLU to guarantee activations to be non-negative. However, the training curves are indistinguishable, as the $k$ largest activations are almost always positive for reasonable choices of $k$.)
- •
It empirically outperforms baseline ReLU autoencoders on the sparsity-reconstruction frontier (Figure 2a), and this gap increases with scale (Figure 2b).
- •
It increases monosemanticity of random activating examples by effectively clamping small activations to zero
(Section 4.3).

Figure: (a) At a fixed number of latents ($n=32768$), TopK has a better reconstruction-sparsity trade off than ReLU and ProLU, and is comparable to Gated.
Refer to caption: x3.png

### 2.4 Preventing dead latents

Dead latents pose another significant difficulty in autoencoder training. In larger autoencoders, an increasingly large proportion of latents stop activating entirely at some point in training. For example, Templeton et al. () train a 34 million latent autoencoder with only 12 million alive latents, and in our ablations we find up to 90% dead latents(^6^66We follow Templeton et al. (), and consider a latent dead if it has not activated in 10 million tokens) when no mitigations are applied (Figure 15). This results in substantially worse MSE and makes training computationally wasteful.
We find two important ingredients for preventing dead latents: we initialize the encoder to the transpose of the decoder, and we use an auxiliary loss that models reconstruction error using the top-$k_{\text{aux}}$ dead latents (see Section A.2 for more details). Using these techniques, even in our largest (16 million latent) autoencoder only 7% of latents are dead.

## 3 Scaling laws

Figure: Figure 3: Varying the learning rate jointly with the number of latents. Number of tokens to convergence shown above each point.
Refer to caption: x5.png

### 3.1 Number of latents

Due to the broad capabilities of frontier models such as GPT-4, we hypothesize that faithfully representing model state will require large numbers of sparse features. We consider two primary approaches to choose autoencoder size and token budget:

#### 3.1.1 Training to compute-MSE frontier ( L ⁢ ( C ) 𝐿 𝐶 L(C) italic_L ( italic_C ) )

Firstly, following Lindsey et al. (), we train autoencoders to the optimal MSE given the available compute, disregarding convergence. This method was introduced for pre-training language models (Kaplan et al., ; Hoffmann et al., ). We find that MSE follows a power law $L(C)$ of compute, though the smallest models are off trend
(Figure 1).

However, latents are the important artifact of training (not reconstruction predictions), whereas for language models we typically care only about token predictions. Comparing MSE across different $n$ is thus not a fair comparison — the latents have a looser information bottleneck with larger $n$, so lower MSE is more easily achieved. Thus, this approach is arguably unprincipled for autoencoder training.

#### 3.1.2 Training to convergence ( L ⁢ ( N ) 𝐿 𝑁 L(N) italic_L ( italic_N ) )

We also look at training autoencoders to convergence (within some $\epsilon$). This gives a bound on the best possible reconstruction achievable by our training method if we disregard compute efficiency. In practice, we would ideally train to some intermediate token budget between $L(N)$ and $L(C)$.

We find that the largest learning rate that converges scales with $1/\sqrt{n}$ (Figure 4). We also find that the optimal learning rate for $L(N)$ is about four times smaller than the optimal learning rate for $L(C)$.

We find that the number of tokens to convergence increases as approximately $\Theta(n^{0.6})$ for GPT-2 small and $\Theta(n^{0.65})$ for GPT-4 (Figure 11). This must break at some point – if token budget continues to increase sublinearly, the number of tokens each latent receives gradient signal on would approach zero.(^7^77One slight complication is that in the infinite width limit, TopK autoencoders with our initialization scheme are actually optimal at init using our init scheme (Section A.1), so this allows for an exponent very slightly less than $1$; however, this happens very slowly with $n$ so is unlikely to be a major factor at realistic scales.)

#### 3.1.3 Irreducible loss

Scaling laws sometimes include an irreducible loss term $e$, such that $y=\alpha x^{\beta}+e$ (Henighan et al., ). We find that including an irreducible loss term substantially improves the quality of our fits for both $L(C)$ and $L(N)$.

It was initially not clear to us that there should be a nonzero irreducible loss.
One possibility is that there are other kinds of structures in the activations. In the extreme case, unstructured noise in the activations is substantially harder to model and would have an exponent close to zero (Appendix G). Existence of some unstructured noise would explain a bend in the power law.

#### 3.1.4 Jointly fitting sparsity ( L ⁢ ( N , K ) 𝐿 𝑁 𝐾 L(N,K) italic_L ( italic_N , italic_K ) )

We find that MSE follows a joint scaling law along the number of latents $n$ and the sparsity level $k$ (Figure 1b). Because reconstruction becomes trivial as $k$ approaches $d_{model}$,
this scaling law only holds for the small $k$ regime.
Our joint scaling law fit on GPT-4 autoencoders is:

$$ $\displaystyle L(n,k)=\exp(\alpha+\beta_{k}\log(k)+\beta_{n}\log(n)+\gamma\log( k)\log(n))+\exp(\zeta+\eta\log(k))$ (3) $$

with $\alpha=-0.50$, $\beta_{k}=0.26$, $\beta_{n}=-0.017$, $\gamma=-0.042$, $\zeta=-1.32$, and $\eta=-0.085$.
We can see that $\gamma$ is negative,
which means that the scaling law $L(N)$ gets steeper as $k$ increases. $\eta$ is negative too, which means that the irreducible loss decreases with $k$.

### 3.2 Subject model size L s ⁢ ( N ) subscript 𝐿 𝑠 𝑁 L_{s}(N) italic_L start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT ( italic_N )

Since language models are likely to keep growing in size, we would also like to understand how sparse autoencoders scale as the subject models get larger.
We find that if we hold $k$ constant, larger subject models require larger autoencoders to achieve the same MSE, and the exponent is worse (Figure 4).

Figure: (a) For a fixed number of latents ($n=2^{17}=131072$), the downstream-loss/sparsity trade-off is better for TopK autoencoders than for other activation functions.
Refer to caption: x7.png

## 4 Evaluation

We demonstrated in Section 3 that our larger autoencoders scale well in terms of MSE and sparsity (see also a comparison of activation functions in Section 5.2). However, the end goal of autoencoders is not to improve the sparsity-reconstruction frontier (which degenerates in the limit(^8^88Improving the reconstruction-sparsity frontier is not always strictly better. An infinitely wide maximally sparse ($k=1$) autoencoder can perfectly reconstruct by assigning latents densely in $\mathbb{R}^{d}$, while being completely structure-less and uninteresting.)), but rather to find features useful for applications, such as mechanistic interpretability.
Therefore, we measure autoencoder quality with the following metrics:

- 1.
Downstream loss: How good is the language model loss if the residual stream latent is replaced with the autoencoder reconstruction of that latent? (Section 4.1)
- 2.
Probe loss: Do autoencoders recover features that we believe they might have? (Section 4.2)
- 3.
Explainability: Are there simple explanations that are both necessary and sufficient for the activation of the autoencoder latent? (Section 4.3)
- 4.
Ablation sparsity: Does ablating individual latents have a sparse effect on downstream logits? (Section 4.5)

These metrics provide evidence that autoencoders generally get better when the number of total latents increases.
The impact of the number of active latents L0 is more complicated. Increasing L0 makes explanations based on token patterns worse, but makes probe loss and ablation sparsity better. All of these trends also break when L0 gets close to $d_{\text{model}}$, a regime in which latents also become quite dense (see Section E.5 for detailed discussion).

### 4.1 Downstream loss

An autoencoder with non-zero reconstruction error may not succeed at modeling the features most relevant for behavior (Braun et al., ).
To measure whether we model features relevant to language modeling, we follow prior work (Bills et al., ; Cunningham et al., ; Bricken et al., ; Braun et al., ) and consider downstream Kullback-Leibler (KL) divergence and cross-entropy loss.(^9^99Because a perfect reconstruction would lead to a non-zero cross-entropy loss, we actually consider the difference to the perfect-autoencoder cross-entropy (“delta cross-entropy”).) In both cases, we test an autoencoder by replacing the residual stream by the reconstructed value during the forward pass, and seeing how it affects downstream predictions. We find that $k$-sparse autoencoders improve more on downstream loss than on MSE over prior methods (Figure 5a).
We also find that MSE has a clean power law relationship with both KL divergence, and difference of cross entropy loss (Figure 5b), when keeping sparsity L0 fixed and only varying autoencoder size. Note that while this trend is clean for our trained autoencoders, we can observe instances where it breaks such as when modulating $k$ at test time (see Section 5.3).

One additional issue is that raw loss numbers alone are difficult to interpret—we would like to know how good it is in an absolute sense. Prior work (Bricken et al., ; Rajamanoharan et al., ) use the loss of ablating activations to zero as a baseline and report the fraction of loss recovered from that baseline. However, because ablating the residual stream to zero causes very high downstream loss, this means that even very poorly explaining the behavior can result in high scores.(^10^1010For completeness, the zero-ablation fidelity metric of our 16M autoencoder is 98.2%.)

Instead, we believe a more natural metric is to consider the relative amount of pretraining compute needed to train a language model of comparable downstream loss. For example, when our 16 million latent autoencoder is substituted into GPT-4, we get a language modeling loss corresponding to 10% of the pretraining compute of GPT-4.

Figure: (a) Probe loss
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepnk_2m_probe_grid.png

### 4.2 Recovering known features with 1d probes

If we expect that a specific feature (e.g sentiment, language identification) should be discovered by a high quality autoencoder, then one metric of autoencoder quality is to check whether these features are present.
Based on this intuition, we curated a set of 61 binary classification datasets (details in Table 1). For each task, we train a 1d logistic probe on each latent using the Newton-Raphson method to predict the task, and record the best cross entropy loss (across latents).(^11^1111This is similar to the approach of Gurnee et al. (), but always using $k=1$, and regressing on autoencoder latents instead of neurons.) That is:

$$ $\min_{i,w,b}\mathbb{E}\left[y\log\sigma\left(wz_{i}+b\right)+\left(1-y\right) \log\left(1-\sigma\left(wz_{i}+b\right)\right)\right]$ (4) $$

where $z_{i}$ is the $i$th pre-activation autoencoder latent, and $y$ is a binary label.

Results on GPT-2 small are shown in 6(a). We find that probe score increases and then decreases as $k$ increases. We find that TopK generally achieves better probe scores than ReLU (Figure 23), and both are substantially better
than when using directly residual stream channels. See Figure 32 for results on several GPT-4 autoencoders: we observe that this metric improves throughout training, despite there being no supervised training signal; and we find that it beats a baseline using channels of the residual stream. See Figure 33 for scores broken down by component.

This metric has the advantage that it is computationally cheap. However, it also has a major limitation, which is that it leans on strong assumptions about what kinds of features are natural.

### 4.3 Finding simple explanations for features

Anecdotally, our autoencoders find many features that have quickly recognizable patterns that suggest explanations when viewing random activations (Section E.1). However, this can create an “illusion” of interpretability (Bolukbasi et al., ), where explanations are overly broad, and thus have good recall but poor precision.
For example, Bills et al. () propose an automated interpretability score which disproportionately depends on recall. They find a feature activating at the end of the phrase “don’t stop” or “can’t stop”, but an explanation activating on all instances of “stop” achieves a high interpretability score. As we scale autoencoders and the features get sparser and more specific, this kind of failure becomes more severe.

Figure: Figure 7: Qualitative examples of latents with high and low precision/recall N2G explanations. Key: Green = Ground truth feature activation, Underline = N2G predicted feature activation

Unfortunately, precision is extremely expensive to evaluate when the simulations are using GPT-4 as in Bills et al. (). As an initial exploration, we focus on an improved version of Neuron to Graph (N2G) (Foote et al., ), a substantially less expressive but much cheaper method that outputs explanations in the form of collections of n-grams with wildcards.
In the future, we would like to explore ways to make it more tractable to approximate precision for arbitrary English explanations.

To construct a N2G explanation, we start with some sequences that activate the latent. For each one, we find the shortest suffix that still activates the latent.(^12^1212with at least half the original activation strength) We then check whether any position in the n-gram can be replaced by a padding token, to insert wildcard tokens. We also check whether the explanation should be dependent on absolute position by checking whether inserting a padding token at the beginning matters.
We use a random sample of up to 16 nonzero activations to build the graph, and another 16 as true positives for computing recall.

Results for GPT-2 small are found in 25(a) and 25(b). Note that dense token patterns are trivial to explain, thus $n=2048,k=512$ latents are easy to explain on average since many latents activate extremely densely (see Section E.5)(^13^1313This highlights an issue with our precision/recall metrics, which care only about binarized values. We also propose a more expensive metric which uses simulated values Section 4.4 and addresses this issue.).
In general, autoencoders with more total latents and fewer active latents are easiest to model with N2G.

We also obtain evidence that TopK models have fewer spurious positive activations than their ReLU counterparts. N2G explanations have significantly better recall (>1.5x) and only slightly worse precision (>0.9x) for TopK models with the same $n$ (resulting in better F1 scores) and similar L0 (Figure 24).

### 4.4 Explanation reconstruction

When our goal is for a model’s activations to be interpretable, one question we can ask is: how much performance do we sacrifice if we use only the parts of the model that we can interpret?

Our downstream loss metric measures how much of the performance we’re capturing (but our features could be uninterpretable), and our explanation based metric measures how monosemantic our features are (but they might not explain most of the model). This suggests combining our downstream loss and explanation metrics, by using our explanations to simulate autoencoder latents, and then checking downstream loss after decoding. This metric also has the advantage that it values both recall and precision in a way that is principled, and also values recall more for latents that activate more densely.

We tried this with N2G explanations. N2G produces a simulated value based on the node in the trie, but we scale this value to minimize variance explained. Specifically, we compute $E[sa]/E[s^{2}]$, where $s$ is the simulated value and $a$ is the true value, and we estimate this quantity over a training set of tokens. Results for GPT-2 are shown in Figure 8. We find that we can explain more of GPT-2 small than just explaining bigrams, and that larger and sparser autoencoders result in better downstream loss.

Figure: Figure 8: Downstream loss on GPT-2 with various residual stream ablations at layer 8. N2G explanations of autoencoder latents improves downstream loss with larger $n$ and smaller $k$.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepnk_explain_recons_loss.png

### 4.5 Sparsity of ablation effects

If the underlying computations learned by a language model are sparse,
one hypothesis is that natural features are not only sparse in terms of activations,
but also in terms of downstream effects (Olah et al., ). Anecdotally, we observed that ablation effects often are interpretable (see our visualizer).
Therefore, we developed a metric to measure the sparsity of downstream effects on the output logits.

At a particular token index, we obtain the latents at the residual stream, and proceed to ablate each autoencoder latent one by one, and compare the resulting logits before and after ablation. This process leads to $V$ logit differences per ablation and affected token, where $V$ is the size of the token vocabulary.
Because a constant difference at every logit does not affect the post-softmax probabilities,
we subtract at each token the median logit difference value. Finally, we concatenate these vectors together across some set of $T$ future tokens (at the ablated index or later) to obtain a vector of $V\cdot T$ total numbers.
We then measure the sparsity of this vector via $(\frac{\text{L}_{1}}{\text{L}_{2}})^{2}$,
which corresponds to an “effective number of vocab tokens affected”. We normalize by $V\cdot T$ to have a fraction between 0 and 1, with smaller values corresponding to sparser effects.

We perform this for various autoencoders trained on the post-MLP residual stream at layer 8 in GPT-2 small, with $T=16$. Results are shown in 6(b). Promisingly, models trained with larger $k$ have latents with sparser effects. However, the trend reverses at $k=512$, indicating that as $k$ approaches $d_{\text{model}}=768$, the autoencoder learns latents with less interpretable effects.
Note that latents are sparse in an absolute sense, having a $(\frac{\text{L}_{1}}{\text{L}_{2}})^{2}$ of 10-14%
, whereas ablating residual stream channels gives 60%
(slightly better than the theoretical value of $\sim\frac{2}{\pi}$ for random vectors).

## 5 Understanding the TopK activation function

### 5.1 TopK prevents activation shrinkage

A major drawback of the L1 penalty is that it tends to shrink all activations toward zero (Tibshirani, ).
Our proposed TopK activation function prevents activation shrinkage, as it entirely removes the need for an L1 penalty.
To empirically measure the magnitude of activation shrinkage, we consider whether different (and potentially larger) activations would result in better reconstruction given a fixed decoder. We first run the encoder to obtain a set of activated latents, save the sparsity mask, and then optimize only the nonzero values to minimize MSE.(^14^1414unlike the “inference-time optimization” procedure in Nanda et al. ()) This refinement method has been proposed multiple times such as in $k$-SVD (Aharon et al., ), the relaxed Lasso (Meinshausen, ), or ITI (Maleki, ). We solve for the optimal activations with a positivity constraint using projected gradient descent.

This refinement procedure tends to increase activations in ReLU models on average, but not in TopK models (Figure 9a), which indicates that TopK is not impacted by activation shrinkage. The magnitude of the refinement is also smaller for TopK models than for ReLU models. In both ReLU and TopK models, the refinement procedure noticeably improves the reconstruction MSE (Figure 9b), and the downstream next-token-prediction cross-entropy (Figure 9c). However, this refinement only closes part of the gap between ReLU and TopK models.

Figure: Figure 9: Latent activations can be refined to improve reconstruction from a frozen set of latents. For ReLU autoencoders, the refinement is biased toward positive values, consistent with compensating for the shrinkage caused by the L1 penalty. For TopK autoencoders, the refinement is not biased, and also smaller in magnitude. The refinement only closes part of the gap between ReLU and TopK.
Refer to caption: x9.png

### 5.2 Comparison with other activation functions

Other recent works on sparse autoencoders have proposed different ways to address the L1 activation shrinkage, and Pareto improve the L0-MSE frontier (Wright and Sharkey, ; Taggart, ; Rajamanoharan et al., ).
Wright and Sharkey () propose to fine-tune a scaling parameter per latent, to correct for the L1 activation shrinkage.
In Gated sparse autoencoders (Rajamanoharan et al., ), the selection of which latents are active is separate from the estimation of the activation magnitudes. This separation allows autoencoders to better estimate the activation magnitude, and avoid the L1 activation shrinkage.
Another approach is to replace the ReLU activation function with a ProLU (Taggart, ) (also known as TRec (Konda et al., ), or JumpReLU (Erichson et al., )), which sets all values below a positive threshold to zero $J_{\theta}(x)=x\cdot\mathbf{1}_{(x>\theta)}$. Because the parameter $\theta$ is non-differentiable, it requires a approximate gradient such as a ReLU equivalent (ProLU-ReLU) or a straight-through estimator (ProLU-STE) (Taggart, ).

We compared these different approaches in terms of reconstruction MSE, number of active latents L0, and downstream cross-entropy loss (Figure 2 and 5). We find that they significantly improve the reconstruction-sparsity Pareto frontier, with TopK having the best performance overall.

### 5.3 Progressive recovery

Figure: Figure 10: Sparsity levels can be changed at test time by replacing the activation function with either TopK($k$) or JumpReLU($\theta$), for a given value $k$ or $\theta$. TopK tends to overfit to the value of $k$ used during training, but using Multi-TopK improves generalization to larger $k$.
Refer to caption: x12.png

In a progressive code, a partial transmission still allows reconstructing the signal with reasonable fidelity (Skodras et al., ). For autoencoders, learning a progressive code means that ordering latents by activation magnitude gives a way to progressively recover the original vector. To study this property, we replace the autoencoder activation function (after training) by a TopK($k^{\prime}$) activation function where $k^{\prime}$ is different than during training. We then evaluate each value of $k^{\prime}$ by placing it in the L0-MSE plane (Figure 10).

We find that training with TopK only gives a progressive code up to the value of $k$ used during training. MSE keeps improving for values slightly over $k$ (a result also described in (Makhzani and Frey, )), then gets substantially worse as $k^{\prime}$ increases (note that the effect on downstream loss is more muted). This can be interpreted as some sort of overfitting to the value $k$.

#### 5.3.1 Multi-TopK

To mitigate this issue, we sum multiple TopK losses with different values of $k$ (Multi-TopK). For example, using $\mathcal{L}(k)+\mathcal{L}(4k)/8$ is enough to obtain a progressive code over all $k^{\prime}$
(note however that training with Multi-TopK does slightly worse than TopK at $k$).
Training with the baseline ReLU only gives a progressive code up to a value that corresponds to using all positive latents.

#### 5.3.2 Fixed sparsity versus fixed threshold

At test time, the activation function can also be replaced by a JumpReLU activation, which activates above a fixed threshold $\theta$, $J_{\theta}(x)=x\cdot\mathbf{1}_{(x>\theta)}$. In contrast to TopK, JumpReLU leads to a selection of active latents where the number of active latents can vary across tokens.
Results for replacing the activation function at test-time with a JumpReLU are shown in dashed lines in Figure 10.

For autoencoders trained with TopK, the test-time TopK and JumpReLU curves are superimposed only for values corresponding to an L0 below the training L0, otherwise the JumpReLU activation is worse than the TopK activation. This discrepancy disappears with Multi-TopK, where both curves are nearly superimposed, which means that the model can be used with either a fixed or a dynamic number of latents per token without loss in reconstruction.
The two curves are also superimposed for autoencoders trained with ReLU.
Interestingly, it is sometimes more efficient to train a ReLU model with a low L1 penalty and to use a TopK or JumpReLU at test time, than to use a higher L1 penalty that would give a similar sparsity level (a result independently described in Nanda et al. ()).

## 6 Limitations and Future Directions

We believe many improvements can be made to our autoencoders.

- •
TopK forces every token to use exactly $k$ latents, which is likely suboptimal. Ideally we would constrain $\mathbb{E}[L_{0}]$ rather than $L_{0}$.
- •
The optimization can likely be greatly improved, for example with learning rate scheduling,(^15^1515Anecdotally, we also found that lowering learning rates helped with decreasing dead latents.) better optimizers, and better aux losses for preventing dead latents.
- •
Much more could be done to understand what metrics best track relevance to downstream applications, and to study those applications themselves. Applications include: finding vectors for steering behavior, doing anomaly detection, identifying circuits, and more.
- •
We’re excited about work in the direction of combining MoE (Shazeer et al., ) and autoencoders, which would substantially improve the asymptotic cost of autoencoder training, and enable much larger autoencoders.
- •
A large fraction of the random activations of features we find, especially in GPT-4, are not yet adequately monosemantic. We believe that with improved techniques and greater scale(^16^1616both in number of latents and in training tokens) this is potentially surmountable.
- •
Our probe based metric is quite noisy, which could be improved by having a greater breadth of tasks and higher quality tasks.
- •
While we use n2g for its computational efficiency, it is only able to capture very simple patterns. We believe there is a lot of room for improvement in terms of more expressive explanation methods that are also cheap enough to simulate to estimate explanation precision.
- •
A context length of 64 tokens is potentially too few tokens to exhibit the most interesting behaviors of GPT-4.

## 7 Related work

Sparse coding on an over-complete dictionary was introduced by Mallat and Zhang ().
Olshausen and Field () refined the idea by proposing to learn the dictionary from the data, without supervision. This approach has been particularly influential in image processing, as seen for example in (Mairal et al., ).
Later, Hinton and Salakhutdinov () proposed the autoencoder architecture to perform dimensionality reduction.
Combining these concepts, sparse autoencoders were developed (Lee et al., ; Le et al., ; Konda et al., ) to train autoencoders with sparsity priors, such as the L1 penalty, to extract sparse features.
Makhzani and Frey () refined this concept by introducing $k$-sparse autoencoders, which use a TopK activation function instead of the L1 penalty. Makelov et al. () evaluates autoencoders using a metric that measures recovery of features from previously discovered circuits.

More recently, sparse autoencoders were applied to language models (Yun et al., ; Lee Sharkey, ; Bricken et al., ; Cunningham et al., ),
and multiple sparse autoencoders were trained on small open-source language models (Marks, ; Bloom, ; Mossing et al., ).
Marks et al. () showed that the resulting features from sparse autoencoders can find sparse circuits in language models.
Wright and Sharkey () pointed out that sparse autoencoders are subject to activation shrinking from L1 penalties, a property of L1 penalties first described in Tibshirani ().
Taggart () and Rajamanoharan et al. () proposed to use different activation functions to address activation shrinkage in sparse autoencoders. Braun et al. () proposed to train sparse autoencoders on downstream KL instead of reconstruction MSE.

Kaplan et al. () studied scaling laws for language models which examine how loss varies with various hyperparameters. Clark et al. () explore scaling laws related to sparsity using a bilinear fit.
Lindsey et al. () studied scaling laws specifically for autoencoders, defining the loss as a specific balance of reconstruction and sparsity (rather than simply reconstruction, while holding sparsity fixed).

## Acknowledgments and Disclosure of Funding

We are deeply grateful to Jan Leike and Ilya Sutskever for leading the Superalignment team and creating the research environment which made this work possible. We thank David Farhi for supporting our work after their departure.

We thank Cathy Yeh for explorations in finding features. We thank Carroll Wainwright for initial insights into clustering latents.

We thank Steven Bills, Dan Mossing, Cathy Yeh, William Saunders, Boaz Barak, Jakub Pachocki, and Jan Leike for many discussions about autoencoders and their applications.
We thank Manas Joglekar for some improvements on an earlier version of our activation loading. We thank William Saunders for an early autoencoder visualization implementation.

We thank Trenton Bricken, Dan Mossing, and Neil Chowdhury for feedback on an earlier version of this manuscript.

We thank Trenton Bricken, Lawrence Chan, Hoagy Cunningham, Adam Goucher, Ryan Greenblatt, Tristan Hume, Jan Hendrik Kirchner, Jake Mendel, Neel Nanda, Noa Nabeshima, Chris Olah, Logan Riggs, Fabien Roger, Buck Shlegeris, John Schulman, Lee Sharkey, Glen Taggart, Adly Templeton, Vikrant Varma for valuable discussions.

## Appendix A Optimization

Figure: Figure 11: Token budget, MSE, and learning rate power laws, averaged across values of $k$. First row is GPT-2, second row is GPT-4. Note that individual fits are noisy (especially for GPT-4) since learning rate sweeps are coarse, and token budget depends on learning rate.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_LofN.png

### A.1 Initialization

We initialize our autoencoders as follows:

- •
We initialize the bias $b_{pre}$ to be the geometric median of a sample set of data points, following Bricken et al. [].
- •
We initialize the encoder directions parallel to the respective decoder directions, so that the corresponding latent read/write directions are the same(^17^1717This is done only at initialization; we do not tie the parameters as in Cunningham et al. []. This strategy is also presented in concurrent work [Conerly et al., ].) Directions are chosen uniformly randomly.
- •
We scale decoder latent directions to be unit norm at initialization (and also after each training step), following Bricken et al. [].
- •
For baseline models we use torch default initialization for encoder magnitudes. For TopK models, we initialized the magnitude of the encoder such that the magnitude of reconstructed vectors match that of the inputs. However, in our ablations we find this has no effect or a weak negative effect (Figure 16).(^18^1818Note that the scaling factor has nontrivial interaction with $n$, and scales between $\Theta(1/\sqrt{k})$ and $\Theta(1/k)$. This scheme has the advantage that is optimal at init in the infinite width limit. We did not try simpler schemes like scaling by $\Theta(1/\sqrt{k})$.)

### A.2 Auxiliary loss

We define an auxiliary loss (AuxK) similar to “ghost grads” [Jermyn and Templeton, ] that models the reconstruction error using the top-$k_{\text{aux}}$ dead latents (typically $k_{\text{aux}}=512$). Latents are flagged as dead during training if they have not activated for some predetermined number of tokens (typically 10 million). Then, given the reconstruction error of the main model $e=x-\hat{x}$, we define the auxiliary loss $\mathcal{L}_{\text{aux}}=||e-\hat{e}||^{2}_{2}$, where $\hat{e}=W_{\text{dec}}z$ is the reconstruction using the top-$k_{\text{aux}}$ dead latents.
The full loss is then defined as $\mathcal{L}+\alpha\mathcal{L}_{\text{aux}}$, where $\alpha$ is a small coefficient (typically $1/32$).
Because the encoder forward pass can be shared (and dominates decoder cost and encoder backwards cost, see Appendix D), adding this auxiliary loss only increases the computational cost by about 10%.

We found that the AuxK loss very occasionally NaNs at large scale, and zero it when it is NaN to prevent training run collapse.

### A.3 Optimizer

We use the Adam optimizer [Kingma and Ba, ] with $\beta_{1}=0.9$ and $\beta_{2}=0.999$, and a constant learning rate. We tried several learning rate decay schedules but did not find consistent improvements in token budget to convergence. We also did not find major benefits from tuning $\beta_{1}$ and $\beta_{2}$.

We project away gradient information parallel to the decoder vectors, to account for interaction between Adam and decoder normalization, as described in Bricken et al. [].

#### A.3.1 Adam epsilon

By convention, we average the gradient across the batch dimension. As a result, the root mean square (RMS) of the gradient can often be very small, causing Adam to no longer be loss scale invariant.We find that by setting epsilon sufficiently small, these issues are prevented, and that $\varepsilon$ is otherwise not very sensitive and does not result in significant benefit to tune further. We use $\varepsilon=6.25\times 10^{-10}$ in many experiments in this paper, though we reduced it further for some of the largest runs to be safe.

#### A.3.2 Gradient clipping

When scaling the GPT-4 autoencoders, we found that gradient clipping was necessary to prevent instability and divergence at higher learning rates. We found that gradient clipping substantially affected $L(C)$ but not $L(N)$. We did not use gradient clipping for the GPT-2 small runs.

### A.4 Batch size

Larger batch sizes are critical for allowing much greater parallelism. Prior work tends to use batch sizes like 2048 or 4096 tokens [Bricken et al., , Conerly et al., , Rajamanoharan et al., ]. To gain the benefits of parallelism, we use a batch size of 131,072 tokens for most of our experiments.

While batch size affects $L(C)$ substantially, we find that the $L(N)$ loss does not depend strongly on batch size when optimization hyperparameters are set appropriately (Figure 12).

Figure: Figure 12: With correct hyperparameter settings, different batch sizes converge to the same $L(N)$ loss (gpt2small).
Refer to caption: extracted/5646653/figures/fig_gpt2sm_bs.png

### A.5 Weight averaging

We find that keeping an exponential moving average (EMA) Ruppert [] of the weights slightly reduces sensitivity to learning rate by allowing slightly higher learning rates to be tolerated. Due to its low cost, we use EMA in all experiments. We use an EMA coefficient of 0.999, and did not find a substantial benefit to tuning it.

We use a bias-correction similar to that used in Kingma and Ba []. Despite this, the early steps of EMA are still generally worse than the original model. Thus for the $L(C)$ experiments, we take the min of the EMA model’s and non-averaged model’s validation losses.

### A.6 Other details

- •
For the main MSE loss, we compute an MSE normalization constant once at the beginning of training, and do not do any loss normalization per batch.
- •
For the AuxK MSE loss, we compute the normalization per token, because the scale of the error changes throughout training.
- •
In theory, the $b_{\text{pre}}$ lr should be scaled linearly with the norm of the data to make the autoencoder completely invariant to input scale. In practice, we find it to tolerate an extremely wide range of values with little impact on quality.
- •
Anecdotally, we noticed that when decaying the learning rate of an autoencoder previously training at the L(C) loss, the number of dead latents would decrease.

## Appendix B Other training details

Unless otherwise noted, autoencoders were trained on the residual activation directly after the layernorm (with layernorm weights folded into the attention weights), since this corresponds to how residual stream activations are used. This also causes importance of input vectors to be uniform, rather than weighted by norm(^19^1919We believe one of the main impacts of normalizing is that it the first token positions are downweighted in importance (see Section F.2 for more discussion).).

### B.1 TopK training details

We select $k_{\text{aux}}$ as a power of two close to $\frac{d_{model}}{2}$ (e.g. 512 for GPT-2 small). We typically select $\alpha=1/32$. We find that the training is generally not extremely sensitive to the choice of these hyperparameters.

We find empirically that using AuxK eliminates almost all dead latents by the end of training.

Unfortunately, because of compute constraints, we were unable to train our 16M latent autoencoder to $L(N)$, which made it not possible to include the 16M as part of a consistent $L(N)$ series.

### B.2 Baseline hyperparameters

Baseline ReLU autoencoders were trained on GPT-2 small, layer 8.
We sweep learning rate in [5e-5, 1e-4, 2e-4, 4e-4], L1 coefficient in [1.7e-3, 3.1e-3, 5e-3, 1e-2, 1.7e-2] and train for 8 epochs of 6.4 billion tokens at a batch size of 131072. We try different resampling periods in [12.5k, 25k] steps, and choose to resample 4 times throughout training. We consider a feature dead if it does not activate for 10 million tokens.

For Gated SAE [Rajamanoharan et al., ], we sweep L1 coefficient in [1e-3, 2.5e-3, 5e-3, 1e-2, 2e-2], learning rate in [2.5e-5, 5e-5, 1e-4], train for 6 epochs of 6.4 billion tokens at a batch size of 131072. We resample 4 times throughout training.

For ProLU autoencoders [Taggart, ], we sweep L1 coefficient in [5e-4, 1e-3, 2.5e-3, 5e-3, 1e-2, 2e-2], learning rate in [2.5e-5, 5e-5, 1e-4], train for 6 epochs of 6.4 billion tokens at a batch size of 131072. We resample 4 times throughout training. For the ProLU gradient, we try both ProLU-STE and ProLU-ReLU. Note that, consistent with the original work, ProLU-STE autoencoders all have $L_{0}<25$, even for small L1 coefficients.

We used similar settings and sweeps for autoencoders trained on GPT-4.
Differences include: replacing the resampling of dead latents with a L1 coefficient warm-up over 5% of training [Conerly et al., ]; removing the decoder unit-norm constraint and adding the decoder norm in the L1 penalty [Conerly et al., ].

Our baselines generally have few dead latents, similar or less than our TopK models (see Figure 14).

Figure: Figure 13: For a fixed sparsity level ($L_{0}=128$), a given MSE leads to a lower downstream-loss for TopK than for other activations functions. (GPT-4). We are less confident about these runs than the corresponding ones for GPT-2, yet the results are consistent (see Figure 5).
Refer to caption: x16.png

Figure: (a) Dead latent ratios for GPT-2
Refer to caption: extracted/5646653/placeholders/dead_ratio_gpt2.png

## Appendix C Training ablations

### C.1 Dead latent prevention

Figure: Figure 15: Methods that reduce the number of dead latents (gpt2sm 2M, k=32). With AuxK and/or tied initialization, number of dead latents generally decreases over the course of training, after an early spike.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_2M_dead_maxk_init.png

We find that the reduction in dead latents is mostly due to a combination of the AuxK loss and the tied initialization scheme.

### C.2 Initialization

Figure: Figure 16: Initialization ablation (gpt2sm 128k, k=32).
Refer to caption: extracted/5646653/figures/fig_gpt2sm_ablation_init.png

We find that tied initialization substantially improves MSE, and that our encoder initialization scheme has no effect when tied initialization is being used, and hurts slightly on its own.

### C.3 b enc subscript 𝑏 enc b_{\textrm{enc}} italic_b start_POSTSUBSCRIPT enc end_POSTSUBSCRIPT

Figure: Figure 17: $b_{\textrm{enc}}$ does not strongly affect loss (gpt2sm 128k, k=32).
Refer to caption: extracted/5646653/figures/fig_gpt2sm_ablation_lbias.png

We find that $b_{\textrm{enc}}$ does not affect the MSE at convergence. With $b_{\textrm{enc}}$ removed, the autencoder is equivalent to a JumpReLU where the threshold is dynamically chosen per example such that exactly $k$ latents are active. However, convergence is slightly slower without $b_{\textrm{enc}}$. We believe this may be confounded by encoder learning rate but did not investigate this further.

### C.4 Decoder normalization

After each step we renormalize columns of the decoder to be unit-norm, following Bricken et al. []. This normalization (or a modified L1 term, as in Conerly et al. []) is necessary for L1 autoencoders, because otherwise the L1 loss can be gamed by making the latents arbitrarily small. For TopK autoencoders, the normalization is optional. However, we find that it still improves MSE, so we still use it in all of our experiments.

Figure: Figure 18: The decoder normalization slightly improves loss (gpt2sm 128k, k=32).
Refer to caption: extracted/5646653/figures/fig_gpt2sm_ablation_decodernorm.png

## Appendix D Systems

Scaling autoencoders to the largest scales in this paper would not be feasible without our systems improvements. Model parallelism is necessary once parameters cannot fit on one GPU. A naive implementation can be an order of magnitude slower than our optimized implementation at the very largest scales.

### D.1 Parallelism

We use standard data parallel and tensor sharding [Shoeybi et al., ], with an additional allgather for the TopK forward pass to determine which $k$ latents should are in the global top k. To minimize the cost of this allgather, we truncate to a capacity factor of 2 per shard—further improvements are possible but would require modifications to NCCL. For the largest (16 million) latent autoencoder, we use 512-way sharding. Large batch sizes (Section A.4) are very important for reducing the parallelization overhead.

The very small number of layers creates a challenge for parallelism - it makes pipeline parallelism [Huang et al., ]
and FSDP [Zhao et al., ] inapplicable. Additionally, opportunities for communications overlap are limited because of the small number of layers, though we do overlap host to device transfers and encoder data parallel comms for a small improvement.

### D.2 Kernels

We can take advantage of the extreme sparsity of latents to perform most operations using substantially less compute and memory than naively doing dense matrix multiplication. This was important when scaling to large numbers of latents, both via directly increasing throughput and reducing memory usage.

We use two main kernels:

- •
DenseSparseMatmul: a multiplication between a dense and sparse matrix
- •
MatmulAtSparseIndices: a multiplication of two dense matrices evaluated at a set of sparse indices

Then, we have the following optimizations:

- 1.
The decoder forward pass uses DenseSparseMatmul
- 2.
The decoder gradient uses DenseSparseMatmul
- 3.
The latent gradient uses MatmulAtSparseIndices
- 4.
The encoder gradient uses DenseSparseMatmul
- 5.
The pre-bias gradient uses a trick of summing pre-activation gradient across the batch dimension before multiplying with the encoder weights.

Theoretically, this gives a compute efficiency improvement of up to 6x in the limit of sparsity, since the encoder forward pass is the only remaining dense operation. In practice, we indeed find the encoder forward pass is much of the compute, and the pre-activations are much of the memory.

To ensure that reads are coalesced, the decoder weight matrix must also be stored transposed from the typical layout. We also use many other kernels for fusing various operations for reducing memory and memory bandwidth usage.

## Appendix E Qualitative results

### E.1 Subjective latent quality

Throughout the project, we stumbled upon many subjectively interesting latents. The majority of latents in our GPT-2 small autoencoders seemed interpretable, even on random positive activations. Furthermore, the ablations typically had predictable effects based on the activation conditions. For example, some features that are potentially part of interesting circuits in GPT-2:

- •
An unexpected token breaking a repetition pattern (A B C D … A B X!). This upvotes future pattern breaks (A B Y!), but also upvotes continuation of the pattern right after the break token (A B X $\rightarrow$ D).
- •
Text within quotes, especially activating when within two nested sets of quotes. Upvotes tokens that close the quotes like " or ’, as well as tokens which close multiple sets of quotes at once, such as "’ and ’".
- •
Copying/induction of capitalized phrases (A B … A $\rightarrow$ B)

In GPT-4, we tended to find more complex features, including ones that activate on the same concept in multiple languages, or on complex technical concepts such as algebraic rings.

You can explore for yourself at [our viewer](https://openaipublic.blob.core.windows.net/sparse-autoencoder/sae-viewer/index.html).

### E.2 Finding features

Typical features are not of particular interest, but having an autoencoder also lets one easily find relevant features. Specifically, one can use gradient-based attribution to quickly compute how relevant latents are to behaviors of interest [Baehrens et al., , Simonyan et al., ].

Following the methodologies of Templeton et al. [] and Mossing et al. [], we found features by using a hand-written prompt, with a set of "positive" and "negative" token predictions, and back-propagating from logit differences to latent values. We then consider latents sorted by activation times gradient value, and inspect the latents.

We tried this methodology with a $n=2^{17}=131072$, $k=32$ GPT-2 autoencoder and were able to quickly find a number of safety relevant latents, such as ones corresponding to profanity or child sexual content. Clamping these latents appeared to have causal effect on the samples. For example, clamping the profanity latent to negative values results in significantly less profanity (some profanity can still be observed in situations where it copies from the prompt).

### E.3 Latent activation distributions

We anecdotally found that latent activation distributions often have multiple modes, especially in early layers.

### E.4 Latent density and importance curves

Figure: Figure 19: Distributions of latent densities, and average squared activation. Note that we do not observe multiple density modes, as observed in [Bricken et al., ]. Counts are sampled over 1.5e7 total tokens. Note that because latents that activate every 1e7 tokens are considered dead during training (and thus receive AuxK gradient updates), 1e-7 is in some sense the minimum density, though the AuxK loss term coefficient may allow it to be lower.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepn_2m_hist_feature_density.png

We find that log of latent density is approximately Gaussian (Figure 19). If we define the importance of a feature to be the expected squared activation (an approximation of its marginal impact on MSE), then log importance looks a bit more like a Laplace distribution. Modal density and modal feature importance both decrease with number of total latents (for a fixed $k$), as expected.

### E.5 Solutions with dense latents

One option for a sparse autoencoder is to simply learn the $k$ directions that explain the most variance. As $k$ approaches $d_{model}$, this “principal component”-like solution may become competitive with solutions where each latent is used sparsely. In order to check for such solutions, we can simply measure the average density of the $d_{model}$ densest latents. Using this metric, we find that for some hyperparameter settings, GPT-2 small autoencoders find solutions with many dense latents (Figure 20), beginning around $k=256$ but especially for $k=512$.

This coincides with when the scaling laws from Section 3 begin to break - many of our trends between $k$ and reconstruction loss bend significantly. Also, MSE becomes significantly less sensitive to $n$, at $k=512$.

Figure: Figure 20: Average density of the $d_{model}$ most-dense features, divided by L0, for different autoencoders. When $k=512$, the learned autoencoders have many dense features. This corresponds to when ablations stop having sparse effects Section 4.5, and anecdotally corresponds to noticeably less interpretable features. For $k=256$, $n=2048$, there is perhaps an intermediate regime.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepnk_memorization.png

Figure: Figure 21: Explanation scores for GPT-2 small autoencoders of different $n$ and $k$, evaluated on 400 randomly chosen latents per autoencoder. It is hard to read off trends, but the explanation score is able to somewhat detect the dense solutions region.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepnk_explanation_score.png

### E.6 Recurring dense features in GPT-2 small

We manually examined the densest latents across various GPT-2 small layer 8 autoencoders, trained in different ways (e.g. differing numbers of total latents).

The two densest latents are always the same feature: the latent simply activates more and more later in the context ($\sim$ 40% active), and one that activates more and more earlier in the context excluding the first position ($\sim$35% active). Both features look like they want to activate more than they do, with TopK probably preventing it from activating with lower values.

The third densest latent is always a first-token-position feature ($\sim$30% active), which has a modal activation value in a narrow range between 14.6-14.8. Most of its activation values are significantly smaller values, at tokens after the first position; the large value is always at the first token. These smaller values appear uninterpretable; we conjecture these are simply interference with the first position direction. (Sometimes there are two of these latents, the second with smaller activation values.)

Finally, there is a recurring “repetition” feature that is $\sim$20% dense. Its top activations are mostly highly repetitive sequences, such as series of dates, chapter indices, numbers, punctuations, repeated exact phrases, or other repetitive things such as Chess PGN notation. However, like the first-token-position latents, random activations of this latent are typically appear unrelated and uninterpretable.

Often in the top ten densest latents, we find opposing latents, which have decoder cosine similarity close to $-1$. In particular, the first-token-position feature and the repetition latent both seems to always have an opposite latent. The less dense of the two opposite latents always seems to appear uninterpretable. We conjecture that these are symptoms of optimization failure - the opposite latents cancel out spurious activations in the denser latent.

### E.7 Clustering latents

[Elhage et al., ] discuss how underlying features may lie in distinct sub-spaces.
If such sub-spaces exists, we hypothesize that the set of latent encoding vectors $W\in\mathbb{R}^{n\times d}$ can be written as a block-diagonal matrix $W^{\prime}=PWR$, where $P\in\mathbb{R}^{n\times n}$ is a permutation matrix, and $R\in\mathbb{R}^{d\times d}$ is orthogonal.
We can then use the singular vector decomposition (SVD) to write $W=U\Sigma V^{\top}$ and $W^{\prime}=U^{\prime}\Sigma^{\prime}V^{\prime\top}$, noting that $U^{\prime}$ is also block diagonal. Finally, we write $W=P^{\top}U^{\prime}\Sigma^{\prime}V^{\prime\top}R^{\top}=U\Sigma V^{\top}$, and because the SVD is unique up to a column permutation $P^{\prime}$, we get $U=P^{\top}U^{\prime}P^{\prime}$. In other words, if $W$ is block-diagonal in some unknown basis, $U$ is also block diagonal up to a permutation of rows and columns.

To find a good permutation of rows, we sorted the rows of $U$ based on how similarly they project on all elements of the singular vector basis. Specifically, we normalized each row to unit norm $\tilde{U_{i}}=U_{i}/||U_{i}||$ and considered the pairwise euclidean distances $d_{i,j}=||\tilde{U_{i}}^{2}-\tilde{U_{j}}^{2}||$. These pairwise distances were then reduced to a single dimension with a UMAP algorithm [McInnes et al., ]. The obtained 1-dimensional embedding was then used to order the projections $\tilde{U_{i}}^{2}$ (Figure 22a), which reveals two fuzzily separated sub-spaces. These two sub-spaces use respectively about 25% and 75% of the dimensions of the entire vector space.

Interestingly, ordering the columns by singular values is fairly consistent with these two sub-spaces. One reason for this result might by that latents projecting to the first sub-space have different encoder norms than latents projecting to the second sub-space (Figure 22b). This difference in norm can significantly guide the SVD to separate these two sub-spaces.

To further interpret these two sub-spaces, we manually looked at latents from each cluster. We found that latents from the smaller cluster tend to activate on relatively non-diverse vocabulary tokens. To quantify this insight, we first estimated $A_{i,v}$, the average squared activation of latent $i$ on vocabulary token $v$. Then, we normalized the vectors $A_{i}$ to sum to one, $\tilde{A}_{i,v}=A_{i,v}/\sum_{w}A_{i,w}$ and computed the effective number of token $m_{i}=\exp(\sum_{v}\tilde{A}_{i,v}\log(\tilde{A}_{i,v}))$. The effective number of token is a continuous metric with values in $[1,n_{\text{vocab}}]$, and it is equal to $k$ when a latent activates equally on $k$ vocabulary tokens. With this metric, we confirmed quantitatively (Figure 22c) that latents from the smaller cluster all activate on relatively low numbers of vocabulary tokens (less than $100$), whereas latents from the larger cluster sometimes activate on a larger numbers of vocabulary tokens (up to $1000$).

Figure: Figure 22: The residual stream seems composed of two separate sub-spaces. About 25% of latents mostly project on a sub-space using 25% of dimensions. These latents tend to have larger encoder norm, and to activate on a smaller number of vocabulary tokens. The remaining 75% of latents mostly project on the remaining 75% of dimensions, and can activate on a larger number of vocabulary tokens.
Refer to caption: x17.png

Figure: Figure 23: TopK beats ReLU not only on the sparsity-MSE frontier, but also on the sparsity-probe loss frontier. (lower is better)
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8_relu_vs_topk_probe_vs_L0.png

Figure: Figure 24: TopK beats ReLU on N2G F1 score. Its N2G explanations have noticeably higher recall, but worse precision. (higher is better)
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8_relu_vs_topk_n2g_f1_vs_L0.png

Figure: (a) Recall of N2G explanations $P(\text{n2g}>0|\text{act}>0)$
Refer to caption: extracted/5646653/figures/fig_gpt2sm_L8sweepnk_n2g_recall.png

Figure: Figure 26: The $L(N)$ scaling law, including the best 16M checkpoint, which we did not have time to train to the $L(N)$ token budget due to compute constraints.
Refer to caption: extracted/5646653/figures/fig_lofn_16M.png

## Appendix F Miscellaneous small results

### F.1 Impact of different locations

In a sweep across locations in GPT-2 small, we found that the optimal learning rate varies with layer and location type (MLP delta, attention delta, MLP post, attention post), but was within a factor of two.

Number of tokens needed for convergence is noticeably higher for earlier layers. MSE is lowest at early layers of the residual stream, increasing until the final layer, at which point it drops. Residual stream deltas have MSE peaking around layer 6, with attention delta falling sharply at the final layer.

Figure: Figure 27: (a) Normalized MSE gets worse later in the network, with the exception of the last two layers, where it improves. Later layers suffer worse loss differences when ablating to reconstruction, even at the final two layers. (b) First position token loss is more severely affected by ablation than other layers despite having lower normalized MSE. Overall loss difference has no clear relation with normalized MSE across layers. In very early layers and the final layer, where residual stream norm is also more normal (Figure 30), we see a more typical loss difference and MSE. This is consistent with the hypothesis that the large norm component of the first token is primarily to serve attention operations at later tokens.
Refer to caption: extracted/5646653/placeholders/fig_gpt2sm_sweeploc_downstream_nmse_vs_loss_diff.png

When ablating to reconstructions, downstream loss and KL get strictly worse with layer. This is despite normalized MSE dropping at late layers. However, there appears to be an exception at final layers (layer 11/12 and especially 12/12 of GPT-2 small), which can have better normalized MSE than earlier layers, but more severe effects on downstream prediction (Figure 27).

We can also see that choice of layer affects different metrics differently (Figure 28). While earlier layers (unsurprisingly) have better N2G explanations, later layers do better on probe loss and sparsity.

In early results with autoencoders trained on the last layer of GPT-2 small, we found the results to be qualitatively worse than the layer 8 results, so we use layer 8 for all experiments going forwards.

Figure: (a) Recall of N2G explanations $P(\text{n2g}>0|\text{act}>0)$
Refer to caption: extracted/5646653/figures/fig_gpt2sm_sweeploc_n2g_recall.png

### F.2 Impact of token position

Figure: Figure 29: Later tokens are more difficult to reconstruct. (lower is better)
Refer to caption: extracted/5646653/placeholders/fig_gpt2sm_downstream_nmse_by_token.png

We find that tokens at later positions are harder to reconstruct (Figure 29). We hypothesize that this is because the residual stream at later positions have more features. First positions are particularly egregiously easy to reconstruct, in terms of normalized MSE, but they also generally have residual stream norm more than an order of magnitude larger than other positions ( Figure 30 shows that in GPT-2 small, the exception is only at early layers and the final layer of GPT-2 small). This phenomenon was explained in [Sun et al., , Xiao et al., ], which demonstrate that these activations serve as crucial attention resting states.

First token positions have significantly worse downstream loss and KL after ablating to autoencoder reconstruction at layers with these large norms (Figure 27), despite having better normalized MSE. This is consistent with the hypothesis that the large norm directions at the first position are important for loss on other tokens but not the current token. This position then potentially gets subtracted back out at the final layer as the model focuses on current-token prediction.

Figure: Figure 30: Residual stream norms by context position. First token positions are more than an order of magnitude larger than other positions, except at the first and last layer for GPT-2 small.
Refer to caption: extracted/5646653/figures/fig_gpt2sm_norm_per_tok.png

## Appendix G Irreducible loss term

In language models, the irreducible loss exists because text has some intrinsic unpredictableness—even with a perfect language model, the loss of predicting the next token cannot be zero.
Since an arbitrarily large autoencoder can in fact perfectly reconstruct the input, we initially expected there to be no irreducible loss term. However, we found the quality of the fit to be substantially less good without an irreducible loss.

While we don’t fully understand the reason behind the irreducible loss term, our hypothesis is that the activations are made of a spectrum of components with different amount of structure. We expect less strucutured data to also have a worse scaling exponent. At the most extreme, some amount of the activations could be completely unstructured gaussian noise. In synthetic experiments with unstructured noise (see Figure 31), we find an $L(N)$ exponent of -0.04 on 768-dimensional gaussian data, which is much shallower than the approximately -0.26 we see on GPT-2-small activations of a similar dimensionality.

Figure: Figure 31: L(N) scaling law for training on 768-dimensional random gaussian data with k=32
Refer to caption: extracted/5646653/figures/fig_random_scaling.png

## Appendix H Further probe based evaluations results

Figure: Figure 32: Probe eval scores through training for 128k, 1M, and 16M autoencoders. The baseline score of using the channels of the residual stream directly is 0.600.
Refer to caption: extracted/5646653/figures/fig_probe_through_training.png

Figure: Figure 33: Probe eval scores for the 16M autoencoder starting at the point where probe features start developing (around 10B tokens elapsed).
Refer to caption: extracted/5646653/figures/fig_probe_breakdown_by_task_zeronorm.png

Figure: Figure 34: Probe eval scores for the 16M autoencoder broken down by task. Some lines (europarl, bigrams, occupations, ag_news) are aggregations of multiple tasks.
Refer to caption: extracted/5646653/figures/fig_probe_breakdown_by_task.png

**Table 1: Tasks used in the probe-based evaluation suite**
| Task Name | Details |
| --- | --- |
| amazon | McAuley and Leskovec [] |
| sciq | Welbl et al. [] |
| truthfulqa | Lin et al. [] |
| mc_taco | Zhou et al. [] |
| piqa | Bisk et al. [] |
| quail | Rogers et al. [] |
| quartz | Tafjord et al. [] |
| justice | Hendrycks et al. [] |
| virtue |  |
| utilitarianism |  |
| deontology |  |
| commonsense_qa | Talmor et al. [] |
| openbookqa | Mihaylov et al. [] |
| base64 | discrimination of base64 vs pretraining data |
| wikidata_isalive | Gurnee et al. [] |
| wikidata_sex_or_gender |  |
| wikidata_occupation_isjournalist |  |
| wikidata_occupation_isathlete |  |
| wikidata_occupation_isactor |  |
| wikidata_occupation_ispolitician |  |
| wikidata_occupation_issinger |  |
| wikidata_occupation_isresearcher |  |
| phrase_high-school |  |
| phrase_living-room |  |
| phrase_social-security |  |
| phrase_credit-card |  |
| phrase_blood-pressure |  |
| phrase_prime-factors |  |
| phrase_social-media |  |
| phrase_gene-expression |  |
| phrase_control-group |  |
| phrase_magnetic-field |  |
| phrase_cell-lines |  |
| phrase_trial-court |  |
| phrase_second-derivative |  |
| phrase_north-america |  |
| phrase_human-rights |  |
| phrase_side-effects |  |
| phrase_public-health |  |
| phrase_federal-government |  |
| phrase_third-party |  |
| phrase_clinical-trials |  |
| phrase_mental-health |  |
| social_iqa | Sap et al. [] |
| wic | Wang et al. [] |
| cola |  |
| gpt2disc | OpenAI [] |
| ag_news_world |  |
| ag_news_sports |  |
| ag_news_business |  |
| ag_news_scitech |  |
| europarl_es | Koehn [] |
| europarl_en |  |
| europarl_fr |  |
| europarl_nl |  |
| europarl_it |  |
| europarl_el |  |
| europarl_de |  |
| europarl_pt |  |
| europarl_sv |  |
| jigsaw | Cjadams et al. [] |

## Appendix I Contributions

Leo Gao implemented the autoencoder training codebase and basic infrastructure for GPT-4 experiments. Leo worked on the systems, including kernels, parallelism, numerics, data processing, etc. Leo conducted most scaling and architecture experiments: TopK and AuxK, tied initialization, number of latents, subject model size, batch size, token budget, optimal lr, $L(C)$, $L(N)$, random data, etc., and iterated on many other architecture and algorithmic choices. Leo designed and iterated on the probe based metric. Leo did investigations into downstream loss, feature recall/precision, and some early explorations into circuit sparsity.

Tom Dupré la Tour studied activation shrinkage, progressive recovery, and Multi-TopK. Tom implemented and trained the Gated and ProLU baselines, and trained and analyzed different layers and locations in GPT-2 small. Tom helped refine the scaling laws for $L(N,K)$ and $L_{s}(N)$. Tom discovered the latent sub-spaces (refining an idea and code originally from Carroll Wainwright).

Henk Tillman worked on N2G explanations and LM-based explainer scoring. Henk worked on infrastructure for scraping activations. Henk worked on finding qualitatively interesting features, including safety-related features.

Jeff Wu studied ablation effects and sparsity, and ablation reconstruction. Jeff managed infrastructure for metrics, and wrote the visualizer data collation and website code. Jeff analyzed overall cost of having a fully sparse bottleneck, and analyzed recurring dense features. Cathy and Jeff worked on finding safety-relevant features using attribution. Jeff managed core researchers on the project.

Gabriel Goh suggested using TopK, and contributed intuitions about TopK, AuxK, and optimization.

Rajan Troll contributed intuitions about and advised on optimization, scaling, and systems.

Alec Radford suggested using the irreducible loss term and contributed intuitions about and advised on the probe based metric, optimization, and scaling.

Jan Leike and Ilya Sutskever managed and led the Superalignment team.

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 3
presentation: 3
questions: 1. Could you elaborate on the choice of fixed-k sparsity? Do you foresee any scenarios where adaptive sparsity (varying k based on input complexity) might improve model performance or interpretability? Have you experimented with such approaches?

2. Given that TopK activation controls sparsity effectively, do you see potential limitations of this method in real-world applications, where sparsity needs may vary dynamically?

3. Could you share more about how the interpretability metrics were validated? For instance, have you found that these metrics correlate well with human judgment in terms of interpretability?

4. How sensitive is the auxiliary loss to hyperparameter changes, particularly at larger scales? Could you share any guidelines or best practices for tuning this component?
soundness: 3
strengths: 1. The adoption of k-sparse autoencoders with TopK activation is a significant improvement over traditional ReLU-based models. By directly controlling the number of active latents, TopK provides a straightforward way to balance reconstruction quality and sparsity, simplifying tuning and improving interpretability.

2. The study of scaling laws for sparse autoencoders across various dimensions—autoencoder size, language model size, and sparsity—is well-executed. This contributes valuable insights into how autoencoders behave at larger scales, especially when trained on large models like GPT-4. Clear scaling patterns provide guidelines for researchers to optimize model size and token budgets effectively.

3. The authors address the issue of "dead latents" effectively by using specific initialization and auxiliary loss techniques. This innovation minimizes computational waste and improves model efficiency, making it feasible to train much larger autoencoders while keeping most latents active, even at high scales.

4.The paper introduces thoughtful metrics that go beyond simple reconstruction errors to evaluate feature quality. Metrics like downstream loss, probe loss, explainability, and sparsity of downstream effects offer a more nuanced assessment of latent quality, highlighting the interpretability of features that the autoencoders extract. This focus on interpretability is particularly important for mechanistic understanding and applications in AI alignment.

5. The use of TopK avoids the activation shrinkage problem that commonly affects ReLU-based sparse autoencoders. This makes TopK particularly suitable for training sparse models without the need for additional regularisation to combat shrinkage, which simplifies model training and improves performance.
summary: The paper proposes the use of a k-sparse auto encoder model to  control sparsity, simplifying tuning and improving the reconstruction-sparsity frontier. The paper presents results showing better reconstruction and minimal dead latents. The authors trained a 16-million latent autoencoder on GPT-4 activations over 40 billion tokens, demonstrating clear scaling laws for the autoencoder size and sparsity. The main contribution of the paper is the use of TopK activation to limit the number of active latents and presenting metrics of latent quality.

This limiting factor seems to play a role in allowing scaling the model for larger encoders as demonstrated  experimentally on GPT2 with multiple ablation studies and an in-depth evaluation downstream loss, explainability amongst other metrics.
weaknesses: 1. As highlighted in the limitations section, The TopK activation function might be overly restrictive. Each token must use exactly k latents, which could be suboptimal for capturing certain features that require more flexible sparsity levels based on input complexity. 

2. The experiments primarily use a context length of 64 tokens, which may not capture longer dependencies present in language models like GPT-4. By not exploring larger context lengths, the paper might miss behaviors and interactions that occur over more extended sequences, which could be valuable for understanding latent patterns and achieving higher interpretability.

3. Although the paper introduces meaningful metrics for interpretability, some, like the downstream loss and explainability evaluations, require substantial computational resources, particularly for large models like GPT-4. 

4. The reliance on an auxiliary loss to prevent dead latents may add extra complexity to the training process. While effective, this approach could complicate optimization and might be sensitive to tuning, making it more challenging to reproduce results consistently across different datasets and architectures.

5. Although the approach seem to scale on relatively smaller model, it is not clear how scalable this approach for much larger model.s

6. While the paper discusses applications like anomaly detection and mechanistic interpretability, there is limited empirical testing in these areas. Applying these sparse autoencoders to real-world tasks and evaluating their practical benefits would strengthen the claim of their utility and robustness across applications.

7. The explainability metric, which relies on methods like Neuron to Graph (N2G), is noted to have high recall but lower precision. This can create an "illusion of interpretability," where explanations seem broad but lack specificity. The paper briefly acknowledges this, but a more in-depth exploration of how to balance recall and precision would improve confidence in these metrics.

---

confidence: 4
contribution: 4
initial_rating: 10
presentation: 4
questions: Some work that might improve this paper:
- Checking whether top-K sparse autoencoders find the same latents as other methods. Reliance on summary statistics when making comparisons between architectures could be misleading. 
- Establishing that top-K sparse autoencoders work well on toy models of superposition (and using this to better explain why top-K might be better than other architectures).
- Using longer prompts than 64 tokens when training sparse autoencoders (this seems rather short) or instead providing an empirical analysis showing that this hyperparameter has no meaningful impact on results. 

Since my overall impression of the paper is quite good, and most of the weaknesses, if addressed, would substantially increase the length of the paper, I don't believe addressing any given issue is essential.
soundness: 4
strengths: ## Strengths by Section:

**Training Recipe**: The paper is unusually detailed with respect to the training recipe, which provides more clarity than similar publications about the training of sparse autoencoders. As noted by the authors, use of the Top-K activation function in a sparse autoencoder is not new, but it is novel in the context of sparse autoencoders trained on model activations. Importantly, it solves a previously documented issue called "shrinkage" which results in latent activations being biased towards activating less strongly than they theoretically should. 

**Scaling laws**: The paper demonstrates not only the training of sparse autoencoders on a SOTA language model, substantiating claims that this technique is scalable. Use of GPT4 provides one of the strongest possible arguments that sparse autoencoders can scale to very large LLMs. Additionally, the authors provide clear scaling laws in terms of the compute, data and number of latents. Though possibly a minor detail, we appreciate that the authors highlighted their initial incorrect prediction that there would need to be non-zero irreducible loss (as such comments help inform readers that the result was not obvious and thus increases readability and makes the significance clearer). 

**Evaluating SAEs**: Though plausibly it would be reasonable to separate work scaling sparse autoencoders from work exploring how best to evaluate them, we appreciate the attempt to rectify the current gap in the literature around how to evaluate sparse autoencoders. Contributions in this section are well motivated and varied. Section 4.3 is particularly valuable, as Neuron 2 Graph is a plausibly much cheaper way to perform automatic interpretability as opposed to the use of language models. 

## Strength by Dimension

**Originality**: While the work mostly combines existing ideas from the literature placing them in the context of sparse autoencoders trained on model activations, this hardly diminishes the contribution. Some ideas may be more clearly novel than others (such as the pre-training compute based metric that enables better interpretation of the increase in downstream loss in section 4.1). 

**Quality**: The work is generally high quality. There are no glaring issues that I can see. 

**Clarity**: Details of both the methods and reasoning are generally high quality.

**Significance**: The paper is highly significant due to contributions along multiple lines (training recipe, scaling laws and evaluation of SAEs).
summary: The authors present a well written paper which makes multiple significant contributions to the field of language interpretability. The paper does not explicitly pose a set of questions, but the subject matter implies several concerns:
1. Do sparse autoencoders scale to larger models? Does this require more latents than for larger models?
2. Can sparse autoencoder training be improved? For example, can it be made simpler via use of a top-K activation function? 
3. How should we evaluate sparse autoencoders? Are there alternatives to the sparsity-reconstruction pareto-frontier framing?

The paper makes a number of contributions. 
1. First, they propose a novel training recipe based on the use of the Top-K activation function for directly imposing sparsity in the sparse bottleneck layer. They evaluate their methods against similar proposed methods via the sparsity-reconstruction pareto-frontier framing and find their recipe is competitive with the best methods in the existing literature.
2. Second, they demonstrate scaling laws for their sparse autoencoder training recipe using the GPT4 family of models. 
3. Finally, they introduce a number of additional metrics for evaluating sparse autoencoders including loss-based metrics, metrics which rely on labeled datasets, automated interpretability and ablation sparsity. 

The strongest contribution of the paper is clearly the application of SAEs to exceptionally larger models, showing that sparse autoencoders scale to such models, but the paper also makes numerous other contributions around training and evaluation methods.
weaknesses: **Training Recipe:** 
- We appreciate that the proposed method eliminates the need for finetuning of the L1 coefficient (though choice of the number of activated latents is still required). We might interpret later analysis as attempting to identify a more principled way for setting the number of activations (setting K), though in the absence of better motivation, directly setting the number of activating latents isn’t clearly valuable. 
- Comparison of sparse autoencoder architectures is somewhat shallow, looking only at the sparsity-reconstruction pareto frontier. For example, the authors do not attempt to compare latents found by each method to establish whether they provide similar or distinct decompositions (is there often a 1:1 map between latents in sparse autoencoders trained via each method?). 
- The authors could have provided demonstrations that top-K sparse autoencoders work on toy models of superposition (as has been previously done to establish reason to prefer one architecture over another).
- Whilst the authors consider alternative methods for evaluating sparse autoencoders later in the work, they should have revisited the training recipe comparison in the context of their other evaluation methods. It is unclear whether Gated / topK SAEs would be comparable on all evaluation methodologies.
- The authors miss one possible issue with top-K activation functions. Use of the Top-K activation function means that the activation of a given latent cannot be calculated independently of others which is a minor but real obstacle to working with very large autoencoders (for example, when identifying max activating examples, one must first calculate all latent activations, then select the top-K latents). 
- Training on 64 token context sizes might affect the results. The models studied certainly can handle much longer prompts. The authors don’t note whether the SAEs generalize to activations produced during the process of larger numbers of consecutive tokens. 

**Scaling Laws**. We have no specific comments on the weaknesses of this section. 

**Evaluating SAEs**
- Though contributions in this section are valuable, there is an absence of discussion resolving possible metrics and identifying which are best to use in practice. Though many related papers likely deal with the current uncertainties of the field similarly (by presenting various possible motivations / metrics without meaningfully resolving which is best). We believe that devoting more of the discussion to comparing metrics and resolving insights found via each may be fruitful.
- (Repeating a point from earlier) The authors don’t evaluate non-TopK autoencoders via any of the new metrics leaving possibly valuable insights on the table. 
- Section 4.2 could have used a linear probe on the model activations as a baseline against which to compare the 1d logistic probe results. The authors also don’t perform any error analysis or raise any particular examples of latents which clearly track expected features of the input. While such qualitative analysis may not scale, it might possibly provide much better intuition about the results. The authors don’t address how sparse combinations of latents might jointly represent features.
- The authors could attempt to compare Neuron 2 Graph explanations to those produced by language models (which is the norm for automatic explanations of features in the rest of the sparse autoencoder literature).

---

confidence: 4
contribution: 4
initial_rating: 10
presentation: 3
questions: - did you use the scaling laws to choose hyperparameters for the largest SAE training runs? Do you know how well that worked?
- Have you thought about ways to more scalably evaluate precision of SAE latent explanations?
soundness: 4
strengths: - the paper presents a new, simpler SAE architecture and training stack that demonstrably scales to frontier models and many SAE latents. The main advantages over concurrent work are:
	- the sparsity can be set directly, making it easier to do hyperparameter tuning;
	- the training recipe is also simple and with few knobs to tune;
	- yet results on the MSE/sparsity frontier are state of the art, and there are very few dead latents
- many of the findings are quite well supported by extensive comparisons with other SAE variants
- the discussion on the limitations of autointerpretability methods in 4.3. is illuminating
- the paper proposes some new and interesting interpretability evaluations, especially probing and sparsity of downstream effects
summary: The paper develops training methodology and scaling laws for a new sparse autoencoder (SAE) variant - TopK SAEs, which replaces the L1 penalty in the standard SAE (https://transformer-circuits.pub/2023/monosemantic-features) with a TopK filter, so that the desired sparsity of activations can be set directly. The new architecture is evaluated against other popular SAE variants along the reconstruction-sparsity frontier. The interpretability of the TopK SAE latents is also measured via several novel metrics.

In more detail:
- the TopK filter overcomes the shrinkage problem associated with the L1 penalty, allowing better reconstruction with the same sparsity;
- to minimize dead latents, the TopK training method uses a simple initialization strategy and an auxiliary loss that incentivizes the dead latents to reconstruct the error of the SAE.
- scaling laws for TopK are studied w.r.t. various parameters, such as the number of latents, the $k$ value, and the size of the model whose activations SAEs are trained on. 
- several evaluations beyond MSE/sparsity tradeoffs are performed:
	- downstream loss when SAE reconstructions are patched in
	- using individual SAE latents as probes for binary classification tasks 
	- simple autointerpretability based on Neuron to Graph (N2G)
	- evaluating how sparse the effect of ablating SAE latents is on logits of the model
weaknesses: - as the authors are already aware, using individual SAE latents as probes for very high-level binary tasks (such as sentiment) may be too restrictive, especially in light of phenomena such as feature splitting. This limits the significance of the results
- another practical limitation of the TopK architecture is that it forces every activation to use exactly $k$ active features. In practice (at least in my experience) this may lead to many unimportant features to activate. See concurrent work https://www.alignmentforum.org/posts/Nkx6yWZNbAsfvic98/batchtopk-a-simple-improvement-for-topk-saes
- the interpretability evaluation is at times too reliant on high-level aggregate metrics. For instance, how should we interpret the "sparsity of downstream effects" numbers?
- the presentation on scaling laws would benefit from a comparison with concurrent work by Anthropic: https://transformer-circuits.pub/2024/scaling-monosemanticity/#scaling-scaling-laws
- there is some inconsistent notation (e.g., using $N$ and $n$ for the number of latents) and some missing symbols from the text

---

confidence: 4
contribution: 4
initial_rating: 8
presentation: 4
questions: How much better is the aux loss than the top-k loss? 
This is interesting as it quantifies how much reconstruction quality we are 'paying' for sparsity.

At lines 132 and 452 do you believe 'an' should be 'a' (or is it not a typo)?

The following refers to work that is contemporaneous (4 months old or less), and it does not affect my rating.
Are you aware of:
- Jumprelu SAEs?
- Mixture of Experts SAEs? I believe you hinted at this in the paper.
- Sparse feature circuits? And the possibility to do evals on known circuits not just known latents (SAE seem not to be the best at factual recall).
soundness: 3
strengths: The paper's strengths are as follows: 

## Scale:

LLMs are being used in an increasing number of fields, and research into LLM interpretability is important for ensuring their fairness and safety, especially at scale.
This paper scales up SAEs to frontier LLMs, such as GPT4, which is a ***significant improvement*** over previous work, which was limited to smaller models. Furthermore, scaling laws are found, which could be very useful to practitioners and researchers trying to predict SAE performance ex-ante.

## Top-K:

The paper's usage of top-k SAE is one of the main contributions of this work, and it is ***original*** to the extent that top-k sparse autoencoders hadn't (to the best of my knowledge) been used on LLMs before. The ***quality*** of the results of the top-k function is such that it represent the state of the art when compared to other activation functions.

## Auxiliary Loss:

The authors tackle the ***significant*** issue of dead latents (up to 90% of the total when not mitigated) by introducing an auxiliary loss to the overall loss function. This incentivises the model to use all the latents, as it also supervises the next-aux latents. The ***quality*** of the results is high, as it reduces dead latents by an order of magnitude to 7%. This is to the best of my knowledge an ***original*** contribution.

## Evaluations:

The paper introduces many new evaluations. I believe that explainable loss and known latent probing are the most ***significant***.
Explainable loss is an ***original*** metric that considers the loss from just using the explanations that the SAE generates (discarding uninterpretable latents), and it represents a ***significant*** improvement over either MSE or L0 alone since it includes both reconstruction quality and an interpretability guarantee (L0 does not). Known latent probing is interesting in that it shows that the ***quality*** of probes of the latents is 25% better than that of residual stream probes.

## Clarity:

The paper is very ***clear*** across all sections, and its presentation is of high ***quality***
summary: In this paper, the authors scale and evaluate sparse autoencoders (SAEs) on modern large language models (LLMs) across different model sizes (up to GPT4).

The main contributions are as follows:
- SAEs are trained and evaluated across different model sizes, and scaling laws are found.
- The top-k activation function is leveraged to obtain state of the art results, and its ability to avoid activation shrinkage is explored
- An auxiliary loss is devised, and it significantly reduces the amount of dead features
- New metrics are introduced for evaluation: the explanation loss (obtained using just interpretable explanations), and the probe loss (where the authors check wether the SAE reproduces known features).

My **recommendation**: Accept, 8/10 (good paper).

### Why not lower score?

- Scaling SAEs was a very important problem in interpretability, as indicated in the seminal SAE paper.
- Top-k SAEs are a significant improvement on an important research topic. This approach is well motivated and well placed in the literature.

### Why not higher score?

- The performance of top-k SAEs is state of the art, but not beyond comparison with alternatives.
- While top-k SAEs are a significant incremental improvement, top-k SAEs are not new, and this is a new application.
weaknesses: The paper's weaknesses are as follows:

## Irreducible error:
The paper notes that adding an irreducible error term to the scaling laws improves the laws. However, the explanation of why such an error term would exist in LLM activations is not clear, and an experiment showing that gaussian noise is hard to fit for SAEs is provided instead. The experiment does explain why such an error would be there in the first place, and its outcome is not surprising. Mentioning "components with different amounts of structure" is vague.

## Top-K vs penalty shrinkage experiments:
It is expected that having larger activations for top-k SAEs won't improve the loss and that it will for sparsity penalty SAEs. This is because top-k SAEs do not have any constraint on the magnitude of the k activations they use. An experiment on shrinkage does not make the top-k activation function more attractive.

## Reproducibility:

An issue with the experiments in this paper is that GPT4 is a closed source model, which makes it hard to reproduce the results of some of the experiments.

## Probing datasets:

A set of 61 binary classification tasks is used to train probes on the latents. It is not clear why these specific tasks have been chosen. A larger and more diverse set of tasks would have been more significant.

## Unclear phrasing of top-k's contributions:
In line 132 there is a missing word after: "instead of", which I assume to be L1, but it's unclear.

---

confidence: 4
contribution: 4
initial_rating: 10
presentation: 3
questions: If it is permitted for authors to make revisions before the final submission, there are several small changes that could improve the quality of the paper:

- The paper would benefit from a thorough proofreading for typos. Examples include:
	- Line 129 reads: "It removes the need for the penalty. is an imperfect approximation of , and it introduces a bias of shrinking all positive activations toward zero (subsection 5.1)." 
	- In line 327, the expression "min E [y log σ(wzi +b)+(1−y)log(1−σ(wzi +b))]" must be negated to get entropy.
	- Line 367-368 is missing a word after "similar": "with the same n (resulting in better F1 scores) and similar (Figure 24)."
	- Line 384 "trie" should be "tree".

- In section 2.4, it would be good to describe the provenance of the technique "we initialize the encoder to the transpose of the decoder". This is described in (Conerly, 2024) (https://transformer-circuits.pub/2024/april-update/index.html#:~:text=in%20most%20cases).-,%F0%9D%91%8A,.,-The%20rows%20of), which the authors should cite as inspiration or an independent replication. The other technique in section 2.4, auxiliary loss, is properly cited to (Jermyn & Templeton, 2024) in Appendix A.2.

- (Uncertain) The paper's introduction links to "code and autoencoders for open-source models" and a "visualizer". In the reviewer copy, these links are broken, likely to keep the authors anonymous. The authors should confirm that these links work in the final submission version.
soundness: 4
strengths: - This paper makes multiple novel contributions to research on the application of SAEs to language models:
	- The Top-k SAE architecture has not previously been used on language models. (Though they were introduced previously by (Makhzani & Frey, 2013).)
	- Scaling SAEs to a model the size of GPT-4 is a challenge due to the increasing concentration of dead features, and the early works in this field (Cunningham et al, 2023; Bricken et al, 2023) focused on relatively small language models. The scaling done in this paper is not entirely novel, as (Templeton et al, 2024) trained SAEs on the similarly-sized Claude 3 Sonnet, but this paper likely represents contemporaneous, parallel work.
	- Similarly, this paper finds scaling laws that are novel except for (Templeton et al, 2024).
	- This paper investigates several methods for evaluating SAEs beyond sparsity and reconstruction accuracy, which are important for establishing outside validity and utility. Especially appreciated is the metric in lines 311-314, contextualizing downstream loss in terms of a fraction of pre-training compute.

- In addition to the quantitative results, Top-k SAEs provide qualitative benefits over previous SAE architectures:
	- The sparsity level of Top-k SAEs is directly set, instead of relying on an indirect hyperparameter.
	- Top-k SAEs do not suffer from "feature shrinkage" caused by L1-regularization. The authors clearly demonstrate this in the excellent Figure 8.
	- Top-k SAEs have far fewer dead features at large scales.
summary: This paper (1) introduces Top-k sparse autoencoders (SAEs), which are novel for language models; (2) trains them on language models ranging in size up to GPT-4; (3) measures the SAE's sparsity/reconstruction tradeoff, finding performance that exceeds the state-of-the-art by a small margin; (4) demonstrate scaling laws for reconstruction accuracy in terms of training FLOPS and SAE width; and (5) measures the SAEs on a range of "downstream" metrics.
weaknesses: - While the authors describe many results, they are not all equally justified.
	- Section 4.2 (Recovering Known Features with 1D Probes) is conceptually very exciting, but somewhat confusing in its details.
		- The magnitude of the probe loss improvement seems very low, from ~0.52 in the worst case to ~0.49 in the best case. Figures 32 and 33 indicate that a similar magnitude of improvement across various run sizes and datasets. This section would therefore benefit from more baselining: what is the best such classifier based on a residual stream neuron? On a linear  probe trained on all the residual stream neurons? On similarly-sized noise?
		- The only such baseline in the paper is that in Figure 32 the caption says that the loss on residual stream channels is 0.600. But the figure shows the loss improving from 0.46 to 0.44 over training, so it seems like almost all of the gain of the SAE occurred in the first <1% of training.
		- The probe losses appear to be averaged across the 61 datasets. This should be clearly stated in the body of the text.
	- Figure 7 is hard to understand, and would benefit from more explanations of its significance.

- There are several typos in the body of the text (see below)

Meta-review: The paper proposes scaled sparse autoencoders with top-k activation to directly control the number of active latent variables and thereby improve interpretability. The proposed approach bares significant benefits in terms of reconstruction ability, non-dead latents and sparsity, fostering improvements in terms of model interpretability. Further, the model is scaled to GPT4 to for practically relevant model analysis. A thorough ablation is provided on GPT-2.
The paper has three very supportive reviews (score 10), highlighting the originality and significance of the work, which has already been adapted in several follow-up works. The paper is very well written, the method description is very detailed and the contributions in terms of the provided training recipe and scaling laws for autoencoders a highly relevant contribution. Technically, the practical scaling of the approach to GPT-4 is also impressive. Overall, the AC agrees that the paper should be highlighted.

Decision: Accept (Oral)