Interpretability

Superposition and sparse decoding

Pack five feature directions into two coordinates, measure the resulting cross-talk, and run a sparse decoder that reveals both what it can recover and what compression has erased.

Inspect after the film
Activity penalty λ 0.05
Decoder iterations 80.00
Loading film

Two clean directionsOne neuron need not mean one feature: start with two independent directions and two coordinates, where activating A by one gives the exact readout one, zero, without inventing activity in B.

Narrated with James Phoenix's AI voice.

5
Feature directions
2
Stored coordinates
1
Active decoder features
0.003
Hidden-state squared error
0.001
Feature MSE

The decoder reconstructs the two stored coordinates using 1 active coefficients. Compare hidden-state error with feature error: a good fit is not proof of the original input.

In this toy, a feature is represented by a direction in an activation space, and it need not be a single coordinate of that space. Start with two perpendicular feature directions in two coordinates: encoding and projecting back recovers the input exactly. The film then keeps two coordinates while arranging five unit directions around a regular pentagon, so the representation has more feature directions than coordinates.

The input activates only A. Its stored state is [1, 0], but reading that state with the five dot products returns approximately [1, 0.31, -0.81, -0.81, 0.31]. The inactive neighbours B and E respond because they overlap with A. Clipping negative values does not remove those two false positive responses. Every value in the film is computed from the displayed dictionary.

Sparsity changes how often features need the same space simultaneously. It does not make the fixed feature directions more perpendicular. Under the film's independent activation assumption, reducing a feature's activation probability from 0.5 to 0.1 reduces a pair's co-activation probability from 0.25 to 0.01. The displayed expected pair overlap energy is the sum of squared off-diagonal dot products multiplied by that pair probability, not a measured language-model loss.

The decoder solves a real nonnegative optimisation problem for the observed hidden state. Each iteration updates its coefficients to reduce reconstruction error plus a penalty on total activity. With only A active and the default penalty of 0.05, the solution keeps A near 0.95 and suppresses its neighbours. After the film, choose A, A plus B, or all five, change the penalty, and scrub the decoder's iterations to inspect the actual computed states.

The all-five case exposes a limit that a reconstruction metric can hide. Five equal pentagon directions sum to zero, just like no active features. The decoder can reconstruct that zero hidden state perfectly by returning no activity, yet its feature mean squared error against the all-active input is one. A sparse explanation depends on assumptions about the inputs; a good reconstruction alone does not establish that its labels are the true underlying features.

This is an illustrative fixed dictionary, not a trained language model or a claim that real features form a perfect pentagon. The optimisation shown is an iterative sparse decoder; a sparse autoencoder instead learns an encoder and decoder from activations, and evaluates reconstruction, sparsity and feature behaviour. Feature correlations, unequal importance, learned biases and real model behaviour add complications deliberately excluded here. Grokking and the logit lens are separate questions, not consequences demonstrated by this toy.

The maths

Encode into a smaller space
h=Dx,DR2×5h = D x, \qquad D \in \mathbb{R}^{2\times5}

The five columns of D are the labelled directions. The input bars x become the two stored coordinates h.

Projection exposes overlap
x^=DTh=DTDx\hat{x}=D^{\mathsf T}h=D^{\mathsf T}D x

The diagonal of the Gram matrix is one; its off-diagonal dot products create the visible neighbour responses.

Expected pair collision energy
E[C]=p2ij(diTdj)2\mathbb{E}[C]=p^2\sum_{i\ne j}(d_i^{\mathsf T}d_j)^2

With independent activations, p changes pair co-activation. It leaves the fixed dictionary overlap unchanged.

Sparse nonnegative decoding
a=argmina012Dah22+λa1a^*=\arg\min_{a\ge0}\frac12\lVert Da-h\rVert_2^2+\lambda\lVert a\rVert_1

The penalty slider sets lambda. The iteration control reads actual proximal-gradient steps with a conservative step size.

Sources and model assumptions

Follow the original mechanism behind this explainer. The interactive examples identify their toy data and simplifying assumptions above.

Related terms

More visualisations

Building with language models?

These explainers come out of the work. If you want the same thinking applied to your own system, that is what I do.

See how I can help