text stringlengths 165 4.35k |
|---|
Scaling and evaluating sparse autoencoders Leo Gao∗Tom Dupré la Tour†Henk Tillman† Gabriel Goh Rajan Troll Alec Radford Ilya Sutskever Jan Leike Jeffrey Wu† Open AI Abstract Sparse autoencoders provide a promising unsupervised approach for extracting in-terpretable features from a language model by reconstructing activ... |
109 107 105 FLOPs (as fraction of GPT-4 pretraining)0. 20. 30. 40. 50. 6Normalized MSEL(C) L=0. 09+0. 056C0. 084 104105106107 Number of Latents 104105 Number of Latents3×101 4×101 6×101 Normalized MSEL(N, k) 3264128256512 k Figure 1: Scaling laws for Top K autoencoders trained on GPT-4 activations. (Left) Optimal loss ... |
101102 Sparsity (L0)4×101 5×101 6×101 Normalized MSE better Re LU Pro LU STE Gated T op K (ours)(a) At a fixed number of latents ( n= 32768 ), Top K has a better reconstruction-sparsity trade off than Re LU and Pro LU, and is comparable to Gated. 104105 Number of Latents4×101 5×101 6×101 Normalized MSERe LU Pro LU STE ... |
202122232425 Learning Rate (x 1e-4)4×101 5×101 Normalized MSE 7. 9B 7. 1B 6. 3B 3. 9B 3. 2B 2. 2B 2. 0B 4. 0B 3. 4B 2. 9B 2. 7B 2. 4B 2. 2B 1. 7B 4. 0B 3. 7B 2. 9B 3. 2B 1. 2B 1. 3B 1. 2B 2. 3B 2. 0B 1. 8B 1. 8B 1. 2B 1. 1B 1. 0B 1. 1B 1. 0B 1. 0B 1. 0B 1. 0B 0. 9B 0. 6B 1. 3B 1. 1B 1. 1B 0. 9B 0. 9B 0. 9B 1. 2B 211212... |
101102 Sparsity (L0)101 Delta cross-entropy better Re LU Pro LU Re LU Pro LU STE Gated T op K (ours) (a) For a fixed number of latents ( n= 217= 131072 ), the downstream-loss/sparsity trade-off is better for Top K autoencoders than for other activa-tion functions. 101 6×102 2×101 3×101 Normalized MSE101 Delta cross-ent... |
(a) Probe loss (b) Logit diff sparsity Figure 6: The probe loss and logit diff metrics as a function of number of total latents nand active latents k, for GPT-2 small autoencoders. More total latents (higher n) generally improves all metrics (yellow = better). Both metrics are worse at L 0= 512, a regime in which solut... |
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 c... |
(a) A feature with precision = 0. 97, recall = 0. 56 (b) A feature with precision = 0. 06, recall = 0. 05 Recall Eval Sequences: \n\n There foreshe'snotgoingtoplay pranks buttogive asweet time-arendezvous choice. [Warn ing:Ripewith Wine Puns]\n\n Vital Lacerda (Septem ber. [Warn ing:Develop edwith Evolutionary Puns]\n\... |
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 nand smaller k. V·Ttotal numbers. We then measure the sparsity of this vector via (L1 L2)2, which corresponds to an “effective number of vocab tokens affecte... |
3 2 1 0 1 2 3 Difference after refinement0. 00. 20. 40. 60. 81. 01. 21. 4Density Re LU T op K 101102 L0101 Normalized MSE better Re LU T op K (raw) (refined) 101102 L0102 101 Delta cross-entropy better Re LU T op K (raw) (refined)Figure 9: Latent activations can be refined to improve reconstruction from a frozen set of... |
100101102103 Sparsity (L0)101 100Normalized MSEbetter T op K Act fn (train) T op K (test) Jump Re LU (test)Act fn (train) T op K (test) Jump Re LU (test) 100101102103 Sparsity (L0)101 100Normalized MSEbetter Multi-T op K Act fn (train) T op K (test) Jump Re LU (test)Act fn (train) T op K (test) Jump Re LU (test) 100101... |
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 meth... |
References Michal Aharon, Michael Elad, and Alfred Bruckstein. K-SVD: An algorithm for designing over-complete dictionaries for sparse representation. IEEE Transactions on signal processing, 54(11): 4311-4322, 2006. David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe, Katja Hansen, and Klaus-Robert Müll... |
Gabriel Goh. Decoding the thought vector, 2016. URL https://gabgoh. github. io/ Thought Vectors/. Accessed: 2024-05-24. Antonio Gulli. Ag's corpus of news articles. http://groups. di. unipi. it/~gulli/AG_corpus_ of_news_articles. html. Accessed: 2024-05-21. Wes Gurnee, Neel Nanda, Matthew Pauly, Katherine Harvey, Dmitr... |
Julien Mairal, Francis Bach, Jean Ponce, et al. Sparse modeling for image and vision processing. Foundations and Trends® in Computer Graphics and Vision, 8(2-3):85-283, 2014. Aleksandar Makelov, George Lange, and Neel Nanda. Towards principled evaluations of sparse autoencoders for interpretability and control, 2024. A... |
David Ruppert. Efficient estimations from a slowly convergent robbins-monro process. Technical report, Cornell University Operations Research and Industrial Engineering, 1988. Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. Socialiqa: Commonsense reasoning about social interactions. ar Xiv prepr... |
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. Yanli Zhao, Andrew Gu, Rohan Varma, Liang Luo, Ch... |
vectors match that of the inputs. However, in our ablations we find this has no effect or a weak negative effect (Figure 16). 19 A. 2 Auxiliary loss We define an auxiliary loss (Aux K) similar to “ghost grads” [Jermyn and Templeton, 2024] that models the reconstruction error using the top-kauxdead latents (typically ka... |
Figure 12: With correct hyperparameter settings, different batch sizes converge to the same L(N) loss (gpt2small). We use a bias-correction similar to that used in Kingma and Ba [2014]. 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 ... |
4×101 5×101 6×101 Normalized MSE100 4×101 6×101 Delta cross-entropy better Re LU Pro LU STE Gated T op K (ours)Figure 13: For a fixed sparsity level ( L0= 128 ), a given MSE leads to a lower downstream-loss for Top K than for other activations functions. (GPT-4). We are less confident about these runs than the correspo... |
Figure 15: Methods that reduce the number of dead latents (gpt2sm 2M, k=32). With Aux K and/or tied initialization, number of dead latents generally decreases over the course of training, after an early spike. C. 2 Initialization Figure 16: Initialization ablation (gpt2sm 128k, k=32). We find that tied initialization s... |
C. 4 Decoder normalization After each step we renormalize columns of the decoder to be unit-norm, following Bricken et al. [2023]. This normalization (or a modified L1 term, as in Conerly et al. [2024]) is necessary for L1 autoencoders, because otherwise the L1 loss can be gamed by making the latents arbitrarily small.... |
2. The decoder gradient uses Dense Sparse Matmul 3. The latent gradient uses Matmul At Sparse Indices 4. The encoder gradient uses Dense Sparse Matmul 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 give... |
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., 2023]. Counts are sampled over 1. 5e7 total tokens. Note that because latents that activate every 1e7 tokens are considered dead during training (and thus rec... |
Figure 21: Explanation scores for GPT-2 small autoencoders of different nandk, 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. E. 6 Recurring dense features in GPT-2 small We manually examined the d... |
0 200 400 600 Singular vectors0 5k 10k 15k 20k 25k 30k Latents 0. 0000. 0010. 0020. 0030. 004 0 5 10 UMAP embedding12345Encoder norm 20406080100120140160 0 5 10 UMAP Embedding100101102103104Effective number of tokens 20406080100Figure 22: The residual stream seems composed of two separate sub-spaces. About 25% of laten... |
Figure 24: Top K beats Re LU on N2G F1 score. Its N2G explanations have noticeably higher recall, but worse precision. (higher is better) (a) Recall of N2G explanations P(n2g>0|act>0) (b) Precision of N2G explanations P(act>0|n2g>0) Figure 25: Neuron2graph precision and recall. The average autoencoder latent is general... |
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. 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 difference... |
(a) Recall of N2G explanations P(n2g>0|act>0) (b) Precision of N2G explanations P(act>0|n2g>0) (c) Probe loss (d) Logit diff sparsity Figure 28: Metrics as a function of layer, for GPT-2 small autoencoders with k= 32 andn= 32768. Earlier layers are easier to explain in terms of token patterns, but later layers are bett... |
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. less strucutured data to also have a worse scaling exponent. At the most extreme, some amount of the activations could be compl... |
31 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. Figure 33: Probe eval scores for the 16M autoencoder starting at the point where probe features start developing (around 10B tokens elapsed). |
32 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. |
Table 1: Tasks used in the probe-based evaluation suite Task Name Details amazon Mc Auley and Leskovec [2013] sciq Welbl et al. [2017] truthfulqa Lin et al. [2021] mc_taco Zhou et al. [2019] piqa Bisk et al. [2020] quail Rogers et al. [2020] quartz Tafjord et al. [2019] justice Hendrycks et al. [2020]virtue utilitarian... |
I Contributions Leo Gao implemented the autoencoder training codebase. Leo worked on the systems, including kernels, parallelism, numerics, data processing, infrastructure for GPT-4 experiments, etc. Leo conducted most scaling and architecture experiments: Top K and Aux K, tied initialization, number of latents, subjec... |
README.md exists but content is empty.
- Downloads last month
- 7