Sparse autoencoders recover planted features
Runs in your browser
Survey: §6.2 Sparse Autoencoders · §6.3 SAE Variants and Architectural Improvements
On real models we can’t check an SAE against the true features, because nobody knows what they are. Here we can. We plant 16 known feature directions in 8 dimensions (so they are in superposition), generate sparse data, train an SAE, and measure how closely its dictionary matches the planted features.
Data: 16 planted features in 8 dimensions, each active with probability 0.1. Dictionary: 32 latents.
Trained. Metrics come from 2,000 held-out samples.
What is being computed
Data: x = Σi ai gi, where the gi are 16 random unit vectors in ℝ⁸ and each ai is 0 with probability 0.9, otherwise Uniform[0, 1]. SAE: f = ReLU(We(x − bd) + be), x̂ = Wdf + bd, with 32 latents and unit-norm decoder columns. The loss is ‖x − x̂‖² + λ‖f‖₁, or the TopK variant, which keeps the k largest activations. Training is Adam (learning rate 0.003, batch 256) for 2,000 steps. MMCS (mean max cosine similarity) averages, over planted features, the best cosine with any decoder column. A feature counts as recovered when that cosine exceeds 0.9.
Checked results (seed 1, tested in tests/sim.test.ts): with λ = 0 the SAE reconstructs almost perfectly but recovers 0 of 16 features (MMCS ≈ 0.69). With λ = 0.3 it recovers all 16 (MMCS ≈ 0.97) at about 13% variance unexplained. With λ = 1 reconstruction degrades to about 60% variance unexplained. Sparsity is what makes the dictionary line up with the true features, and too much sparsity costs reconstruction.
An idealised setting: real activations need not have a sparse linear ground truth.
Go further
- Methods explorer: Sparse Autoencoders (SAEs)
- Methods explorer: Top-k SAEs
- Notebook: Sparse Autoencoders: Variants and Implementations · Open in Colab
References
- Trenton Bricken, Adly Templeton, Joshua Batson, Brian Chen, Adam Jermyn, Tom Conerly, Nick Turner, Cem Anil, Carson Denison, Amanda Askell, Robert Lasenby, Yifan Wu, Shauna Kravec, Nicholas Schiefer, Tim Maxwell, Nicholas Joseph, Zac Hatfield-Dodds, Alex Tamkin, Karina Nguyen, Brayden McLean, Josiah E Burke, Tristan Hume, Shan Carter, Tom Henighan, and Christopher Olah. Towards monosemanticity: Decomposing language models with dictionary learning. Transformer Circuits Thread, 2023. https://transformer-circuits.pub/2023/monosemantic-features/index.html.
- Leo Gao, Tom Dupre la Tour, Henk Tillman, Gabriel Goh, Rajan Troll, Alec Radford, Ilya Sutskever, Jan Leike, and Jeffrey Wu. Scaling and evaluating sparse autoencoders. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=tcsZt9ZNKD.