arena-in-12-weeks
glossary about

week 07 / 12

Superposition & toy models

Features are not neurons. Models pack more concepts than they have dimensions.

works through arena 1.5.4 · 1.5.4 Toy Models of Superposition & SAEs

new terms this week · 5

Representation concepts

Feature
A human-meaningful property represented somewhere in a model activation.
Superposition
Representing more features than dimensions by packing sparse features into overlapping directions.
Sparsity
The property that most possible features are inactive for any given input.
Polysemantic neuron
A neuron that responds to multiple unrelated features.

SAE methods

Sparse autoencoder (SAE)
A model trained to reconstruct activations using a sparse, wider latent representation.

The puzzle: too many concepts, too few neurons

Suppose a network layer has exactly 2 neurons. Its internal state at that layer contains 2 numbers. How many distinct properties of the input can it track?

Two orthogonal directions fit in a 2D space, so the layer can store 2 features without overlap. A third feature must share space with the first two and create interference.

Real networks represent far more features than they have dimensions. A layer with a few hundred neurons can track thousands of distinct properties. This week you train a minimal example: 5 features squeezed into 2 dimensions. You generate the data, so every true feature stays visible while the model learns to pack them. This packing scheme is Superposition , the problem that sparse autoencoders in week 8 try to undo.

What is a feature?

A feature is a human-meaningful property represented in an activation: "this token is inside a Python comment", "the sentence is in French", or "the next word should be a name". Interpretability research has also found features for hedging language, characters inside quotations, and years in the 1900s. A feature names a property the model tracks. A neuron names one concrete slot in an activation vector. Mechanistic interpretability asks how those abstract properties map onto concrete neurons and weights. Superposition makes that mapping indirect.

Features are sparse when only a few activate for any one input. This sentence may activate features for English prose, technical writing, and the word "feature" while thousands of unrelated properties stay silent. That Sparsity gives superposition room to work.

Five independently active features would exceed the clean capacity of a two-dimensional hidden space. When only one or two usually activate, the model can overlap their directions and use ReLU to clip small accidental leakage.

We give the toy model 5 abstract features. Each feature turns on independently with a chosen probability and receives a random strength when active. A tiny network compresses and reconstructs those values. Since we manufactured the ground truth, we can compare every learned direction with the true feature that produced it.

The trick: overlap a little, lean on sparsity

The model represents each feature as a direction in its hidden space, a vector pointing out from the origin at an angle the model chooses. Two directions at 90° are orthogonal, so their dot product is zero and they create no interference. Five directions exceed the number of mutually orthogonal directions in 2D. The model can spread them evenly into a pentagon, 72° apart. When one feature fires, each non-orthogonal readout picks up a phantom signal.

A two-dimensional coordinate plane with monospace axis labels h₀ and h₁ shows five feature directions as arrows from the origin, arranged like a pentagon 72° apart. Feature f0 is blue and points straight up; it is the single thick arrow and is labeled "f0 (active)". Feature f1 is red and points upper right, f2 is green and points upper left, f3 is orange and points lower left, and f4 is purple and points lower right. A small arc marks the 72° angle between f0 and f1. A dashed gray projection line drops perpendicularly from f0's tip onto f1's direction, with a right-angle marker at the foot and the annotation "leakage onto f1: cos 72° ≈ 0.31". A side panel states that only 2 directions can be fully orthogonal. With 5 directions, an active f0 value of 1.0 gives f1 a phantom readout of 0.31. Sparsity limits simultaneous activations, and ReLU clips small negative leakage to zero. A monospace note reads "interference = W Wᵀ, off-diagonal ≠ 0". The caption states that five features cannot all occupy orthogonal directions in two dimensions, so an active feature leaks onto its neighbors.

One matrix product measures the leakage. If the rows of W are feature directions, then W @ W.T contains every pairwise overlap. The diagonal compares each feature with itself and equals 1.0. Every off-diagonal entry measures interference between two features:

# no-run
# 01: interference is a matrix of dot products
import torch
import torch.nn.functional as F

# rows are three feature directions in a two-dimensional hidden space
W = F.normalize(torch.tensor([[1.0, 0.0], [0.3, 0.95], [-0.8, 0.6]]), dim=1)
leakage = W @ W.T
print(leakage.round(decimals=2))
# tensor([[ 1.0000,  0.3000, -0.8000],
#         [ 0.3000,  1.0000,  0.3300],
#         [-0.8000,  0.3300,  1.0000]])
# off-diagonal values show features interfering with each other

