Mechanistic Interpretability, Superposition, Sparse Autoencoders (SAEs), Causal Tracing (ROME/MEMIT), and Representation Engineering (RepE) in 2026: QK/OV Circuits, Induction Heads, TopK & JumpReLU Dictionary Learning, and Linear Artificial Tomography

How do researchers and AI systems engineers reverse-engineer the internal weights and hidden states of billion-parameter Transformer language models from opaque floating-point tensors into factored Query-Key (QK) and Output-Value (OV) skip-trigram circuits and two-layer Induction Heads that abruptly form during a 2.5B-to-5B token training phase change (Elhage et al. 2021, Olsson et al. 2022), mathematically resolve why networks pack $n \gg m$ sparse features into $m$-dimensional polysemantic neurons via almost-orthogonal uniform polytope superposition (Elhage et al. 2022), decompose middle-layer residual streams into 33,554,432 (~34M) monosemantic dictionary features on Claude 3 Sonnet (Templeton et al. 2024), 16,000,000 (16M) TopK latents on GPT-4 with just 7% dead latents (Gao et al. 2024), and >2,000 open JumpReLU Gemma Scope autoencoders (Lieberum et al. 2024), surgically rewrite 10,000 factual associations simultaneously inside mid-layer MLP associative memories at 98.9% CounterFact efficacy (ROME & MEMIT, Meng et al.), and extract population-level truthfulness and honesty directions via Linear Artificial Tomography (LAT) and LoRRA to boost TruthfulQA accuracy by +18.1 percentage points (RepE, Zou et al.)?

