Interactive demos

Superposition in a toy model

Runs in your browser

Survey: §5.2 The Superposition Hypothesis

A network can represent more features than it has dimensions if the features are rarely active at the same time. This model has 5 input features and only 2 hidden dimensions. Drag the sparsity slider and retrain to see when it starts sharing dimensions.

Presets:
0 / 5features represented
2hidden dimensions
–loss
0steps

With 2 dimensions the model keeps only the 0 most important features.

Columns Wi of the 2 × 5 weight matrix: how each feature is embedded in the hidden space. Darker means more important. The unit circle is shown for reference.
WTW. Off-diagonal entries are interference between features.
Norm of each feature's embeddingf10.00f20.00f30.00f40.00f50.00
‖Wi‖. Above the dashed line (0.5) a feature counts as represented.
Superposition per featuref10.00f20.00f30.00f40.00f50.00
Σj≠i(Ŵi·Wj)²: how much feature i shares its direction with the others.

What is being computed

This is the ReLU-output toy model of Elhage et al. (2022): h = Wx, x′ = ReLU(Wᵀh + b). Training minimises importance-weighted reconstruction error, Σi Ii(xi − x′i)². Each feature is 0 with probability S and otherwise drawn from Uniform[0, 1]. Training is Adam (learning rate 0.01, batch 512) for 1,500 steps with a seeded random number generator, so the same settings give the same result every time.

Checked results (seed 1, importance decay 0.9, tested in tests/sim.test.ts): at S = 0 the model represents only 2 of 5 features, at S = 0.7 it represents 4, and at S = 0.9 it represents all 5. A feature counts as represented when ‖Wi‖ > 0.5. This reproduces the qualitative finding of the original paper: sparsity drives superposition.

Go further

References