The off-diagonal entries are interference. Superposition is the model deciding that small interference is cheaper than dedicating full dimensions to rare features.

The pentagon shows how the model controls that interference. When only feature 0 fires, decoding the compressed 2D state produces five readouts with small positive and negative phantoms. A ReLU (max(0, x)) erases every negative value:

# 02: the pentagon's leakage and the ReLU rescue
import numpy as np

angles = np.deg2rad(90 + 72 * np.arange(5))     # five directions, 72° apart
W = np.stack([np.cos(angles), np.sin(angles)])  # (2, 5): columns are features

x = np.array([1.0, 0, 0, 0, 0])   # only feature 0 fires
readoff = W.T @ (W @ x)           # squeeze to 2 dims, then read all 5 back
print(readoff.round(2))
# [ 1.    0.31 -0.81 -0.81  0.31]
print(np.maximum(readoff, 0).round(2))
# [1.   0.31 0.   0.   0.31]

Feature 0 survives at full strength. ReLU clips two phantoms to zero, while two positive phantoms of 0.31 remain. During training, the model learns negative biases that push this small positive leakage below zero before ReLU. Sparsity handles co-occurrences: strong interference requires two overlapping features to fire simultaneously, an infrequent event in sparse data. Paying a small reconstruction cost on those cases costs less than dropping 3 of the 5 features. Superposition accepts bounded interference so the model can represent every feature.

The toy model: 5 → 2 → 5

A tiny autoencoder demonstrates the full mechanism. An autoencoder learns to reproduce its input. Here, a bottleneck squeezes 5 input features through a hidden layer of 2 numbers before reconstructing all 5. The encoder and decoder share a weight matrix W with shape (2, 5); the decoder uses its transpose, a design called tied weights. A bias and final ReLU complete the model. Each column of W gives one feature's direction in the 2D hidden plane, so an arrow plot of those columns exposes the learned geometry directly.

A three-column diagram shows the toy autoencoder architecture. The left column contains five input circles labeled f0 through f4 in blue, red, green, orange, and purple. The middle column contains two black circles labeled h₀ and h₁ under "bottleneck: 2 dims"; above them, monospace text reads "h = W x" and "W: (2, 5)". The right column contains five white circles with colored outlines labeled f̂0 through f̂4 under "reconstruction out", with the formula "x̂ = ReLU(Wᵀ h + b)". Thin gray lines connect every input to both hidden units and both hidden units to every output. Feature f0's two encoder weights appear in blue, including the single thick edge, with the annotation "f0's two blue weights = its direction in the 2D hidden plane". A note below says the weights are tied: the decoder uses the encoder transpose, leaving one matrix W to learn. The caption states that the model squeezes 5 sparse features through 2 numbers and that each column of W gives one feature direction.

The synthetic data exposes two controls. Each feature activates independently with probability 1 − S, where S is sparsity. Active features take a random value, and inactive features equal 0. At S = 0, every feature is dense and always active. At S = 0.99, each feature activates on about 1% of examples. Each feature also receives an importance weight, a geometrically decaying multiplier on its contribution to the loss. When capacity runs short, the loss tells the model which reconstruction errors cost most.

The main experiment trains fresh model copies across a sweep from dense to sparse and plots the columns of W. With dense inputs, the model drops three features and stores the two most important features orthogonally. With sparse inputs, all five arrows appear in an evenly spaced pentagon. Intermediate settings produce other geometries, including antipodal feature pairs. Sparsity controls when shared dimensions become economical.

Why neurons become polysemantic

Superposition makes neuron-by-neuron reading unreliable. If features occupy pentagon directions, one neuron, or axis of the hidden space, contains projections from several features. A Polysemantic neuron therefore responds to multiple unrelated features. The neuron basis and the feature basis point in different directions.

A two-panel diagram compares monosemantic and polysemantic neurons. The left panel, labeled "monosemantic: one concept", shows one gray concept box, "mentions a bridge", connected by the diagram's single thick arrow to a black circle labeled neuron 217. Text below reads "neuron fires ⇒ exactly one story: the input mentions a bridge". The right panel, labeled "polysemantic: several concepts", shows four unrelated concept boxes labeled "mentions a bridge", "Python except blocks", "hedging language", and "years 1900–1999". Thin arrows connect all four boxes to the same black neuron 217. Text below asks "neuron fires ⇒ which of the four was it?" and states "the neuron basis differs from the feature basis". The caption says that superposition makes most neurons polysemantic, so reading neurons one by one cannot isolate features.