As foundation language models scale to hundreds of layers and trillions of parameters, treating neural networks as black-box conditional token predictors creates a severe reliability and safety bottleneck. Even years after a frontier model is deployed, operators and users routinely discover emergent capabilities and failure modes—such as deceptive alignment, sycophancy, imitative falsehoods, or subtle security backdoors—that cannot be diagnosed from surface outputs alone (https://transformer-circuits.pub/2021/framework/index.html, https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html). However, attempting to read individual neurons directly inside a Transformer encounters three foundational mathematical barriers:

  1. Residual Stream Bottlenecks and Factored Multi-Layer Composition (Elhage et al. 2021): In a standard decoder-only Transformer, the residual stream functions as a shared linear communication bus without a privileged basis (https://transformer-circuits.pub/2021/framework/index.html). Because a single MLP block typically contains $4\times$ more neurons than the residual stream has dimensions ($d_{\text{MLP}} = 4 d_{\text{model}}$), at layer 25 of a 50-layer Transformer, $100\times$ more upstream computational neurons must communicate with $100\times$ more downstream neurons through a single narrow residual vector space—forcing layers to multiplex information across overlapping linear subspaces and low-rank virtual weights $W_I^{(l_2)} W_O^{(l_1)}$.
  2. Polysemanticity and Cross-Entropy Feature Superposition (arXiv:2209.10652, Bricken et al. 2023): Inspecting individual MLP neurons rarely reveals clean, single-concept detectors. In InceptionV1, single vision neurons fire on mixtures of cat faces and car fronts; in a 1-layer Transformer trained on 100 billion tokens of The Pile, a single MLP neuron responds simultaneously to academic citations, English dialogue, HTTP requests, and Korean text (https://transformer-circuits.pub/2023/monosemantic-features/index.html). Worse, Anthropic proved mathematically that enforcing architectural activation sparsity—even up to strict 1-hot neuron activations—cannot eliminate polysemanticity under cross-entropy loss: a single binary neuron trained on 4 mutually exclusive next-token features ($A, B, C, D$) achieves a cross-entropy loss of $\frac{3}{4}\ln 3 \approx 0.8$ if it stays monosemantic on feature $A$, whereas firing polysemantically on both $A$ and $B$ reduces cross-entropy loss to $\ln 2 \approx 0.7$ (https://transformer-circuits.pub/2023/monosemantic-features/index.html).
  3. L1 Activation Shrinkage, Dead Latents, and Single-Edit Weight Bleedover (arXiv:2406.04093v1, arXiv:2210.07229v2): When training overcomplete Sparse Autoencoders (SAEs) with an $L_1$ sparsity penalty $\lambda \|z\|_1$, the Lasso penalty systematically shrinks all positive feature activations toward zero, while unmitigated wide SAEs suffer 65% to 90% dead latents (features that never fire over $10^7$ tokens; https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html, https://arxiv.org/html/2406.04093v1). Similarly, when directly editing factual weights in a single Transformer MLP layer (ROME), sequential rank-one updates hold up to $n = 10$ facts but suffer catastrophic interference above $n = 32$, collapsing zsRE specificity to 0.9% at $10,000$ edits unless the residual update is distributed analytically across all critical mediating MLP layers (MEMIT, https://arxiv.org/html/2210.07229v2).

Between 2021 and 2026, seven landmark research programs transformed the reverse-engineering, dictionary decomposition, causal weight editing, and population-level steering of Transformer language models into an exact mathematical discipline:

  1. The Mathematical Framework for Transformer Circuits & Induction Head Phase Changes (Elhage et al. 2021, Olsson et al. 2022, arXiv:2209.11895): Reformulating each attention head $h$ as a Kronecker tensor product $A^h \otimes W_{OV}^h$ with separable low-rank Query-Key (QK) circuits ($W_E^T W_{QK}^h W_E$, governing where to move information) and Output-Value (OV) circuits ($W_U W_{OV}^h W_E$, governing what information is read and written to logits), and classifying two-layer head interactions into Q-Composition, K-Composition, and V-Composition (https://transformer-circuits.pub/2021/framework/index.html). Across 34 Transformers and >50,000 attention head ablations, Olsson et al. demonstrated that K-composed Induction Heads (completing [A][B] ... [A] -> [B] and analogical [A*][B*] ... [A] -> [B]) form abruptly during an early macroscopic phase change between 2.5 billion and 5 billion training tokens ($1\%\text{–}2\%$ of full training), simultaneously driving the model's in-context learning score ($\mathcal{L}{500} - \mathcal{L}{50}$) from $<0.15\text{ nats}$ to $\sim 0.4\text{ nats}$ (accounting for $>75\%$ of final in-context learning; https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html).
  2. Toy Models of Superposition & Uniform Polytope Geometry (Elhage et al. 2022, arXiv:2209.10652): Proving that while a linear autoencoder $x' = W^T W x + b$ can never represent more than $m$ orthogonal features in $\mathbb{R}^m$ (performing PCA), adding a single output nonlinearity $x' = \operatorname{ReLU}(W^T W x + b)$ unlocks a discontinuous phase change into superposition as feature sparsity $S = \Pr(x_i = 0) \to 1$. Because negative bias $b_i < 0$ and $\operatorname{ReLU}$ filter out small positive and all negative interference terms in the 1-sparse loss $(1-S)S^{n-1}L_1$, networks pack $n \gg m$ features into Thomson-problem uniform polytopes—antipodal digons ($W = [1, -1]$), triangles, pentagons, and tetrahedrons—and even execute non-linear circuits (such as absolute value $y = |x|$) directly in superposition (https://transformer-circuits.pub/2022/toy_model/index.html).
  3. Monosemantic Dictionary Learning & Scaling SAEs to Claude 3 Sonnet (Bricken et al. 2023, Templeton et al. 2024): Decomposing a 1-layer Transformer's 512-neuron ReLU MLP across 8 billion activation samples into overcomplete Sparse Autoencoders ranging from $1\times$ (512 features) to $256\times$ (131,072 features, with detailed circuit analysis on $8\times$ run A/1 at 4,096 features)—uncovering monosemantic features for Arabic script, DNA sequences, Base64, Hebrew script (completely invisible in top neuron activations), and HTML finite-state automata (https://transformer-circuits.pub/2023/monosemantic-features/index.html). In May 2024, Anthropic scaled middle-layer residual stream SAEs to production Claude 3 Sonnet at 1,048,576 (~1M), 4,194,304 (~4M), and 33,554,432 (~34M) features ($\lambda_{L_1} = 5$, $<300$ active features per token, explaining $\ge 65\%$ of activation variance), extracting multilingual, multimodal, and safety-critical features (Golden Gate Bridge, code buffer overflows, sycophancy, deception, and bioweapons) capable of causally steering model behavior (https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html).
  4. TopK, Multi-TopK, and JumpReLU Sparse Autoencoders on GPT-4 & Gemma Scope (Gao et al. 2024, arXiv:2406.04093v1; Lieberum et al. 2024, arXiv:2408.05147v1): Replacing $L_1$-regularized ReLU encoders with $k$-sparse TopK activation functions $z = \operatorname{TopK}(W_{\text{enc}}(x - b_{\text{pre}}))$ to eliminate $L_1$ activation shrinkage, and combining $W_{\text{enc}} = W_{\text{dec}}^T$ initialization with an AuxK top-$k_{\text{aux}}$ dead-latent auxiliary reconstruction loss to slash dead latents from up to 90% down to just 7% in a 16 million (16M) latent SAE trained on GPT-4 (layer $5/6$) for 40 billion tokens (achieving 98.2% zero-ablation fidelity, downstream loss matching 10% of GPT-4 pretraining compute, $>1.5\times$ N2G recall, and 10%–14% $(L_1/L_2)^2$ logit ablation sparsity vs. 60% for raw residual channels; https://arxiv.org/html/2406.04093v1). Complementing TopK, Google DeepMind's Gemma Scope trained >400 main JumpReLU SAEs (>2,000 SAEs across $L_0$ targets, >30M learned features, widths $2^{14} \approx 16.4\text{K}$ to $2^{20} \approx 1\text{M}$) across every layer and sub-layer of Gemma 2 2B (26 layers) and 9B (42 layers) plus layers {10, 22, 34} of Gemma 2 27B using straight-through estimators (STE, bandwidth $\varepsilon = 0.001$) over ~20 Pebibytes (PiB) of 32-bit activations at 50.8% MFU (45 ms/batch for 131K width on 8 TPUv3 chips) (https://arxiv.org/html/2408.05147v1).
  5. Causal Tracing and Rank-One Model Editing (ROME, Meng et al., arXiv:2202.05262v5, NeurIPS 2022): Introducing three-run Causal Mediation Analysis (Clean $\mathbb{P}[o]$, Corrupted $\mathbb{P}*[o]$ with subject embedding noise $\epsilon \sim \mathcal{N}(0, \nu)$ where $\nu = 3\sigma{\text{emp}}$, and Corrupted-with-Restoration $\mathbb{P}{, \text{clean } h_i^{(l)}}[o]$) across 1,000 factual prompts in GPT-2 XL (1.5B), revealing an Average Total Effect of $\text{ATE} = 18.6\%$ and proving that mid-layer MLP modules at the last token of the subject dominate factual recall (state $\text{AIE} = 8.7\%$ at layer 15; MLP $\text{AIE} = 6.6\%$ vs. Attention $\text{AIE} = 1.6\%$). Treating the second MLP weight matrix $W{\text{proj}}^{(l^)}$ as a linear associative memory $WK \approx V$, ROME inserts a new factual tuple $(s, r, o^)$ via the closed-form constrained least-squares rank-one update $\hat{W} = W + \Lambda (C^{-1} k_)^T$, achieving 99.8% Efficacy and 88.1% Paraphrase accuracy on zsRE and an aggregate CounterFact Score $S = 89.2$ on GPT-2 XL (100.0% ES, 96.4% PS, 75.4% NS) and $S = 91.5$ on GPT-J (6B) (99.9% ES, 99.1% PS, 78.9% NS) (https://arxiv.org/html/2202.05262v5).
  6. Mass-Editing Memory in a Transformer (MEMIT, Meng et al., arXiv:2210.07229v2, ICLR 2023): Scaling direct weight editing from single facts to 10,000 simultaneous memory updates by computing target hidden-state residuals $\delta_i = z_i - h_i^L$ at the top mediating layer $L = \max(\mathcal{R})$ and spreading them evenly ($r_i^l = \frac{z_i - h_i^L}{L - l + 1}$) across the entire critical MLP path—$\mathcal{R} = \{3, 4, 5, 6, 7, 8\}$ ($\lambda = 15,000$) in GPT-J (6B) and $\mathcal{R} = \{6, 7, 8, 9, 10\}$ ($\lambda = 20,000$) in GPT-NeoX (20B)—via the block normal equation $\Delta^l = R^l (K^l)^T (C_0^l + K^l (K^l)^T)^{-1}$. At 10,000 simultaneous edits, MEMIT achieves Score $S = 50.7$ on zsRE (96.7% Efficacy, 89.7% Paraphrase, 26.6% Specificity vs. ROME 2.6 / 0.9% specificity) and Score $S = 85.8$ on CounterFact (98.9% ES, 88.6% PS, 73.7% NS, 619.9 Fluency GE) on GPT-J (6B) plus $S = 82.0$ (97.2% ES, 82.2% PS, 70.8% NS) on GPT-NeoX (20B) (https://arxiv.org/html/2210.07229v2).
  7. Representation Engineering (RepE), Linear Artificial Tomography (LAT), and LoRRA (Zou et al., arXiv:2310.01405v4): Shifting from bottom-up Sherringtonian node-to-node circuits to top-down Hopfieldian population representations by applying Linear Artificial Tomography (LAT)—extracting the first principal component (PCA) of paired contrastive neural activity differences $(-1)^i (A_f^{+(i)} - A_f^{-(i)})$ at the [-1] token position across just 5 to 128 unlabeled stimuli. Unsupervised LAT boosts average TruthfulQA MC1 accuracy across LLaMA-2-Chat (7B/13B/70B) from 32.3% standard zero-shot (29.9% on 70B) to 60.7% (69.8% on 70B), detects intentional lying and hallucinations across the middle 20 layers with $>90\%$ classification accuracy, and steers generation via Contrast Vectors and Low-Rank Representation Adaptation (LoRRA) to raise LLaMA-2-Chat-13B TruthfulQA MC1 zero-shot generation accuracy from 35.9% to 54.0% (+18.1 percentage points) (https://arxiv.org/html/2310.01405v4).
📌 Key Takeaways & Empirical Mechanistic Interpretability / SAE / Model Editing Benchmarks
  • ✓Factored QK/OV Circuits & Induction Head Phase Change (Elhage et al. 2021, arXiv:2209.11895): Rewriting attention heads as $A^h \otimes W_{OV}^h$ separates the $50,000 \times 50,000$ rank-$d_{\text{head}}$ (64 or 128) QK circuit ($W_E^T W_{QK}^h W_E$) and OV circuit ($W_U W_{OV}^h W_E$, 10/12 copying heads via positive eigenvalues). Across 34 models and >50,000 head ablations, K-composed Induction Heads form abruptly between 2.5B and 5B tokens (1–2% of training), jumping in-context learning ($\mathcal{L}_{500} - \mathcal{L}_{50}$) from <0.15 nats to ~0.4 nats (>75% of final ICL).
  • ✓Superposition Phase Diagrams & Polysemanticity Lower Bounds (arXiv:2209.10652, Bricken et al. 2023): While linear models $W^T W x$ learn only the top-$m$ orthogonal features, $\operatorname{ReLU}(W^T W x + b)$ exhibits a discontinuous phase change as sparsity $S \to 1$, packing $n \gg m$ features into antipodal pairs, pentagons, and tetrahedrons. Even without superposition, cross-entropy loss forces a 1-hot binary neuron on 4 features to prefer 2-feature polysemanticity ($\ln 2 \approx 0.7$) over monosemanticity ($\frac{3}{4}\ln 3 \approx 0.8$), whereas post-hoc MSE Sparse Autoencoders expand 512 neurons up to 131,072 ($256\times$) features over 8B activations.
  • ✓Scaling Monosemanticity to 34M Features on Claude 3 Sonnet (Templeton et al. 2024): Middle-layer residual stream SAEs trained at 1,048,576 (~1M), 4,194,304 (~4M), and 33,554,432 (~34M) features ($\lambda_{L_1}=5$) activate <300 features per token and explain ≥65% of activation variance (with dead feature proportions of 2% at 1M, 35% at 4M, and 65% at 34M over $10^7$ tokens), isolating abstract multilingual/multimodal and safety-relevant features (deception, sycophancy, security vulnerabilities).
  • ✓OpenAI 16M TopK SAE on GPT-4 & Google DeepMind Gemma Scope JumpReLU (arXiv:2406.04093v1, arXiv:2408.05147v1): TopK activation eliminates $L_1$ shrinkage, while $W_{\text{enc}} = W_{\text{dec}}^T$ init + AuxK dead-latent loss cuts dead latents from up to 90% down to 7% on a 16M-latent GPT-4 SAE (40B tokens, 98.2% zero-ablation fidelity, 10% GPT-4 compute equivalent, 10–14% $(L_1/L_2)^2$ logit diff sparsity vs. 60% residual channels). Gemma Scope releases >2,000 JumpReLU SAEs (>400 main, >30M features, ~20 PiB activations, >20% GPT-3 compute, 50.8% MFU / 45ms step on 8 TPUv3) across all layers of Gemma 2 2B/9B and select 27B layers.
  • ✓ROME Causal Tracing & MEMIT 10,000-Fact Batch Editing (arXiv:2202.05262v5, arXiv:2210.07229v2): Causal Tracing on GPT-2 XL ($\text{ATE}=18.6\%$) localizes factual recall to mid-layer MLPs at the last subject token (state $\text{AIE}=8.7\%$ at layer 15; MLP $\text{AIE}=6.6\%$ vs. Attn $1.6\%$). Single-edit ROME hits $S=89.2$ on GPT-2 XL and $S=91.5$ on GPT-J on CounterFact (21,919 records), while multi-layer MEMIT ($\mathcal{R}=\{3..8\}$ on GPT-J, $\{6..10\}$ on GPT-NeoX 20B) edits 10,000 memories simultaneously at $S=85.8$ (98.9% ES, 88.6% PS, 73.7% NS) on GPT-J and $S=82.0$ on GPT-NeoX 20B.
  • ✓Representation Engineering (RepE), LAT & LoRRA Control (arXiv:2310.01405v4): Unsupervised PCA reading vectors from Linear Artificial Tomography (LAT) boost LLaMA-2-Chat average TruthfulQA MC1 accuracy from 32.3% to 60.7% (29.9% → 69.8% on 70B) and detect lies at >90% accuracy, while Contrast Vectors and LoRRA boost zero-shot generation on TruthfulQA MC1 from 31.0% to 47.9% / 42.3% (7B-Chat) and from 35.9% to 54.0% (+18.1 pts) / 47.5% (13B-Chat).
34M & 16M Latents
Claude 3 Sonnet & GPT-4 SAEs

Anthropic 34M ReLU SAE (<300 active, ≥65% var explained) and OpenAI 16M TopK SAE on GPT-4 (40B tokens, only 7% dead latents, 98.2% zero-ablation fidelity).

>2,000 JumpReLU SAEs
Gemma Scope Open Suite

>30M latents across all layers/sublayers of Gemma 2 2B & 9B + 27B over ~20 PiB of 32-bit activations at 50.8% TPUv3 MFU (arXiv:2408.05147v1).

10,000 Edits @ 98.9%
ROME & MEMIT MLP Editing

ROME single-edit hits S=91.5 on GPT-J; MEMIT spreads updates over layers {3..8} to edit 10k CounterFact memories at S=85.8 (98.9% ES, arXiv:2210.07229v2).

+18.1 pts TruthfulQA
RepE LAT & Contrast/LoRRA

LAT reading raises LLaMA-2-70B TruthfulQA MC1 from 29.9% to 69.8%; Contrast Vectors & LoRRA raise 13B-Chat generation from 35.9% to 54.0% (arXiv:2310.01405v4).


1. The Mathematical Framework for Transformer Circuits: Residual Stream Bandwidth, Factored QK/OV Matrices, Q/K/V Composition, and the Induction Head Phase Change (Elhage et al. 2021, Olsson et al., arXiv:2209.11895)

In A Mathematical Framework for Transformer Circuits (Elhage, Nanda, Olsson et al., Anthropic, Dec 22, 2021; https://transformer-circuits.pub/2021/framework/index.html), the authors observed that standard deep learning equations write multi-head attention by concatenating head outputs $[r^{h_1}; r^{h_2}; \dots]$ and multiplying by a block output matrix $W_O^H$ for GPU GEMM efficiency—obscuring the underlying algebraic structure of the network. By rewriting Transformer computation into a mathematically identical sum of independent end-to-end linear and multilinear path operators, small attention-only Transformers can be reverse-engineered directly from their static weight matrices without running a forward pass.

Full Transformer neural network architecture illustrating token embeddings, residual stream skip connections, multi-head attention, and feed-forward layers

Full Transformer neural network architecture illustrating token embeddings, residual stream skip connections, multi-head attention, and feed-forward layers

1. The Residual Stream as a High-Demand Linear Communication Channel

In an autoregressive decoder-only Transformer, the residual stream $x_l \in \mathbb{R}^{n_{\text{context}} \times d_{\text{model}}}$ is simply the additive sum of the original token embedding $W_E t$ and the outputs of all preceding attention heads and MLP layers (https://transformer-circuits.pub/2021/framework/index.html): $$x_l = x_0 + \sum_{k=1}^{l} \sum_{h \in H_k} h(x_{k-1}) + \sum_{k=1}^{l} m_k(x_{k-1})$$ Unlike ResNets in computer vision—which often apply ReLU nonlinearities directly along the residual trunk—the Transformer residual stream is completely linear (up to LayerNorm scaling, which can be folded into adjacent weight matrices as an affine transformation). This yields three structural properties:

  1. Absence of a Privileged Basis: Rotating the residual stream by any invertible matrix $M$ while rotating all read/write matrices by $M^{-1}$ produces a functionally identical Transformer. Therefore, individual coordinate axes of the residual stream have no special meaning (https://transformer-circuits.pub/2021/framework/index.html).
  2. Implicit Virtual Weights ($W_I^{(l_2)} W_O^{(l_1)}$): Because every layer reads from the residual stream via a linear projection $W_I$ and writes back via an additive linear projection $W_O$, any upstream component $l_1$ and downstream component $l_2$ (even separated by dozens of intermediate layers) are connected by an implicit virtual weight matrix $W_I^{(l_2)} W_O^{(l_1)}$ that measures how strongly layer $l_2$ reads the subspace written by layer $l_1$.
  3. Subspace Bandwidth Starvation and Memory Deletion: Every single MLP layer typically contains $4\times$ more neurons than the residual stream has dimensions ($d_{\text{MLP}} = 4 d_{\text{model}}$), while each attention head operates on a low-rank subspace of dimension $d_{\text{head}}$ (typically $64$ or $128$, so $d_{\text{head}} / d_{\text{model}} \approx 1/10$ to $1/100$). Consequently, at layer 25 of a 50-layer Transformer, $100\times$ more upstream neurons than residual dimensions are attempting to communicate with $100\times$ more downstream neurons through a single $d_{\text{model}}$-dimensional bottleneck (https://transformer-circuits.pub/2021/framework/index.html). To manage this bandwidth contention, specific MLP neurons (exhibiting strongly negative cosine similarity between their input and output weights) and self-attending heads (exhibiting large negative eigenvalues in $W_{OV}$) act as "memory management" deletion operators that read a residual subspace and write back its negation to free capacity.

2. Tensor Product Formulation of Attention Heads and Factored QK / OV Circuits

By splitting the concatenated attention output matrix $W_O^H = [W_O^{h_1}, W_O^{h_2}, \dots]$ into per-head blocks, the layer output equals the sum of independent heads: $W_O^H [r^{h_1}; r^{h_2}; \dots] = \sum_{h \in H} W_O^h r^h$. Expressing each attention head $h$ as a linear map on matrices $[n_{\text{context}}, d_{\text{model}}] \to [n_{\text{context}}, d_{\text{model}}]$ using the Kronecker mixed-product property $(\operatorname{Id} \otimes W_O^h) \cdot (A^h \otimes \operatorname{Id}) \cdot (\operatorname{Id} \otimes W_V^h) x$ collapses the head into a single $(2,2)$-tensor operator (https://transformer-circuits.pub/2021/framework/index.html): $$h(x) = \big(A^h \otimes W_{OV}^h\big) \cdot x, \qquad A^h = \operatorname{softmax}^*\!\big(x^T W_{QK}^h x\big)$$ where $W_{OV}^h := W_O^h W_V^h \in \mathbb{R}^{d_{\text{model}} \times d_{\text{model}}}$ and $W_{QK}^h := (W_Q^h)^T W_K^h \in \mathbb{R}^{d_{\text{model}} \times d_{\text{model}}}$ are low-rank matrices of rank at most $d_{\text{head}}$ ($64$ or $128$). Crucially, the intermediate key, query, and value vectors ($k_i, q_i, v_i \in \mathbb{R}^{d_{\text{head}}}$) are completely eliminated—revealing that each attention head performs two separable operations:

  • The Query-Key (QK) Circuit ($W_E^T W_{QK}^h W_E \in \mathbb{R}^{n_{\text{vocab}} \times n_{\text{vocab}}}$): Determines which source token position information is moved from and to. Each entry $(i, j)$ specifies how strongly query token $i$ wants to attend to key token $j$.
  • The Output-Value (OV) Circuit ($W_U W_{OV}^h W_E \in \mathbb{R}^{n_{\text{vocab}} \times n_{\text{vocab}}}$): Determines what information is read from the attended source token (via the right singular vectors $V$ of $W_{OV} = U S V^T$) and how it is written to the destination token's output logits (via the left singular vectors $U$). If the attention pattern $A^h$ is frozen, the entire attention head is a pure linear operator (https://transformer-circuits.pub/2021/framework/index.html).

Applying the Path Expansion Trick to 0-layer, 1-layer, and 2-layer attention-only Transformers yields an exact taxonomy of end-to-end paths from one-hot input tokens $t$ to output logits $T$:

Transformer Depth & Path TermExpanded Mathematical Operator ($t \mapsto \text{Logits}$)Functional Role & Empirical Discovery (https://transformer-circuits.pub/2021/framework/index.html)
0-Layer / Direct Path$T_{\text{direct}} = (\operatorname{Id} \otimes W_U W_E) \cdot t$Approximates bigram log-likelihood statistics (e.g., "Barack" $\to$ "Obama"). Note $W_U \neq W_E^{-1}$.
1-Layer Individual Head Paths$T_{1\text{-layer}} = \Big(\operatorname{Id} \otimes W_U W_E + \sum_{h \in H_1} A^h \otimes (W_U W_{OV}^h W_E)\Big) \cdot t$Ensemble of bigram + skip-trigram ([source]... [destination][out]) tables of size $50,000 \times 50,000$ (2.5B entries, rank 64 or 128). 10 out of 12 heads in the 1-layer model exhibit positive $W_U W_{OV}^h W_E$ eigenvalues implementing token copying; factored form causes skip-trigram cross-term "bugs" (keep... in mind + keep... at bay $\implies$ keep... in bay).
2-Layer Virtual Heads (V-Composition)$T_{2\text{-layer}} = \Big(\operatorname{Id} \otimes W_U W_E + \sum_{h \in H_1 \cup H_2} A^h \otimes W_U W_{OV}^h W_E + \sum_{h_2 \in H_2} \sum_{h_1 \in H_1} (A^{h_2} A^{h_1}) \otimes (W_U W_{OV}^{h_2} W_{OV}^{h_1} W_E)\Big) \cdot t$Q-Composition ($W_Q^{h_2}$ reads $W_O^{h_1}$), K-Composition ($W_K^{h_2}$ reads $W_O^{h_1}$), and V-Composition ($W_V^{h_2}$ reads $W_O^{h_1}$ creating virtual heads $A^{h_2} A^{h_1} \otimes W_{OV}^{h_2} W_{OV}^{h_1}$). K-Composition between a Layer-1 previous-token head and a Layer-2 head creates Induction Heads.

3. Induction Heads and the 2.5B–5B Token Macroscopic Phase Change (Olsson et al. 2022, arXiv:2209.11895)

Why can a 2-layer attention-only Transformer perform general in-context learning (ICL) on out-of-distribution random token sequences while a 1-layer Transformer cannot? In In-Context Learning and Induction Heads (arXiv:2209.11895, https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html), Catherine Olsson, Nelson Elhage, Neel Nanda, and colleagues analyzed 34 Transformer models across training checkpoints and executed more than 50,000 attention head ablations to prove that Induction Heads are the primary mechanistic engine of in-context learning.

Mechanically, an Induction Head circuit requires two composed attention layers:

  1. Layer-1 Previous-Token Head ($h_1$): Uses positional attention to attend from token index $i$ (token [B]) back to index $i-1$ (token [A]), copying the identity of the preceding token [A] into a dedicated subspace of [B]'s residual stream via $W_{OV}^{h_1}$.
  2. Layer-2 Induction Head ($h_2$ via K-Composition): When a second instance of [A] arrives later in the sequence, head $h_2$ projects the current token [A] into a query $q = W_Q^{h_2} x_{[A]}$ and matches it against keys computed from the subspace written by $h_1$ ($k = W_K^{h_2} W_{OV}^{h_1} x_{[A]}$)—attending directly to the token [B] that followed [A] earlier in the context (Prefix Matching) and copying [B] into the output logits via a positive-eigenvalue $W_{OV}^{h_2}$ (Copying), completing [A][B] ... [A] -> [B] (https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html).

Defining the macroscopic In-Context Learning Score as the loss at the 500th token minus the average loss at the 50th token ($\text{ICL Score} = \mathcal{L}{500} - \mathcal{L}{50}$), Olsson et al. established six converging lines of causal and correlational evidence across model scales:

  • Abrupt Co-Emergence During the 2.5B–5B Token Phase Change (Argument 1): Across multi-layer models of every size, in-context learning does not develop gradually. Prior to 2.5 billion training tokens, the ICL capacity is $<0.15\text{ nats}$. Inside a narrow window between $2.5 \times 10^9$ and $5 \times 10^9$ tokens (roughly $1\%\text{–}2\%$ of total training for large models), the training loss curve exhibits its only non-convex macroscopic "bump", PCA trajectories over 10,000 per-token log-likelihoods sharply pivot, Induction Heads abruptly crystallize, and the ICL score jumps to $\sim 0.4\text{ nats}$—where it remains constant for the rest of training. Over 75% of final in-context learning forms inside this single phase-change window (https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html).
  • Architectural Co-Perturbation via Smeared Keys (Argument 2): Standard 1-layer Transformers never undergo the phase change, never form induction heads, and never exceed $<0.15\text{ nats}$ of ICL because key vectors in Layer 1 cannot depend on the preceding token. When Olsson et al. modified the architecture with a 1-parameter "smeared key" interpolation $k_j^h = \sigma(\alpha^h) k_j^h + (1 - \sigma(\alpha^h)) k_{j-1}^h$, 1-layer models immediately formed induction heads and underwent the ICL phase change, while deeper models shifted their phase change to an earlier point in training.
  • Direct Test-Time Knock-Out & Analogical Generalization (Arguments 3–6): Directly ablating induction heads at test time in small models eliminates the majority of in-context learning, while in larger models with MLPs, the exact same heads that perform literal random-sequence copying ([A][B] ... [A] -> [B]) generalize to fuzzy nearest-neighbor pattern completion ([A*][B*] ... [A] -> [B]), such as few-shot word-by-word translation across English, French, and German (https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html).

2. The Superposition Hypothesis, Privileged vs. Non-Privileged Bases, Phase Diagrams, and Uniform Polytope Geometry (Elhage et al., arXiv:2209.10652)

While attention head QK/OV circuits can be factored analytically, MLP layers contain dense non-linear coordinate spaces where individual neurons remain stubbornly polysemantic. In Toy Models of Superposition (Elhage, Hume, Olsson et al., Anthropic & Harvard, Sept 14, 2022, arXiv:2209.10652; https://transformer-circuits.pub/2022/toy_model/index.html), the authors provided the first rigorous mathematical demonstration of how and when neural networks pack $n$ sparse conceptual features into $m < n$ physical dimensions.

1. The Linear Representation Hypothesis and the Johnson-Lindenstrauss Orthogonality Gap

Elhage et al. characterize neural representations through a four-level hierarchy of structural properties (https://transformer-circuits.pub/2022/toy_model/index.html):

  1. Decomposability: Hidden state activations can be factored into independently understandable features whose semantic meaning does not depend on the values of other features.
  2. Linearity: Each feature $f_i$ corresponds to a direction vector $W_i \in \mathbb{R}^m$, so multiple simultaneously active features with scalar intensities $x_{f_1}, x_{f_2}, \dots$ are represented as the linear combination $\sum_i x_{f_i} W_{f_i}$.
  3. Superposition vs. Non-Superposition: A linear representation with feature matrix $W \in \mathbb{R}^{m \times n}$ exhibits superposition if and only if $W^T W$ is not invertible ($n > m$).
  4. Basis-Aligned (Privileged Basis): All feature directions $W_i$ are one-hot basis vectors aligned with physical neurons—which is only possible in layers where an element-wise activation function (such as $\operatorname{ReLU}$ or $\operatorname{GELU}$) breaks rotational symmetry to create a privileged basis.

Why is superposition mathematically possible when an $m$-dimensional space only admits $m$ mutually orthogonal vectors? By the Johnson-Lindenstrauss Lemma, while $\mathbb{R}^m$ supports at most $m$ exact orthogonal vectors ($\cos(\theta) = 0$), it supports $\mathcal{O}(\exp(m))$ "almost-orthogonal" vectors whose pairwise inner products satisfy $|W_i \cdot W_j| < \epsilon$. When natural world features are sparse ($x_i = 0$ with high probability $S_i \to 1$), two almost-orthogonal features rarely fire at the exact same token, and the small cross-talk interference $(W_i \cdot W_j) x_j$ can be stripped away by a negative bias $b_i < 0$ followed by a $\operatorname{ReLU}$ threshold—allowing an $m$-neuron network to noisily simulate a much larger $n$-neuron sparse network (https://transformer-circuits.pub/2022/toy_model/index.html).

2. Why Linear Models Never Exhibit Superposition vs. The ReLU 1-Sparse Thomson Problem

To prove why a non-linearity is mandatory for superposition, Elhage et al. compared two autoencoders reconstructing synthetic sparse vectors $x \in \mathbb{R}^n$ (where $x_i = 0$ with probability $S$, and $x_i \sim \operatorname{Uniform}(0, 1)$ with probability $1-S$, weighted by feature importance $I_i$) through a bottleneck $h = W x \in \mathbb{R}^m$ ($m \ll n$) under importance-weighted MSE loss $\mathcal{L} = \sum_x \sum_{i=1}^n I_i (x_i - x'_i)^2$:

$$\text{Linear Model: } x' = W^T W x + b \qquad \text{vs.} \qquad \text{ReLU Output Model: } x' = \operatorname{ReLU}\big(W^T W x + b\big)$$

  • The Linear Model Analytical Bound (Saxe et al. Decomposition): Expanding the expected loss of the linear model $x' = W^T W x$ yields a closed-form competition between Feature Benefit and $L^2$ Interference (https://transformer-circuits.pub/2022/toy_model/index.html): $$\mathcal{L}{\text{linear}} \propto \sum{i=1}^{n} I_i \big(1 - \|W_i\|^2\big)^2 + \sum_{i=1}^{n} \sum_{j \neq i} I_i \big(W_i \cdot W_j\big)^2$$ In a linear model, every non-orthogonal inner product $W_i \cdot W_j \neq 0$ injects unfiltered squared error on every active input, regardless of sparsity $S$. Solving $\nabla_W \mathcal{L}_{\text{linear}} = 0$ proves that superposition is never optimal in a linear model: the linear network always learns an orthogonal basis of the top-$m$ most important features ($\|W_i\| = 1$ for $i \le m$, and $\|W_i\| = 0$ for $i > m$), identical to Principal Component Analysis (PCA).
  • The ReLU Output Model Binomial Sparsity Expansion: For $x' = \operatorname{ReLU}(W^T W x + b)$, the integral over $x$ decomposes by the binomial expansion of $((1-S) + S)^n$ into $k$-sparse loss terms: $$\mathcal{L}{\text{ReLU}} = (1-S)^n L_n + \dots + (1-S) S^{n-1} L_1 + S^n L_0$$ As sparsity approaches $S \to 1$, the 0-sparse term $L_0 = \sum_i I_i \operatorname{ReLU}(b_i)^2$ (which simply penalizes positive biases) and the 1-sparse loss term $L_1$ dominate (https://transformer-circuits.pub/2022/toy_model/index.html): $$L_1 = \sum{i=1}^{n} \int_{0}^{1} \left[ I_i \Big(x_i - \operatorname{ReLU}\big(\|W_i\|^2 x_i + b_i\big)\Big)^2 + \sum_{j \neq i} I_j \, \operatorname{ReLU}\Big(\big(W_i \cdot W_j\big) x_i + b_j\Big)^2 \right] dx_i$$ This equation explains the physics of superposition: 1. Negative Interference is Free: Because $\operatorname{ReLU}(z) = 0$ for $z \le 0$, whenever two features have a negative inner product $W_i \cdot W_j < 0$ (such as an antipodal pair $W_j = -W_i$), activating feature $i$ pushes feature $j$ negative and produces zero interference cost in $L_1$! 2. Negative Biases Filter Positive Cross-Talk: Setting a small negative bias $b_j < 0$ absorbs small positive inner products $(W_i \cdot W_j) x_i < -b_j$, converting positive interference into zero-cost negative pre-activations. 3. Reduction to the Generalized Thomson Problem: When $N$ uniform-importance features have $\|W_i\| = 1$, minimizing the positive interference $\sum_{j \neq i} \operatorname{ReLU}(W_i \cdot W_j + b_j)^2$ is equivalent to packing repelling charges on the surface of an $m$-dimensional hypersphere (https://transformer-circuits.pub/2022/toy_model/index.html).

3. Discontinuous Phase Diagrams and Uniform Polytope Feature Geometry

When Elhage et al. trained toy models with $n = 20$ features in $m = 5$ dimensions ($I_i = 0.7^i$) and $n = 80$ features in $m = 20$ dimensions ($I_i = 0.9^i$), measuring the embedding norm $\|W_i\|$ and total interference $\sum_{j \neq i} (\hat{W}_i \cdot W_j)^2$, and isolated a 2-feature, 1-dimension ($m = 1$) phase diagram varying extra-feature importance $I_2 \in [0.1, 10]$ against feature density $1 - S \in [1.0, 0.01]$, they discovered a sharp first-order phase transition between three distinct weight regimes (https://transformer-circuits.pub/2022/toy_model/index.html):

Phase Regime / Polytope StructureWeight Configuration & Dimensionality Ratio (Features per Dim)Interference $\sum_{j \neq i} (\hat{W}_i \cdot W_j)^2$ & Geometric Condition (arXiv:2209.10652)
1. Orthogonal / Dedicated Dimension$W = [1, 0]$ or $W = [0, 1]$ ($1$ feature per dimension)Interference $= 0$ (Dark Blue): Occurs when features are dense ($1-S \to 1.0$) or one feature has overwhelming relative importance $I_1 \gg I_2$; extra features are unlearned ($\W_i\= 0$).
2. Antipodal Digon Superposition$W = [1, -1]$ in $\mathbb{R}^1$ ($2$ features per 1D subspace)Interference $= 1.0$ (Negative inner product $W_1 \cdot W_2 = -1$): First superposition phase as sparsity increases; zero 1-sparse interference cost under $\operatorname{ReLU}$, losing only the simultaneous $[1, 1]$ co-occurrence state.
3. Triangle & Pentagon (2D Tegum Subspaces)$3$ or $5$ features packed on a circle in $\mathbb{R}^2$ ($1.5$ or $2.5$ features/dim)Features organize into regular polygons where adjacent vectors have small positive dot products suppressed by $b_i < 0$ and non-adjacent vectors have free negative dot products.
4. Tetrahedron & Tegum Polytopes (3D+)$4$ features in $\mathbb{R}^3$ (Tetrahedron, $\cos\theta = -1/3$) or $6$ features in $\mathbb{R}^3$ (Octahedron)Uniform polytopes (where all vertices are symmetric) and tegum products (orthogonal direct sums of lower-dimensional polygons) dominate the learning dynamics across discrete "energy-level" loss jumps (https://transformer-circuits.pub/2022/toy_model/index.html).

3. Overcomplete Dictionary Learning & ReLU Sparse Autoencoders: Decomposing Polysemantic Neurons from 1-Layer MLPs to 34M-Latent Claude 3 Sonnet (Bricken et al. 2023, Templeton et al. 2024)

If Transformers use superposition to pack $F \gg D$ sparse conceptual features into a $D$-dimensional activation vector $\mathbf{x} \in \mathbb{R}^D$, how can we invert that rectangular projection to recover the true monosemantic units of computation?

Autoencoder neural network structure showing input encoding into a latent representation and linear decoding back to the reconstruction space

Autoencoder neural network structure showing input encoding into a latent representation and linear decoding back to the reconstruction space

1. Why Architectural Sparsity Fails Under Cross-Entropy Loss (Towards Monosemanticity)

In Towards Monosemanticity: Decomposing Language Models With Dictionary Learning (Bricken, Templeton, Batson et al., Anthropic, Oct 4, 2023; https://transformer-circuits.pub/2023/monosemantic-features/index.html), the team first tested whether modifying the Transformer architecture to force extreme activation sparsity during pre-training could prevent superposition and yield monosemantic neurons directly. Even when pushed to the theoretical limit—a 1-hot activation constraint where only a single neuron can fire at a time (making superposition mathematically impossible)—the resulting neurons remained polysemantic!

Bricken et al. proved this via an exact information-theoretic counterexample (https://transformer-circuits.pub/2023/monosemantic-features/index.html, Section Why not use architectural approaches?):

  • Consider a 1-neuron binary model ($f(x) \in \{0, 1\}$) trained on a dataset with 4 mutually exclusive equally probable features ($A, B, C, D$), each deterministically predicting a corresponding next token ($A, B, C, D$).
  • Case 1 (Monosemantic Neuron): The neuron fires ($f=1$) only on feature $A$, predicting token $A$ with zero loss ($\frac{1}{4} \cdot 0$), and stays silent ($f=0$) on features $B, C, D$, predicting a uniform $\frac{1}{3}$ distribution over $\{B, C, D\}$. The expected cross-entropy loss is: $$\mathcal{L}_{\text{monosemantic}} = \frac{1}{4}(0) + \frac{3}{4} \ln(3) \approx \mathbf{0.824\text{ nats } (\approx 0.8)}$$
  • Case 2 (Polysemantic Neuron without Superposition): The single binary neuron fires ($f=1$) on both features $A$ and $B$ (predicting a $\frac{1}{2}$ distribution over $\{A, B\}$) and stays silent ($f=0$) on $C$ and $D$ (predicting a $\frac{1}{2}$ distribution over $\{C, D\}$). The expected cross-entropy loss drops to: $$\mathcal{L}_{\text{polysemantic}} = \frac{1}{2} \ln(2) + \frac{1}{2} \ln(2) = \ln(2) \approx \mathbf{0.693\text{ nats } (\approx 0.7)}$$

Because $\ln 2 < \frac{3}{4} \ln 3$, cross-entropy language modeling loss actively incentivizes individual neurons to partition multiple unrelated features polysemantically rather than dedicating capacity to a single feature. By contrast, post-hoc Sparse Autoencoders (SAEs) are trained with Mean Squared Error (MSE) reconstruction loss on frozen activations, where an $L_1$ or $L_0$ sparsity penalty cleanly breaks symmetry in favor of monosemantic dictionary atoms (https://transformer-circuits.pub/2023/monosemantic-features/index.html).

2. ReLU Sparse Autoencoder Formulation and 1-Layer Transformer Decomposition (512 $\to$ 131,072 Features)

In Towards Monosemanticity, Bricken et al. took a 1-layer Transformer with a $d_{\text{MLP}} = 512$ ReLU MLP layer (trained on 100 billion tokens of The Pile) and trained 90 overcomplete Sparse Autoencoders across 8 billion MLP activation vectors with dictionary expansion factors ranging from $1\times$ (512 features) to $256\times$ (131,072 features), focusing their deepest circuit analysis on the $8\times$ run A/1 (4,096 features) (https://transformer-circuits.pub/2023/monosemantic-features/index.html): $$f_i(\mathbf{x}) = \operatorname{ReLU}\Big(\big(\mathbf{W}e (\mathbf{x} - \mathbf{b}_d) + \mathbf{b}_e\big)_i\Big), \qquad \hat{\mathbf{x}} = \mathbf{b}_d + \sum{i=1}^{F} f_i(\mathbf{x}) \, \mathbf{d}i$$ where $\mathbf{b}_d \in \mathbb{R}^{d{\text{MLP}}}$ is a tied pre-encoder/decoder bias, $\mathbf{W}e \in \mathbb{R}^{F \times d{\text{MLP}}}$ is the encoder matrix, and $\mathbf{d}i = (\mathbf{W}_d){\cdot, i}$ are unit-norm decoder feature directions ($\|\mathbf{d}_i\|_2 = 1$). Periodically resampling dead neurons—resetting encoder weights of features that stop firing to match high-loss training examples—enabled the 512-neuron MLP to resolve into tens of thousands of interpretable features, revealing four foundational phenomena:

  1. Features Invisible in the Neuron Basis: The SAE isolated a clean Hebrew script feature (alongside dedicated Arabic script, DNA sequence, and Base64 features) that did not appear in the top activating dataset examples of any of the 512 individual MLP neurons (https://transformer-circuits.pub/2023/monosemantic-features/index.html).
  2. Causal Pinning & Steering: Clamping (pinning) the Base64 feature or Arabic script feature to a high activation value causally forces the Transformer to switch its autoregressive output generation into valid Base64 strings or Arabic text.
  3. Multi-Resolution Feature Splitting: As dictionary width scales from 512 ($1\times$) to 4,096 ($8\times$, A/1) up to 131,072 ($256\times$), coarse features split into hierarchical families of finer sub-features (e.g., a single Base64 feature in a small dictionary splits into three distinct specialized Base64 features in a larger dictionary).
  4. Finite-State Automata (FSA) Feature Circuits: Features wire together across tokens via attention head $W_{OV}$ and MLP weights to form state machines—such as features that track open HTML tags (<tbody>, <) to deterministically predict <td> (https://transformer-circuits.pub/2023/monosemantic-features/index.html).

3. Scaling Monosemanticity to Claude 3 Sonnet (1M, 4M, and 34M Features, Templeton et al. 2024)

Eight months later, in Scaling Monosemanticity: Extracting Interpretable Features from Claude 3 Sonnet (Templeton, Conerly, Marcus et al., Anthropic, May 21, 2024; https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html), Anthropic scaled dictionary learning to the middle-layer residual stream of the live production Claude 3.0 Sonnet model (released March 4, 2024).

Why target the middle-layer residual stream rather than the MLP activation layer? First, the residual stream dimension $D$ is smaller than the MLP hidden dimension ($4D$), reducing SAE parameter count and FLOPs; second, decomposing the residual stream mitigates cross-layer superposition across parallel MLP blocks (https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html). After normalizing residual activations $\mathbf{x} \in \mathbb{R}^D$ so their average squared $L_2$ norm equals $D$ ($\mathbb{E}[\|\mathbf{x}\|2^2] = D$), Templeton et al. trained an unconstrained-norm decoder with decoder-norm-weighted $L_1$ regularization ($\lambda = 5$): $$\hat{\mathbf{x}} = \mathbf{b}^{\text{dec}} + \sum{i=1}^{F} f_i(\mathbf{x}) \, \mathbf{W}{\cdot, i}^{\text{dec}}, \qquad f_i(\mathbf{x}) = \operatorname{ReLU}\!\Big(\mathbf{W}{i, \cdot}^{\text{enc}} \cdot \mathbf{x} + b_i^{\text{enc}}\Big)$$ $$\mathcal{L}{\text{Sonnet}} = \mathbb{E}{\mathbf{x}}\!\left[ \big\|\mathbf{x} - \hat{\mathbf{x}}\big\|2^2 + \lambda \sum{i=1}^{F} f_i(\mathbf{x}) \cdot \big\|\mathbf{W}{\cdot, i}^{\text{dec}}\big\|_2 \right]$$ Multiplying $f_i(\mathbf{x})$ by $\|\mathbf{W}{\cdot, i}^{\text{dec}}\|2$ inside the $L_1$ penalty prevents the optimizer from cheating the sparsity penalty by shrinking $f_i(\mathbf{x}) \to 0$ while inflating $\|\mathbf{W}{\cdot, i}^{\text{dec}}\|2 \to \infty$, allowing the product $f_i(\mathbf{x}) \|\mathbf{W}{\cdot, i}^{\text{dec}}\|_2$ to serve directly as the canonical feature activation magnitude (https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html).

Claude 3 Sonnet SAE DictionaryTotal Learned Features ($F$)Average Active Features per Token ($L_0$)Activation Variance Explained ($R^2$)Dead Feature Proportion (Silent over $10^7$ Tokens)Key Emergent Capabilities & Safety Features (Templeton et al. 2024)
Sonnet 1M SAE1,048,576 (~1M)$< 300$$\ge 65\%$$\sim 2\%$High-frequency concepts, major geographic landmarks (Golden Gate Bridge), programming languages
Sonnet 4M SAE4,194,304 (~4M)$< 300$$\ge 65\%$$\sim 35\%$Finer feature splitting across scientific domains, function type signatures, multilingual concepts
Sonnet 34M SAE33,554,432 (~34M)$< 300$$\ge 65\%$$\sim 65\%$ ($\sim 12\text{M}$ alive)Compute-optimal scaling-law run resolving rare entities, code security vulnerabilities/backdoors, sycophancy, deception/power-seeking, and bioweapons

Crucially, Templeton et al. demonstrated that Claude 3 Sonnet features are multilingual and multimodal (a single Golden Gate Bridge feature fires on English, Japanese, and Russian text as well as photographs of the bridge) and causally steerable: clamping the Golden Gate Bridge feature to $10\times$ its maximum activation causes Claude 3 Sonnet to identify itself as the physical bridge in San Francisco, while clamping code-vulnerability or deception features directly controls whether the model inserts buffer overflows or conceals hidden objectives (https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html).


4. TopK, Multi-TopK, and JumpReLU Sparse Autoencoders: Eliminating L1 Activation Shrinkage, AuxK Dead-Latent Prevention, and Scaling Laws on GPT-4 & Gemma Scope (Gao et al. arXiv:2406.04093v1, Lieberum et al. arXiv:2408.05147v1)

While Anthropic's 34M-feature ReLU SAE on Claude 3 Sonnet proved that dictionary learning scales to frontier models, two severe optimization flaws remained in standard $L_1$-penalized ReLU autoencoders:

  1. $L_1$ Activation Shrinkage (Tibshirani 1996, Wright & Sharkey 2024): Because the gradient of $\lambda \|z\|_1$ applies a constant downward force $-\lambda$ to every active latent, all non-zero feature activations $z_i > 0$ are systematically underestimated, degrading reconstruction MSE and downstream language modeling cross-entropy (https://arxiv.org/html/2406.04093v1, Section 5.1).
  2. Catastrophic Dead Latents at Scale: In Templeton et al. (2024), 65% of the 34M SAE latents (22 million features, leaving only 12 million alive) died during training, and in OpenAI's unmitigated scaling ablations, up to 90% of latents died (failed to fire once in $10,000,000$ tokens), wasting the majority of GPU FLOPs (https://arxiv.org/html/2406.04093v1, Section 2.4).

1. OpenAI's TopK and Multi-TopK SAEs on GPT-4 (16M Latents, 40B Tokens, arXiv:2406.04093v1)

In Scaling and Evaluating Sparse Autoencoders (Gao, Dupré la Tour, Tillman et al., OpenAI Superalignment Interpretability Team, June 6, 2024, arXiv:2406.04093v1; https://arxiv.org/html/2406.04093v1), OpenAI replaced the $L_1$-regularized ReLU encoder with a $k$-sparse TopK activation function (Makhzani & Frey, 2013) that retains only the $k$ largest pre-activations per token and zeroes out all remaining $n - k$ latents: $$z = \operatorname{TopK}\!\Big(W_{\text{enc}}\big(x - b_{\text{pre}}\big)\Big), \qquad \hat{x} = W_{\text{dec}} z + b_{\text{pre}}, \qquad \mathcal{L}{\text{TopK}} = \big\|x - \hat{x}\big\|_2^2$$ where inputs $x \in \mathbb{R}^{d{\text{model}}}$ (extracted at layer 8, $\frac{3}{4}$ depth, in GPT-2 small and at $\frac{5}{6}$ depth in GPT-4, context length 64) are mean-subtracted and unit-norm normalized, and $b_{\text{pre}}$ is initialized to the geometric median of the dataset (https://arxiv.org/html/2406.04093v1, Section 2.1 & Appendix A.1).

Why does TopK dominate ReLU on the reconstruction-sparsity Pareto frontier?

  • Zero Activation Shrinkage &Exact $L_0 = k$ Control: Because $\mathcal{L}{\text{TopK}}$ contains no $L_1$ penalty term, active latents suffer zero shrinkage bias (verified via frozen-decoder projected gradient descent refinement in Section 5.1), while the sparsity $L_0 = k$ is set directly without sweeping $\lambda$. Furthermore, summing multiple TopK losses $\mathcal{L}{\text{Multi-TopK}} = \mathcal{L}(k) + \frac{1}{8}\mathcal{L}(4k)$ produces a smooth progressive code that generalizes across test-time $k'$ and JumpReLU thresholds (https://arxiv.org/html/2406.04093v1, Section 5.3.1).
  • Slashing Dead Latents to 7% via $W_{\text{enc}} = W_{\text{dec}}^T$ Initialization and AuxK Loss: To prevent latents from dying without ad-hoc periodic resampling, Gao et al. initialized encoder directions parallel to unit-norm decoder directions ($W_{\text{enc}} = W_{\text{dec}}^T$ at initialization, untied during training) and added an Auxiliary Loss (AuxK) that models the primary reconstruction residual $e = x - \hat{x}$ using the top-$k_{\text{aux}}$ dead latents: $\mathcal{L}{\text{total}} = \|x - \hat{x}\|_2^2 + \alpha{\text{aux}} \|e - \hat{e}_{\text{dead}}\|_2^2$. Even in OpenAI's largest 16 million (16M) latent SAE trained on GPT-4 for 40 billion tokens, only 7% of latents are dead (93% alive vs. 35% alive in Anthropic's 34M SAE; https://arxiv.org/html/2406.04093v1, Section 2.4).
  • Exact Joint Scaling Law $L(n, k)$ and Convergence Scaling: Across GPT-4 autoencoders, normalized reconstruction MSE follows an exact joint parametric scaling law with respect to latent count $n$ and active count $k$, plus an irreducible noise floor (https://arxiv.org/html/2406.04093v1, Equation 3): $$L(n, k) = \exp\!\Big(\alpha + \beta_k \log(k) + \beta_n \log(n) + \gamma \log(k)\log(n)\Big) + \exp\!\Big(\zeta + \eta \log(k)\Big)$$ with fitted GPT-4 constants $\alpha = -0.50$, $\beta_k = 0.26$, $\beta_n = -0.017$, $\gamma = -0.042$, $\zeta = -1.32$, and $\eta = -0.085$. Because the interaction term $\gamma = -0.042 < 0$ is negative, the scaling law with respect to latent width $n$ becomes steeper at larger $k$. Simultaneously, the maximum stable learning rate scales as $1 / \sqrt{n}$ (with the convergence-optimal learning rate $4\times$ smaller than the compute-frontier learning rate), and token budget to convergence scales sublinearly as $\Theta(n^{0.6})$ for GPT-2 small and $\Theta(n^{0.65})$ for GPT-4 (https://arxiv.org/html/2406.04093v1, Section 3.1.2).
  • Quantitative Feature Quality Metrics on GPT-4 & GPT-2 small: Substituting the 16M-latent TopK SAE into GPT-4's forward pass achieves a 98.2% zero-ablation fidelity score and a downstream language-modeling cross-entropy loss equivalent to 10% of the total pretraining compute of GPT-4 (https://arxiv.org/html/2406.04093v1, Section 4.1). Across 61 binary 1D logistic probe tasks, Neuron to Graph (N2G) wildcard explanations ($>1.5\times$ higher recall and $>0.9\times$ precision vs. ReLU), and downstream logit ablation sparsity $(L_1 / L_2)^2 / (V \cdot T)$ over $T = 16$ future tokens, TopK latents affect only 10%–14% of effective vocabulary tokens compared to 60% when ablating raw residual stream channels (near the $\sim 2/\pi \approx 63.7\%$ random Gaussian limit; https://arxiv.org/html/2406.04093v1, Section 4.5).

2. Google DeepMind's Gemma Scope and JumpReLU Sparse Autoencoders (arXiv:2408.05147v1)

While TopK eliminates $L_1$ shrinkage, forcing every single token—whether a simple punctuation mark or a dense technical noun—to activate exactly $k$ latents is suboptimal (https://arxiv.org/html/2406.04093v1, Section 6). In Gemma Scope: Open Sparse Autoencoders Everywhere All At Once on Gemma 2 (Lieberum, Rajamanoharan, Conmy et al. & Neel Nanda, Google DeepMind, Aug 9, 2024, arXiv:2408.05147v1; https://arxiv.org/html/2408.05147v1), DeepMind solved dynamic per-token sparsity by training and open-sourcing (CC-BY-4.0) JumpReLU Sparse Autoencoders across every layer and sub-layer of Gemma 2.

A JumpReLU SAE (Rajamanoharan et al., 2024b, arXiv:2407.14435) uses a per-latent learnable positive threshold vector $\boldsymbol{\theta} > 0$ (initialized to $\boldsymbol{\theta} = \{0.001\}^M$) inside a shifted Heaviside step gate $H(\mathbf{z} - \boldsymbol{\theta})$, trained directly with an $L_0$ sparsity penalty via Straight-Through Estimators (STE) with kernel density estimator (KDE) bandwidth $\varepsilon = 0.001$ (https://arxiv.org/html/2408.05147v1, Section 2.2, Equations 3–4): $$\mathbf{f}(\mathbf{x}) := \operatorname{JumpReLU}{\boldsymbol{\theta}}\!\big(\mathbf{W}{\text{enc}} \mathbf{x} + \mathbf{b}{\text{enc}}\big) = \big(\mathbf{W}{\text{enc}} \mathbf{x} + \mathbf{b}{\text{enc}}\big) \odot H\!\big(\mathbf{W}{\text{enc}} \mathbf{x} + \mathbf{b}{\text{enc}} - \boldsymbol{\theta}\big)$$ $$\mathcal{L}{\text{JumpReLU}} := \big\|\mathbf{x} - \big(\mathbf{W}{\text{dec}} \mathbf{f}(\mathbf{x}) + \mathbf{b}{\text{dec}}\big)\big\|2^2 + \lambda \big\|\mathbf{f}(\mathbf{x})\big\|_0$$ After training on scalar-normalized activations ($\mathbb{E}[\|\mathbf{x}\|_2^2] = 1$, where $\mathbf{x} = \mathbf{x}{\text{raw}} / C$) with pre-encoder bias subtraction ($\mathbf{x} - \mathbf{b}{\text{dec}}$), Gemma Scope folds $C$ and $\mathbf{b}{\text{dec}}$ directly into the inference parameters ($\mathbf{b}'{\text{enc}} = C \mathbf{b}{\text{enc}} - C \mathbf{W}{\text{enc}} \mathbf{b}{\text{dec}}$, $\mathbf{b}'{\text{dec}} = C \mathbf{b}{\text{dec}}$, $\boldsymbol{\theta}' = C \boldsymbol{\theta}$) so inference executes in two raw matrix multiplies without runtime normalization (https://arxiv.org/html/2408.05147v1, Appendix A, Equations 7–11).

Gemma Scope Model & Architecture TargetLayers & Sub-Layer Sites InstrumentedSAE Dictionary Widths ($M$) & Token BudgetsSystems Engineering, Storage & Compute Footprint (arXiv:2408.05147v1)
Gemma 2 2B PT (2.6B, 26 Layers)All 26 layers $\times$ 3 sites (Pre-$W_O$ Attention, Post-RMSNorm MLP, Post-MLP Residual) + MLP Transcoders$2^{14} \approx 16.4\text{K}$ (4B tokens), $2^{16} \approx 65.5\text{K}$ (8B tokens); Layer 12 splitting ladder $2^{14}\text{–}2^{19}$ (8B); Layers {5, 12, 19} at $2^{20} \approx 1\text{M}$ (16B tokens)Trained with Adam ($\beta_1=0, \beta_2=0.999$, $\eta = 7 \times 10^{-5}$, batch size 4,096, 1k LR warmup, 10k $\lambda$ warmup). Data parallelism for 16.4K width; Megatron tensor sharding for $\ge 32\text{K}$ widths.
Gemma 2 9B PT & IT (42 Layers)All 42 layers $\times$ 3 sites (PT) + Layers {9, 20, 31} Residual (9B IT)$2^{14} \approx 16.4\text{K}$ (4B tokens), $2^{17} \approx 131\text{K}$ (8B tokens); Layer 20 splitting ladder $2^{14}\text{–}2^{19}$ (8B); Layers {9, 20, 31} at $2^{20} \approx 1\text{M}$ (16B tokens)Storing 8B 32-bit activations for 1 site/layer of 9B takes 100 TiB (~17 PiB for 2B+9B, ~20 PiB total), streamed at >1 GiB/s via shared RAM buffer servers; 131K SAE processes 1 batch in 45 ms on 8 TPUv3 chips (50.8% MFU).
Gemma 2 27B PT (46 Layers)Select Residual Stream Layers {10, 22, 34}$2^{17} \approx 131,072$ latents (8B tokens)Suite totals >400 main SAEs (>2,000 SAEs across $L_0$ targets), >30 million learned latents, consuming >20% of GPT-3 pre-training compute on TPUv3 ($4\times 2$) and TPUv5p ($2\times 2\times 1$ / $2\times 2\times 4$).

5. Causal Tracing and Rank-One Model Editing (ROME): Localizing Factual Associations to Mid-Layer MLPs and Constrained Least-Squares Weight Updates (Meng et al., arXiv:2202.05262v5)

While Sparse Autoencoders decompose internal representations into passive feature dictionaries, where and how do autoregressive Transformers actually store and retrieve relational world facts $t = (s, r, o)$—such as $(s = \text{Space Needle}, r = \text{is in downtown}, o = \text{Seattle})$—and can we rewrite a specific factual memory directly inside the model's weights without damaging unrelated knowledge?

🎬 Technical Lecture & Author Walkthrough: ROME — Locating and Editing Factual Associations in GPT (Yannic Kilcher & Kevin Meng / David Bau, MIT CSAIL)

1. Three-Run Causal Mediation Analysis (Causal Tracing) in GPT-2 XL (1.5B)

In Locating and Editing Factual Associations in GPT (Meng, Bau, Andonian, Belinkov, MIT CSAIL, Northeastern & Technion, NeurIPS 2022, arXiv:2202.05262v5; https://arxiv.org/html/2202.05262v5, https://rome.baulab.info/), the authors treated the grid of hidden states $h_i^{(l)} = h_i^{(l-1)} + a_i^{(l)} + m_i^{(l)}$ across token indices $i \in [1, T]$ and layers $l \in [1, L]$ as a structural causal graph (Pearl, 2001/2009) and measured the Average Indirect Effect (AIE) of every hidden state, MLP output $m_i^{(l)} = W_{\text{proj}}^{(l)} \sigma(W_{\text{fc}}^{(l)} \gamma(a_i^{(l)} + h_i^{(l-1)}))$, and attention output $a_i^{(l)}$ across 1,000 factual statements:

  1. Clean Run ($\mathbb{P}[o]$): Pass the factual prompt $x$ through generator $G$ and record all clean activations $\{h_i^{(l)}\}$ and the probability $\mathbb{P}[o]$ of predicting the true object $o$.
  2. Baseline Corrupted Run ($\mathbb{P}*[o]$): Immediately after embedding the tokens, inject Gaussian noise $\epsilon \sim \mathcal{N}(0, \nu)$ into the initial embeddings $h_i^{(0)} := h_i^{(0)} + \epsilon$ of all subject entity tokens $i \in \text{subject}$, where the noise standard deviation $\nu = 3\sigma{\text{emp}}$ is set to $3\times$ the empirical standard deviation of token embeddings (https://arxiv.org/html/2202.05262v5, Section 2.1, Footnote 2). The Total Effect is $\text{TE} = \mathbb{P}[o] - \mathbb{P}_*[o]$.
  3. Corrupted-with-Restoration Run ($\mathbb{P}{, \text{clean } h{\hat{i}}^{(\hat{l})}}[o]$): Run the network on the corrupted subject embeddings, but surgically hook a single mediating state $h_{\hat{i}}^{(\hat{l})}$ (or a single MLP/Attention module) back to its clean activation from Run 1, measuring the Indirect Effect $\text{IE}(h_{\hat{i}}^{(\hat{l})}) = \mathbb{P}{, \text{clean } h{\hat{i}}^{(\hat{l})}}[o] - \mathbb{P}_*[o]$.

Across 1,000 factual prompts in GPT-2 XL (1.5B, 48 layers), the Average Total Effect (ATE) is $18.6\%$, and the causal trace uncovers a sharp two-site division of labor (https://arxiv.org/html/2202.05262v5, Section 2.2):

  • The Early Causal Site (Mid-Layer MLPs at the Last Subject Token): At the last token of the subject name, individual hidden states reach a peak Average Indirect Effect of $\text{AIE} = 8.7\%$ at layer 15. Decomposing by module proves that mid-layer MLP contributions dominate this early site at peak $\text{AIE} = 6.6\%$, whereas attention at the last subject token contributes only $\text{AIE} = 1.6\%$. Severing future MLP modules at the last subject token collapses the causal effect of lower layers, proving that mid-layer MLPs act as the primary key-value lookup engines that recall memorized attributes of the subject (https://arxiv.org/html/2202.05262v5, Figure 2 & Figure 3).
  • The Late Causal Site (High-Layer Attention at the Final Prompt Token): At the very last token of the prompt immediately preceding prediction, Attention modules dominate, reading the factual value vectors accumulated by mid-layer MLPs at the last subject token and copying them to the final prediction position.

2. Rank-One Model Editing (ROME): Closed-Form Associative Memory Lagrangian

Based on this Localized Factual Association Hypothesis, Meng et al. modeled the second projection matrix $W_{\text{proj}}^{(l^)} \in \mathbb{R}^{H \times D}$ of a single targeted middle-layer MLP ($l^ = 18$ or $17$ in GPT-2 XL, $l^* = 5$ in GPT-J) as a linear associative memory (Kohonen 1972, Anderson 1972) mapping a matrix of subject lookup keys $K = [k_1 \mid k_2 \mid \dots]$ to a matrix of factual property values $V = [v_1 \mid v_2 \mid \dots]$ via $W K \approx V$ (https://arxiv.org/html/2202.05262v5, Section 3.1 & Appendix A).

To insert a new counterfactual tuple $t^* = (s, r, o^)$ mapped to key-value pair $(k_, v_*)$ while minimizing Frobenius-norm interference with existing memories, ROME solves the equality-constrained least-squares Lagrangian: $$\min_{\hat{W}} \frac{1}{2}\big\|\hat{W} K - V\big\|F^2 \quad \text{subject to} \quad \hat{W} k* = v_*$$ Setting $\frac{\partial L(\hat{W}, \Lambda)}{\partial \hat{W}} = \hat{W}(K K^T) - V K^T - \Lambda k_*^T = 0$ and subtracting the pre-edit normal equation $W K K^T = V K^T$ yields the exact closed-form Rank-One Model Editing (ROME) weight update (https://arxiv.org/html/2202.05262v5, Equation 2 & Equations 11–13): $$\hat{W} = W + \Lambda \big(C^{-1} k_*\big)^T, \qquad \Lambda = \frac{v_* - W k_*}{\big(C^{-1} k_*\big)^T k_*}$$ where:

  1. Uncentered Key Covariance ($C = K K^T$): Pre-cached once in fp32 by estimating $\mathbb{E}_k[k k^T]$ over 100,000 samples of Wikitext.
  2. Subject Key Vector ($k_* \in \mathbb{R}^D$): Computed by averaging the post-nonlinearity MLP activation at the last token $i$ of subject $s$ over $N = 50$ random prefix contexts $x_j$ (lengths 2 to 10 tokens): $$k_* = \frac{1}{N} \sum_{j=1}^{N} \sigma\!\Big(W_{\text{fc}}^{(l^)} \gamma\!\big(a_{[x_j+s], i}^{(l^)} + h_{[x_j+s], i}^{(l^*-1)}\big)\Big)$$
  3. Target Value Vector ($v_* \in \mathbb{R}^H$): Optimized via 20 steps of gradient descent ($\text{lr} = 0.5$, weight decay $0.5$, KL factor $0.0625$) to maximize the log-probability of predicting $o^$ when $m_i^{(l^)} := z$ is substituted at the last subject token while controlling essence drift on " {subject} is a " via KL divergence (https://arxiv.org/html/2202.05262v5, Equation 4): $$v_* = \underset{z}{\operatorname{argmin}} \; \frac{1}{N}\sum_{j=1}^{N} -\log \mathbb{P}{G(m_i^{(l^)} := z)}\big[o^ \mid x_j + p\big] + D{\text{KL}}\!\Big(\mathbb{P}{G(m{i'}^{(l^*)} := z)}\big[x \mid p'\big] \;\Big\|\; \mathbb{P}_G\big[x \mid p'\big]\Big)$$

3. Empirical Benchmarks on zsRE (10,000 Records) and CounterFact (21,919 Records)

To distinguish true knowledge editing (Generalization across rephrased prompts PS and Specificity on neighboring subjects NS sharing the original property $o^c$) from superficial word regurgitation, Meng et al. constructed the CounterFact benchmark (21,919 records, 20,391 subjects, 749 objects, 42,876 paraphrase prompts, 82,650 neighborhood prompts, 62,346 generation prompts; https://arxiv.org/html/2202.05262v5, Table 2). On the 10,000-record zsRE benchmark (GPT-2 XL), ROME achieved 99.8% Efficacy ($\pm 0.0$), 88.1% Paraphrase ($\pm 0.5$), and 24.2% Specificity ($\pm 0.5$). On CounterFact, ROME decisively defeated Fine-Tuning (FT, FT+L), Knowledge Neurons (KN, Dai et al. 2022), and hypernetworks (KE, MEND):

Model & Editing Method (arXiv:2202.05262v5, Table 4)Harmonic Score $S \uparrow$Efficacy Score $\text{ES} \uparrow$ (%)Generalization (Paraphrase $\text{PS} \uparrow$ %)Specificity (Neighborhood $\text{NS} \uparrow$ %)Fluency (Entropy $\text{GE} \uparrow$)Consistency (TF-IDF $\text{RS} \uparrow$)
GPT-2 XL (1.5B) Pre-Edit Baseline30.522.2 (0.9)24.7 (0.8)78.1 (0.6)626.6 (0.3)31.9 (0.2)
GPT-2 XL + Fine-Tuning (FT / FT+L)65.1 / 66.9100.0 / 99.187.9 / 48.7 (F1)40.4 (F2) / 70.3607.1 / 621.440.5 / 37.4
GPT-2 XL + Knowledge Neurons (KN)35.628.7 (1.0)28.0 (0.9)72.9 (0.7)570.4 (2.3)30.3 (0.3)
GPT-2 XL + Hypernetworks (KE / MEND)52.2 / 57.984.3 / 99.175.4 / 65.430.9 / 37.9586.6 / 624.231.2 / 34.8
GPT-2 XL + ROME (Rank-One MLP Edit)89.2100.0 (0.1)96.4 (0.3)75.4 (0.7)621.9 (0.5)41.9 (0.3)
GPT-J (6B) Pre-Edit Baseline23.616.3 (1.6)18.6 (1.5)83.0 (1.1)621.8 (0.6)29.8 (0.5)
GPT-J (6B) + Fine-Tuning (FT / FT+L)25.5 / 68.7100.0 / 99.696.6 / 47.9 (F1)10.3 (F2) / 78.6387.8 / 622.824.6 / 35.5
GPT-J (6B) + MEND Hypernetwork63.297.4 (0.7)53.6 (1.9)53.9 (1.4)620.5 (0.7)32.6 (0.5)
GPT-J (6B) + ROME (Layer 5 MLP Edit)91.599.9 (0.1)99.1 (0.3)78.9 (1.2)620.1 (0.9)43.0 (0.6)

6. Mass-Editing Memory in a Transformer (MEMIT): Multi-Layer Residual Spreading Across Critical Mediating MLPs for 10,000 Simultaneous Edits (Meng et al., arXiv:2210.07229v2)

While ROME edits a single factual memory with near-perfect generalization and specificity, sequentially applying single-layer rank-one updates breaks down as the batch size $u$ grows: on CounterFact, ROME holds up to $n = 10$ edits but begins degrading at $n = 32$, and at $n = 10,000$ edits on GPT-J (6B), sequential ROME collapses to a zsRE Harmonic Score of 2.6 (0.9% Specificity) and a CounterFact Consistency Score of 3.3 (https://arxiv.org/html/2210.07229v2, Table 1 & Table 2).

1. Block Normal Equations and Multi-Layer Residual Spreading Across $\mathcal{R}$

In Mass-Editing Memory in a Transformer (Meng, Sen Sharma, Andonian, Belinkov, Bau, ICLR 2023, arXiv:2210.07229v2; https://arxiv.org/html/2210.07229v2, https://memit.baulab.info/), the authors observed that because the residual stream at the last subject token $S$ unrolls as $h_i^L = h_i^0 + \sum_{l=1}^L a_i^l + \sum_{l=1}^L m_i^l$, a whole contiguous range of critical mediating mid-layer MLPs $\mathcal{R}$ jointly contribute to factual recall:

  • In GPT-J (6B): Causal tracing with severed MLPs identifies the 6 critical mediating layers $\mathcal{R} = \{3, 4, 5, 6, 7, 8\}$ (target top mediating layer $L = \max(\mathcal{R}) = 8$, covariance factor $\lambda = 15,000$).
  • In GPT-NeoX (20B): Causal tracing identifies the 5 critical mediating layers $\mathcal{R} = \{6, 7, 8, 9, 10\}$ (target top mediating layer $L = 10$, covariance factor $\lambda = 20,000$; https://arxiv.org/html/2210.07229v2, Section 4.1 & Appendix B.4).

Rather than concentrating the entire parameter update inside a single layer with a hard equality constraint, MEMIT spreads $u \gg 1$ memory updates evenly across all layers $l \in \mathcal{R}$ in two stages (https://arxiv.org/html/2210.07229v2, Section 4.2–4.3, Equations 9–20):

  1. Parallel Target Residual Optimization at Top Layer $L = \max(\mathcal{R})$: For each requested edit $(s_i, r_i, o_i) \in \mathcal{E}$ ($i = 1, \dots, u$), optimize a residual vector $\delta_i$ at layer $L$ and last subject token $S$ (clamped so $\|\delta_i\|2 \le \frac{3}{4} \|h_i^L\|_2$ on GPT-J and $\le \frac{3}{10} \|h_i^L\|_2$ on GPT-NeoX) to maximize the probability of $o_i$ across $P$ random prefixes $x_j$, defining the target hidden state $z_i = h_i^L + \delta_i$: $$z_i = h_i^L + \underset{\delta_i}{\operatorname{argmin}} \; \frac{1}{P}\sum{j=1}^{P} -\log \mathbb{P}_{G(h_i^L \mathrel{+}= \delta_i)}\big[o_i \mid x_j \oplus p(s_i, r_i)\big]$$
  2. Iterative Ascending-Layer Batch Associative Memory Update: Iterating through $l \in \mathcal{R}$ in ascending order ($l = 3 \to 8$ on GPT-J), re-run the forward pass up to layer $l$ using the already-updated lower layers to collect the current keys $k_i^l = \frac{1}{P}\sum_{j=1}^P \sigma(W_{\text{in}}^l \gamma(h_i^{l-1}(x_j + s_i)))$ and compute the remaining top-level residual divided evenly across the $L - l + 1$ remaining mediating layers: $$r_i^l = \frac{z_i - h_i^L}{L - l + 1}, \qquad K_1^l = \big[k_1^l \;\big|\; \dots \;\big|\; k_u^l\big], \qquad R^l = \big[r_1^l \;\big|\; \dots \;\big|\; r_u^l\big]$$ Minimizing the soft joint least-squares objective $\sum_{i=1}^n \|\hat{W} k_i - m_i\|^2 + \sum_{i=n+1}^{n+u} \|\hat{W} k_i - m_i\|^2$ via the block normal equations $(W_0 + \Delta)(K_0 K_0^T + K_1 K_1^T) = M_0 K_0^T + M_1 K_1^T$ yields the exact closed-form batch update matrix $\Delta^l$ (https://arxiv.org/html/2210.07229v2, Equation 14): $$\Delta^l = R^l \big(K_1^l\big)^T \Big(C_0^l + K_1^l \big(K_1^l\big)^T\Big)^{-1}, \qquad C_0^l = \lambda \cdot \mathbb{E}_k\!\big[k k^T\big]$$

2. Scaling to 10,000 Simultaneous Memory Edits (GPT-J 6B & GPT-NeoX 20B)

At $n = 10,000$ simultaneous edits, MEMIT outperforms every baseline by up to two orders of magnitude in batch capacity while preserving fluency and neighborhood specificity (https://arxiv.org/html/2210.07229v2, Table 1, Table 2 & Appendix B):

Benchmark, Model & Editor at $n = 10,000$ Simultaneous EditsHarmonic Score $S \uparrow$Efficacy $\text{ES} \uparrow$ (%)Generalization (Paraphrase $\text{PS} \uparrow$ %)Specificity (Neighborhood $\text{NS} \uparrow$ %)Fluency ($\text{GE} \uparrow$) & Consistency ($\text{RS} \uparrow$)Total Wall-Clock Runtime for 10,000 Edits (Appendix B)
zsRE (10k Edits) — GPT-J (6B) Pre-Edit26.426.4 ($\pm 0.6$)25.8 ($\pm 0.5$)27.0 ($\pm 0.5$)N/A (QA prediction task)N/A
zsRE (10k Edits) — GPT-J + FT-W / MEND42.1 / 20.069.6 / 19.464.8 / 18.624.1 / 22.4N/A1,716.21 s (0.48 hr) / 98.25 s
zsRE (10k Edits) — GPT-J + Sequential ROME2.621.0 ($\pm 0.7$)19.6 ($\pm 0.7$)0.9 ($\pm 0.1$)Catastrophic single-layer collapse44,248.26 s (12.29 hr, ~4 s/edit)
zsRE (10k Edits) — GPT-J + MEMIT ($\mathcal{R}=\{3..8\}$)50.796.7 ($\pm 0.3$)89.7 ($\pm 0.5$)26.6 ($\pm 0.5$)Preserves pre-edit 27.0% specificity26,773 s (7.44 hr: 6.54 hr $z_i$ + 0.90 hr matrix update)
CounterFact (10k Edits) — GPT-J (6B) Pre-Edit22.415.2 (0.7)17.7 (0.6)83.5 (0.5)622.4 GE / 29.4 RSN/A
CounterFact (10k Edits) — GPT-J + FT-W (Layer 21)67.699.4 (0.1)77.0 (0.7)46.9 (0.6)293.9 GE (Fluency collapse) / 15.9 RS1,716.21 s (0.48 hr / ~29 min)
CounterFact (10k Edits) — GPT-J + MEND23.115.7 (0.7)18.5 (0.7)83.0 (0.5)618.4 GE / 31.1 RS (Leaves model unchanged)98.25 s
CounterFact (10k Edits) — GPT-J + Sequential ROME50.350.2 (1.0)50.4 (0.8)50.2 (0.6)589.6 GE / 3.3 RS44,248.26 s (12.29 hr)
CounterFact (10k Edits) — GPT-J + MEMIT85.898.9 (0.2)88.6 (0.5)73.7 (0.5)619.9 GE / 40.1 RS26,773 s (7.44 hr; 0.90 hr cached $z_i$)
CounterFact (10k Edits) — GPT-NeoX (20B) Pre-Edit23.716.8 (1.9)18.3 (1.7)81.6 (1.3)620.4 GE / 29.3 RSN/A
CounterFact (10k Edits) — GPT-NeoX (20B) + MEMIT ($\mathcal{R}=\{6..10\}$)82.097.2 (0.8)82.2 (1.6)70.8 (1.4)606.4 GE / 36.9 RS2 $\times$ 48 GB NVIDIA A6000 GPUs

7. Representation Engineering (RepE): Linear Artificial Tomography (LAT), Contrast Vectors, and Low-Rank Representation Adaptation (LoRRA) (Zou et al., arXiv:2310.01405v4)

In Representation Engineering: A Top-Down Approach to AI Transparency (Zou, Phan, Chen et al., Center for AI Safety, CMU, Stanford, UC Berkeley, arXiv:2310.01405v4; https://arxiv.org/html/2310.01405v4), the authors contrasted two foundational paradigms from cognitive neuroscience (Barack & Krakauer, 2021):

  • The Sherringtonian View (Bottom-Up Mechanistic Interpretability): Explains cognition through node-to-node connections among individual neurons and circuits. While effective for localized mechanisms (such as Induction Heads or single-fact MLP storage), lesion studies show that deep residual networks compute representations via iterative refinement across redundant layers (Veit et al. 2016, McGrath et al. 2023), making high-level cognitive states difficult to reduce to isolated circuits.
  • The Hopfieldian View (Top-Down Representation Engineering, RepE): Treats population-level representational spaces and trajectories across neural populations as the primary unit of analysis (https://arxiv.org/html/2310.01405v4, Section 1 & Figure 2).

1. Representation Reading via Linear Artificial Tomography (LAT)

Inspired by functional neuroimaging, a Linear Artificial Tomography (LAT) scan extracts a linear reading vector $v \in \mathbb{R}^{d_{\text{model}}}$ for any declarative Concept $c$ (truthfulness, utility, probability, risk, morality, emotion) or procedural Function $f$ (honesty vs. lying, harmless instruction-following, power-seeking) in three completely unsupervised steps using only 5 to 128 stimuli (https://arxiv.org/html/2310.01405v4, Section 3.1.1, Equations 1–2):

  1. Step 1 (Contrastive Stimulus & Task Templates $T_c$ and $T_f^\pm$): - For a declarative concept $c$, wrap unlabeled stimuli $s_i \in S$ in a template $T_c(s_i)$: "Consider the amount of <concept> in the following: <stimulus> The amount of <concept> is". - For a procedural function $f$ in instruction-tuned models, wrap generic instruction-response pairs $(q_i, a_i) \in S$ (such as Alpaca) in an experimental template $T_f^+$ ("Give a truthful answer") and a reference template $T_f^-$ ("Give an untruthful answer").
  2. Step 2 (Collecting Neural Activity at Position [-1]): Collect the residual stream hidden states at the last token position [-1] preceding prediction for concepts, or across every response token $0 < k \le |a_i|$ for procedural functions: $$A_c = \Big\{\operatorname{Rep}\big(M, T_c(s_i)\big)[-1] \;\Big|\; s_i \in S\Big\}, \qquad A_f^\pm = \Big\{\operatorname{Rep}\big(M, T_f^\pm(q_i, a_i^k)\big)[-1] \;\Big|\; (q_i, a_i) \in S, \; 0 < k \le |a_i|\Big\}$$
  3. Step 3 (Unsupervised Paired Difference PCA): Construct paired difference vectors $\{A_c^{(i)} - A_c^{(j)}\}$ for concepts or randomized sign-flipped contrastive differences $\{(-1)^i (A_f^{+(i)} - A_f^{-(i)})\}$ for functions, and extract the first principal component (PCA PC1) as the Reading Vector $v$. During inference, the scalar projection $\operatorname{Rep}(M, x)^{\mathsf{T}} v$ (summed across the middle 20 layers) acts as a real-time token-by-token neural monitor—achieving $>90\%$ classification accuracy in distinguishing honest from dishonest generation and flagging both intentional lies and hallucinations (https://arxiv.org/html/2310.01405v4, Section 4.3.1–4.3.2).

2. Representation Control Operators and LoRRA (TruthfulQA MC1 Benchmarks)

To causally intervene on model cognition across target layers $l \in L^t$, RepE combines three transformation operators—Linear Combination ($R' = R \pm \alpha v$), Piece-wise Conditional Amplification ($R' = R + \alpha \operatorname{sign}(R^{\mathsf{T}} v) v$), and Orthogonal Concept Erasure Projection ($R' = R - \frac{R^{\mathsf{T}} v}{\|v\|^2} v$)—with three controller operands (https://arxiv.org/html/2310.01405v4, Section 3.2.1 & Algorithm 1):

  1. Stimulus-Independent Reading Vector ($v_l^r$): Directly adds the static LAT PCA vector at inference time.
  2. Stimulus-Dependent Contrast Vector ($v_l^c$): Runs the live input through experimental and reference prompts $x_i^+, x_i^-$ layer-by-layer from earliest to latest target layer ($v_l^c = R(M, l, x_i^+) - R(M, l, x_i^-)$), achieving the highest control accuracy at the cost of $>3\times$ inference compute.
  3. Low-Rank Representation Adaptation (LoRRA): Fine-tunes LoRA adapters attached to attention weights on generic Alpaca prompts $(q_i, a_i) \in P$ to match the contrast-shifted target representation $r_l^t = R(M, l, x_i) + \alpha v_l^c + \beta v_l^r$ under $L_2$ loss $\mathcal{L}{\text{LoRRA}} = \sum{l \in L^t} \|m(r_l^p - r_l^t)\|_2$, merging the weights after training for zero inference compute overhead (https://arxiv.org/html/2310.01405v4, Algorithm 1).
LLaMA-2-Chat Model SizeStandard Zero-Shot TruthfulQA MC1 (%)Zero-Shot Verbalized Heuristic (%)LAT Reading Scan (Stimulus 1 / 2 / 3 %)Representation Control: ActAdd / Reading (%)Representation Control: Contrast Vector / LoRRA (%)
LLaMA-2-Chat 7B31.0%32.2%55.0% / 58.9% / 58.2%33.7% / 34.1%47.9% (+16.9 pts) / 42.3% (+11.3 pts)
LLaMA-2-Chat 13B35.9%50.3%49.6% / 53.1% / 54.2%38.8% / 42.4%54.0% (+18.1 pts) / 47.5% (+11.6 pts)
LLaMA-2-Chat 70B29.9%59.2%65.9% / 69.8% / 69.8%N/AInternal truth accuracy increases with scale (69.8%) even when standard output drops (29.9%)
3-Model Average (Table 1)32.3%47.2%56.8% / 60.6% / 60.7%—LoRRA matches Contrast Vector gains with zero inference overhead (Table 2)

3. Production PyTorch Implementation: TopK + AuxK SAE, JumpReLU STE, MEMIT Update, and RepE LAT

Below is a complete, self-contained PyTorch implementation of OpenAI's TopK + AuxK Sparse Autoencoder (arXiv:2406.04093v1), DeepMind's JumpReLU STE Sparse Autoencoder (arXiv:2408.05147v1), the ROME / MEMIT closed-form block associative memory update (arXiv:2202.05262v5, arXiv:2210.07229v2), and RepE Linear Artificial Tomography (LAT) PCA reading & projection control (arXiv:2310.01405v4):

from __future__ import annotations

import torch
import torch.nn as nn
import torch.nn.functional as F

class TopKSparseAutoencoder(nn.Module):
    """OpenAI TopK Sparse Autoencoder with W_enc = W_dec^T init and AuxK dead-latent loss (arXiv:2406.04093v1)."""

    def __init__(self, d_model: int, n_latents: int, k: int, k_aux: int = 32) -> None:
        super().__init__()
        self.d_model = d_model
        self.n_latents = n_latents
        self.k = k
        self.k_aux = k_aux

        self.b_pre = nn.Parameter(torch.zeros(d_model))
        self.b_enc = nn.Parameter(torch.zeros(n_latents))

        # Initialize unit-norm decoder directions and set W_enc = W_dec^T at initialization
        w_dec_init = F.normalize(torch.randn(d_model, n_latents), dim=0)
        self.W_dec = nn.Parameter(w_dec_init.clone())
        self.W_enc = nn.Parameter(w_dec_init.t().clone())

    @torch.no_grad()
    def normalize_decoder_(self) -> None:
        """Maintain unit-norm decoder columns after each optimizer step (Sec. A.1)."""
        self.W_dec.data = F.normalize(self.W_dec.data, dim=0)

    def forward(
        self,
        x: torch.Tensor,
        dead_mask: torch.Tensor | None = None,
        aux_coeff: float = 1.0 / 32.0,
    ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
        """Compute TopK sparse activations, reconstruction, and optional AuxK dead-latent loss."""
        x_centered = x - self.b_pre
        pre_acts = F.linear(x_centered, self.W_enc, self.b_enc)

        # TopK activation function: keep top-k largest latents per token, zero the rest (Eq. 2)
        topk_vals, topk_idx = torch.topk(F.relu(pre_acts), k=self.k, dim=-1)
        z = torch.zeros_like(pre_acts).scatter_(-1, topk_idx, topk_vals)

        x_hat = F.linear(z, self.W_dec) + self.b_pre
        recon_error = x - x_hat
        mse_loss = recon_error.pow(2).sum(dim=-1).mean()

        # AuxK loss: reconstruct residual error using top-k_aux dead latents (Sec. 2.4 & A.2)
        if dead_mask is not None and int(dead_mask.sum().item()) > 0:
            k_dead = min(self.k_aux, int(dead_mask.sum().item()))
            dead_pre_acts = F.relu(pre_acts).masked_fill(~dead_mask.unsqueeze(0), 0.0)
            aux_vals, aux_idx = torch.topk(dead_pre_acts, k=k_dead, dim=-1)
            z_aux = torch.zeros_like(pre_acts).scatter_(-1, aux_idx, aux_vals)
            e_hat = F.linear(z_aux, self.W_dec)
            aux_loss = (recon_error.detach() - e_hat).pow(2).sum(dim=-1).mean()
            total_loss = mse_loss + aux_coeff * aux_loss
        else:
            total_loss = mse_loss

        return x_hat, z, total_loss

class _JumpReLUSTE(torch.autograd.Function):
    """JumpReLU z * H(z - theta) with KDE Straight-Through Estimator for threshold theta (arXiv:2408.05147v1)."""

    @staticmethod
    def forward(ctx: torch.autograd.function.FunctionCtx, z: torch.Tensor, theta: torch.Tensor, eps: float) -> torch.Tensor:
        ctx.save_for_backward(z, theta)
        ctx.eps = eps
        return z * (z > theta).to(z.dtype)

    @staticmethod
    def backward(
        ctx: torch.autograd.function.FunctionCtx, grad_out: torch.Tensor
    ) -> tuple[torch.Tensor, torch.Tensor, None]:
        z, theta = ctx.saved_tensors
        eps = ctx.eps
        active = (z > theta).to(z.dtype)
        grad_z = grad_out * active
        # Rectangular kernel density estimator in [-eps/2, eps/2] around threshold theta
        kde_window = ((z - theta).abs() < (0.5 * eps)).to(z.dtype) / eps
        grad_theta = -(theta * kde_window * grad_out).sum(dim=0)
        return grad_z, grad_theta, None

def memit_layer_batch_update(
    W_out: torch.Tensor,
    K_new: torch.Tensor,
    R_residual: torch.Tensor,
    C_cov: torch.Tensor,
) -> torch.Tensor:
    """Compute MEMIT closed-form batch associative memory update (arXiv:2210.07229v2 Eq. 14).

    Args:
        W_out: Current MLP output weight matrix W_0 of shape (H, D).
        K_new: Stacked subject key vectors K_1 of shape (D, u) for u simultaneous edits.
        R_residual: Stacked layer-distributed target residuals R^l = [r_1^l | ... | r_u^l] of shape (H, u).
        C_cov: Scaled uncentered key covariance matrix C_0 = lambda * E[k k^T] of shape (D, D).

    Returns:
        Updated weight matrix W_1 = W_0 + R K_1^T (C_0 + K_1 K_1^T)^{-1} of shape (H, D).
    """
    system_matrix = C_cov + (K_new @ K_new.t())
    # Solve (C_0 + K_1 K_1^T) X^T = K_1 R^T -> Delta = R K_1^T (C_0 + K_1 K_1^T)^{-1}
    rhs = K_new @ R_residual.t()
    delta_t = torch.linalg.solve(system_matrix, rhs)
    return W_out + delta_t.t()

def repe_lat_reading_vector(pos_acts: torch.Tensor, neg_acts: torch.Tensor) -> torch.Tensor:
    """Extract RepE Linear Artificial Tomography (LAT) reading vector via paired difference PCA (arXiv:2310.01405v4 Sec. 3.1.1)."""
    n_pairs = pos_acts.shape[0]
    signs = torch.tensor([(-1.0) ** i for i in range(n_pairs)], device=pos_acts.device, dtype=pos_acts.dtype).unsqueeze(1)
    diffs = signs * (pos_acts - neg_acts)
    diffs_centered = diffs - diffs.mean(dim=0, keepdim=True)
    _, _, vh = torch.linalg.svd(diffs_centered, full_matrices=False)
    v_read = F.normalize(vh[0], dim=0)
    # Orient reading vector so positive minus negative projections are positive on average
    if ((pos_acts - neg_acts) @ v_read).mean() < 0:
        v_read = -v_read
    return v_read

if __name__ == "__main__":
    torch.manual_seed(42)
    # 1. Verify OpenAI TopK + AuxK Sparse Autoencoder
    sae = TopKSparseAutoencoder(d_model=64, n_latents=256, k=8, k_aux=16)
    x_in = F.normalize(torch.randn(16, 64), dim=-1)
    dead_latents = torch.zeros(256, dtype=torch.bool)
    dead_latents[200:] = True
    x_rec, z_lat, loss_sae = sae(x_in, dead_mask=dead_latents)
    assert (z_lat > 0).sum(dim=-1).float().mean().item() <= 8.0

    # 2. Verify JumpReLU STE Gate
    z_pre = torch.randn(16, 256, requires_grad=True)
    theta_param = torch.full((256,), 0.001, requires_grad=True)
    z_jump = _JumpReLUSTE.apply(z_pre, theta_param, 0.001)
    z_jump.pow(2).sum().backward()
    assert theta_param.grad is not None

    # 3. Verify MEMIT Batch Associative Memory Update (Eq. 14)
    W_0 = torch.randn(64, 128)
    K_1 = F.normalize(torch.randn(128, 10), dim=0)
    M_1 = torch.randn(64, 10)
    R_1 = M_1 - (W_0 @ K_1)
    C_0 = 1e-3 * torch.eye(128)
    W_1 = memit_layer_batch_update(W_0, K_1, R_1, C_0)
    assert torch.allclose(W_1 @ K_1, M_1, atol=1e-2)

    # 4. Verify RepE LAT Paired Difference PCA Reading Vector
    true_dir = F.normalize(torch.randn(64), dim=0)
    act_pos = torch.randn(32, 64) * 0.2 + 1.5 * true_dir
    act_neg = torch.randn(32, 64) * 0.2 - 1.5 * true_dir
    v_lat = repe_lat_reading_vector(act_pos, act_neg)
    assert F.cosine_similarity(v_lat.unsqueeze(0), true_dir.unsqueeze(0)).item() > 0.95
    print(f"Verified TopK SAE Loss: {loss_sae.item():.4f} | MEMIT Max Err: {(W_1 @ K_1 - M_1).abs().max().item():.5f} | LAT CosSim: {F.cosine_similarity(v_lat.unsqueeze(0), true_dir.unsqueeze(0)).item():.4f}")

8. Frequently Asked Questions (FAQ): Mechanistic Interpretability, Sparse Autoencoders, ROME/MEMIT, and Representation Engineering

Why can a two-layer attention-only Transformer form Induction Heads and undergo the in-context learning phase change while a one-layer Transformer cannot? In A Mathematical Framework for Transformer Circuits (https://transformer-circuits.pub/2021/framework/index.html) and In-Context Learning and Induction Heads (https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html), completing the inductive sequence [A][B] ... [A] -> [B] requires the attention head at the second instance of [A] to attend to token [B] based on the fact that [B] was preceded by [A]. In a 1-layer Transformer, the Query-Key (QK) circuit $W_E^T W_{QK}^h W_E$ is a bilinear function solely of the current query token and the candidate key token itself—it has no access to the token that preceded the candidate key. In a 2-layer Transformer, a Layer-1 previous-token head $h_1$ first copies the identity of [A] into [B]'s residual stream via $W_{OV}^{h_1}$, and a Layer-2 Induction Head $h_2$ uses K-Composition ($W_K^{h_2} W_{OV}^{h_1}$) to match query [A] against that shifted key representation. Across 34 models, this circuit forms abruptly between 2.5 billion and 5 billion training tokens, driving the in-context learning score ($\mathcal{L}{500} - \mathcal{L}{50}$) from $<0.15\text{ nats}$ to $\sim 0.4\text{ nats}$ ($>75\%$ of final ICL).

Why does forcing architectural activation sparsity during language model pre-training fail to eliminate polysemantic neurons? In Towards Monosemanticity (https://transformer-circuits.pub/2023/monosemantic-features/index.html, Section Why not use architectural approaches?), Anthropic trained language models with explicit activation sparsity penalties—all the way up to 1-hot activations where only a single neuron can fire at a time (completely eliminating superposition)—and discovered that the neurons still became polysemantic. Under autoregressive cross-entropy loss, a single binary neuron trained on four equally probable mutually exclusive features ($A, B, C, D$) achieves an expected cross-entropy loss of $\frac{3}{4}\ln 3 \approx 0.8$ if it fires monosemantically on feature $A$ alone, whereas firing polysemantically on both $A$ and $B$ (predicting a 50/50 distribution over $\{A, B\}$ when active and 50/50 over $\{C, D\}$ when silent) achieves a lower cross-entropy loss of $\ln 2 \approx 0.7$. Post-training Sparse Autoencoders avoid this pathology because they reconstruct frozen continuous activations under Mean Squared Error (MSE) rather than token cross-entropy.

Why did OpenAI and Google DeepMind replace L1-penalized ReLU Sparse Autoencoders with TopK and JumpReLU activation functions? In standard ReLU Sparse Autoencoders trained with $\mathcal{L} = \|x - \hat{x}\|2^2 + \lambda \|z\|_1$, the $L_1$ penalty applies a constant gradient $-\lambda$ that systematically shrinks all positive feature activations toward zero (https://arxiv.org/html/2406.04093v1, Section 5.1). OpenAI's TopK SAE ($z = \operatorname{TopK}(W{\text{enc}}(x - b_{\text{pre}}))$) removes the $L_1$ penalty entirely, directly sets exact sparsity $L_0 = k$, improves N2G explanation recall by $>1.5\times$, and—when paired with $W_{\text{enc}} = W_{\text{dec}}^T$ initialization and the AuxK dead-latent residual reconstruction loss—reduces dead latents from 65%–90% down to just 7% on a 16M-latent GPT-4 SAE (https://arxiv.org/html/2406.04093v1, Section 2.4). Google DeepMind's JumpReLU SAE (Gemma Scope, https://arxiv.org/html/2408.05147v1, Section 2.2) further improves on TopK by replacing the fixed per-token quota $k$ with a per-latent learnable positive step threshold $\boldsymbol{\theta} > 0$ ($\mathbf{z} \odot H(\mathbf{z} - \boldsymbol{\theta})$) trained with straight-through estimators ($\varepsilon = 0.001$) on an direct $L_0$ penalty $\lambda \|\mathbf{f}(\mathbf{x})\|_0$, allowing token sparsity to vary dynamically across context positions.

Where do autoregressive GPT models store factual associations, and why does editing late-layer attention fail to generalize? Through three-run Causal Tracing across 1,000 factual prompts in GPT-2 XL ($\text{ATE} = 18.6\%$, subject noise $\nu = 3\sigma_{\text{emp}}$), Meng et al. (https://arxiv.org/html/2202.05262v5, Section 2.2 & Section 3.4) proved that factual recall is localized along three dimensions: (1) inside MLP modules, (2) across middle layers, and (3) specifically at the last token of the subject entity (where state $\text{AIE}$ peaks at $8.7\%$ at layer 15, with MLP $\text{AIE} = 6.6\%$ vs. Attention $\text{AIE} = 1.6\%$). Mid-layer MLPs act as two-layer key-value associative memories ($W_{\text{fc}}$ encodes the subject key $k_*$; $W_{\text{proj}}$ retrieves the property value $v_*$), while high-layer attention modules at the last token of the prompt merely copy that retrieved value to the output. When Meng et al. intervened on late-layer attention weights instead of mid-layer MLPs (https://rome.baulab.info/, Appendix I), the edited model regurgitated the target word on the exact training prompt but completely failed to generalize across paraphrased contexts.

How does MEMIT scale direct weight editing to 10,000 facts simultaneously when sequential ROME collapses above 32 edits? ROME forces a single MLP layer ($l^* = 5$ in GPT-J) to absorb 100% of the memory update via a hard equality constraint $\hat{W} k_* = v_*$, which causes severe parameter interference after $n = 32$ sequential edits (collapsing GPT-J zsRE specificity to 0.9% and CounterFact consistency to 3.3 at $10,000$ edits; https://arxiv.org/html/2210.07229v2, Table 1 & Table 2). MEMIT computes the desired top-layer hidden-state shifts $\delta_i = z_i - h_i^L$ at $L = \max(\mathcal{R})$ in parallel, and then iterates in ascending order across all critical mediating MLP layers ($\mathcal{R} = \{3, 4, 5, 6, 7, 8\}$ on GPT-J 6B, $\mathcal{R} = \{6, 7, 8, 9, 10\}$ on GPT-NeoX 20B), dividing the remaining residual evenly ($r_i^l = \frac{z_i - h_i^L}{L - l + 1}$) and applying a single batched normal-equation update $\Delta^l = R^l (K_1^l)^T (C_0^l + K_1^l (K_1^l)^T)^{-1}$ per layer—achieving $S = 85.8$ (98.9% Efficacy, 88.6% Paraphrase, 73.7% Specificity) across 10,000 simultaneous CounterFact edits on GPT-J.

What is the difference between Truthfulness and Honesty in Representation Engineering (RepE), and how does LoRRA improve TruthfulQA by +18.1 points with zero inference overhead? In RepE (https://arxiv.org/html/2310.01405v4, Section 4.1–4.3), Truthfulness measures whether a model's external output matches objective factuality, whereas Honesty measures whether a model's output faithfully conveys its internal representation of truth. Using Linear Artificial Tomography (LAT), Zou et al. proved that as LLaMA-2-Chat scales from 7B to 70B, its internal LAT truthfulness reading accuracy on TruthfulQA MC1 increases from 58.9% to 69.8%, even as its standard zero-shot generation accuracy drops to 29.9%—proving that large models frequently know the truth internally while generating imitative falsehoods. By extracting stimulus-dependent Contrast Vectors $v_l^c = R(M, l, x_i^+) - R(M, l, x_i^-)$ between honest and dishonest task prompts and distilling those target representations into attention-layer LoRA weights via Low-Rank Representation Adaptation (LoRRA), LLaMA-2-Chat-13B zero-shot TruthfulQA MC1 accuracy jumps from 35.9% to 54.0% (+18.1 percentage points with Contrast Vectors) and 47.5% (+11.6 points with merged zero-overhead LoRRA).


9. Primary Technical Sources & Foundations

  1. Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Dario Amodei, Jared Kaplan, Sam McCandlish, Chris Olah et al. — A Mathematical Framework for Transformer Circuits (Anthropic, Dec 22, 2021, Transformer Circuits Thread): https://transformer-circuits.pub/2021/framework/index.html
  2. Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, Chris Olah et al. — In-Context Learning and Induction Heads (Anthropic, Mar 8, 2022 / arXiv:2209.11895 Full Interactive Paper): https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html
  3. Catherine Olsson et al. — In-Context Learning and Induction Heads (arXiv:2209.11895 Abstract & Metadata Repository): https://arxiv.org/abs/2209.11895
  4. Nelson Elhage, Tristan Hume, Catherine Olsson, Nicholas Schiefer, Tom Henighan, Shauna Kravec, Roger Grosse, Sam McCandlish, Jared Kaplan, Dario Amodei, Martin Wattenberg, Christopher Olah et al. — Toy Models of Superposition (Anthropic & Harvard, Sept 14, 2022 / arXiv:2209.10652 Full Interactive Paper): https://transformer-circuits.pub/2022/toy_model/index.html
  5. Nelson Elhage et al. — Toy Models of Superposition (arXiv:2209.10652 Abstract & Metadata Repository): https://arxiv.org/abs/2209.10652
  6. Trenton Bricken, Adly Templeton, Joshua Batson, Brian Chen, Adam Jermyn, Tom Conerly, Nicholas L. Turner, Cem Anil, Amanda Askell, Tristan Hume, Shan Carter, Tom Henighan, Chris Olah et al. — Towards Monosemanticity: Decomposing Language Models With Dictionary Learning (Anthropic, Oct 4, 2023, Transformer Circuits Thread): https://transformer-circuits.pub/2023/monosemantic-features/index.html
  7. Adly Templeton, Tom Conerly, Jonathan Marcus, Jack Lindsey, Trenton Bricken, Brian Chen, Adam Pearce, Craig Citro, Emmanuel Ameisen, Hoagy Cunningham, Adam Jermyn, Shan Carter, Chris Olah, Tom Henighan et al. — Scaling Monosemanticity: Extracting Interpretable Features from Claude 3 Sonnet (Anthropic, May 21, 2024, Transformer Circuits Thread): https://transformer-circuits.pub/2024/scaling-monosemanticity/index.html
  8. Leo Gao, Tom Dupré la Tour, Henk Tillman, Gabriel Goh, Rajan Troll, Alec Radford, Ilya Sutskever, Jan Leike, Jeffrey Wu — Scaling and Evaluating Sparse Autoencoders (OpenAI Superalignment Interpretability Team, June 6, 2024 / arXiv:2406.04093v1 Full Experimental HTML): https://arxiv.org/html/2406.04093v1
  9. Tom Lieberum, Senthooran Rajamanoharan, Arthur Conmy, Lewis Smith, Nicolas Sonnerat, Vikrant Varma, János Kramár, Anca Dragan, Rohin Shah, Neel Nanda — Gemma Scope: Open Sparse Autoencoders Everywhere All At Once on Gemma 2 (Google DeepMind, Aug 9, 2024 / arXiv:2408.05147v1 Full Experimental HTML): https://arxiv.org/html/2408.05147v1
  10. Kevin Meng, David Bau, Alex Andonian, Yonatan Belinkov — Locating and Editing Factual Associations in GPT (ROME) (NeurIPS 2022, MIT CSAIL, Northeastern University & Technion / arXiv:2202.05262v5 Full Experimental HTML & Official Project Page): https://arxiv.org/html/2202.05262v5
  11. Kevin Meng, David Bau, Alex Andonian, Yonatan Belinkov — ROME Official Project Portal & CounterFact Benchmark Repository: https://rome.baulab.info/
  12. Kevin Meng, Arnab Sen Sharma, Alex Andonian, Yonatan Belinkov, David Bau — Mass-Editing Memory in a Transformer (MEMIT) (ICLR 2023, MIT CSAIL, Northeastern University & Technion / arXiv:2210.07229v2 Full Experimental HTML & Official Project Page): https://arxiv.org/html/2210.07229v2
  13. Kevin Meng, Arnab Sen Sharma, Alex Andonian, Yonatan Belinkov, David Bau — MEMIT Official Project Portal: https://memit.baulab.info/
  14. Andy Zou, Long Phan, Sarah Chen, James Campbell, Phillip Guo, Richard Ren, Alexander Pan, Mantas Mazeika, Sanmi Koyejo, Dawn Song, Matt Fredrikson, J. Zico Kolter, Dan Hendrycks et al. — Representation Engineering: A Top-Down Approach to AI Transparency (RepE) (Center for AI Safety, CMU, Stanford, UC Berkeley / arXiv:2310.01405v4 Full Experimental HTML): https://arxiv.org/html/2310.01405v4
🔗 Share Post

Reading next story...

العودة إلى المنشورات