When that neuron lights up, its scalar value leaves the bridge feature, the code feature, and a mixture of both indistinguishable. Week 6 found attention heads with clean roles. Many model components lack that alignment. A better microscope changes coordinates and searches for directions that correspond to single features. Week 8's sparse autoencoders automate that search.

What ARENA adds beyond the headline plot

The notebook goes well past the pentagon, and its extra sections all circle one question: when is packing features together worth it?

  • Importance and sparsity sweeps: Training model grids across both controls produces a phase diagram with regions where a feature owns a full dimension, shares one, or gets dropped. Superposition switches on and off at sharp boundaries.
  • Privileged and non-privileged bases (section 2): A purely linear layer has no preferred neuron axes. You could rotate the hidden space without changing the model, which makes "what does neuron 3 mean?" a question about an arbitrary coordinate. An elementwise ReLU breaks this rotational symmetry because it acts on each neuron separately. That privileged basis lets individual neurons become candidates for stable meanings.
  • Feature geometry (section 3): Different feature counts and sparsities produce digons, triangles, pentagons, tetrahedra, and other uniform polytopes. Each feature receives a fraction of a dimension: 1 in an orthogonal arrangement, 1/2 in an antipodal pair, and 2/5 at a pentagon vertex. Models jump between these rational values in discrete steps.
  • Double descent (section 4, stretch): The same toy setup can make test loss rise and then fall as model size grows. This section links superposition with the tradeoff between memorization and generalization. Save it for a second pass if time runs short.

First contact with SAEs

The notebook's final section introduces a tool for unmixing features hidden in overlapping directions. A Sparse autoencoder (SAE) learns a wider latent representation and penalizes simultaneous use of many latents.

The SAE maps the toy model's 2 compressed dimensions into a wider layer. Its sparsity penalty rewards explanations that use few slots, giving each slot pressure to specialize in one original feature.

# no-run
# 03: the conceptual core of an SAE
import torch
import torch.nn.functional as F

x = torch.randn(16, 2)
W_enc = torch.randn(2, 8)
W_dec = torch.randn(8, 2)
acts = F.relu(x @ W_enc)
recon = acts @ W_dec
loss = ((recon - x) ** 2).mean() + 0.01 * acts.abs().mean()
print(loss.item())
# a positive scalar; the exact value varies because the tensors are random

The reconstruction term rewards preservation of the original activation. The sparsity term rewards explanations with few active latents. Their balance makes dedicated slots economical: each true feature can activate one latent without recruiting a dense mixture. In the notebook, the SAE decoder directions align with the five known pentagon directions. Week 8 applies the same method to real LLMs, whose true feature dictionaries remain unknown.

Why this matters

Week 7 changes the unit of analysis from neurons to directions. Gradient descent can pack sparse features into overlapping directions because that geometry reconstructs more useful information with limited width. SAEs in week 8 try to unpack those directions. Probes in week 10 search for a named direction without trusting individual neurons. Steering in week 11 writes along feature directions. The small toy model gives each later method a concrete mechanical purpose.

Pair-session guide

Core work is ARENA 1.5.4 sections 1 and 2 plus section 5 (the toy SAE section): train toy models, see how a ReLU makes the basis privileged, and watch an SAE recover known features. ARENA's own intro agrees: if time is short, it recommends sections 1 and 5 with a brief look at 2. Stretch work is sections 3 and 4, feature geometry and double descent. Keep asking which dimension is batch, which is feature, and which is parallel model instance.

What you should see

You should see feature directions spread into a pentagon-like plot as sparsity increases. In the SAE section, decoder directions should align with the true feature directions. Explain the result through feature geometry: several concept directions can cross each neuron axis.

Where to go next

The notebook's own reading list is unusually good this week; these are the three ARENA recommends:

  • Anthropic's Toy Models of Superposition is the paper this week reimplements. Read up to and including "Summary: A Hierarchy of Feature Properties"; the "Key Results" and "Definitions and Motivation" sections matter most.
  • Exploring Polysemanticity and Superposition, from Neel Nanda's "200 Concrete Open Problems" series, is a 15-minute plain-language tour of the same ideas plus the open questions they raise.
  • Neel Nanda's glossary notes on superposition are short enough to skim now and keep open as a reference during the exercises.

this week's pair session

core

  • 1-2: toy models and privileged basis
  • 5: toy SAEs

stretch

  • Feature geometry
  • Double descent