All courses

Superposition and polysemantic neurons

Explain how a model packs more sparse features than it has dimensions into nearly-orthogonal directions, accepting some interference. Explain why individual neurons then respond to several unrelated things.

Builds on: Features as directions in activation space

▶ Watch this lesson Start the whole course

What the animation says

Too many concepts

This model's vector holds four thousand ninety-six numbers. Yet probes find usable directions for far more things than that. Particular people, programming languages, moods, grammar facts: each one gets its own direction. And open up a single neuron: it fires on Korean text, DNA sequences, and legal citations. One idea explains both puzzles. Let's start small, in two dimensions. How many arrows fit there at exactly right angles to each other?

Nearly orthogonal + sparse

Only two. But allow nearly right angles, and high dimensions fit far more directions than dimensions. The cost: reading one feature picks up a little of every other active feature. That's interference. The readout is the feature's own strength, plus each other active feature's strength times its overlap. Random directions overlap by about one over the square root of d. And features are sparse, rarely on together, so the leak stays small and a ReLU threshold removes it. Training takes that deal: many features, slightly noisy.

3 features in 2D

Three features in two dimensions, spaced evenly. Every pair overlaps by minus one half. Turn on only feature two. Reading all three gives minus a half, one, minus a half. ReLU clips the negatives: zero, one, zero. Exact. Now turn on feature one at full strength, and feature three at half strength. Feature one reads its own one, plus a half times its overlap with feature three. What does it read?

A polysemantic neuron

Zero point seven five. Interference cost feature one a quarter. And feature three, truly on at one half, reads zero: its own half, cancelled by feature one's leak. Now a neuron. It outputs ReLU of minus the first coordinate: it fires when the activation points left. Picture each feature alone, at strength one, as the whole activation. Tap every feature that makes this neuron fire.

2000 features, 400 dims

Now scale up: two thousand random feature directions packed into four hundred dimensions. This line measures every overlap. The typical one is about zero point zero four. Turn three features on and read all two thousand. Active ones read near one; the worst inactive, about zero point three. This last line checks coordinate zero, one neuron. About ninety unrelated features move it. No feature gets a private neuron. To find a feature, look for its direction, not a single neuron.

More concepts than dimensions?

A model with width $d=4096$ seems to track far more than 4096 things: particular people, programming languages, moods, grammar facts. Linear probes keep finding usable directions for all of them. **How can a $d$-dimensional vector hold more than $d$ features?** A related puzzle: when you inspect a single MLP neuron, it often fires on Korean text *and* DNA sequences *and* legal citations. Why would one unit respond to several unrelated things?

Pack features at slight angles

At most $d$ directions can be exactly orthogonal, but far more can be **nearly orthogonal**. Reading one feature then picks up a little of every other active feature. This is **interference**. Most features are **sparse**: each is active on a tiny fraction of tokens, so few are active together and the leak is small noise that a ReLU threshold can remove. Training accepts this trade because representing many features with a little noise predicts better than representing few cleanly.

Readout = signal + interference

Write the activation as $a=\sum_{i=1}^{n} f_i u_i\in\mathbb R^{d}$, with $n>d$. Here $f_i\ge0$ is feature $i$'s strength (mostly 0) and $u_i$ is its unit direction (a row). Reading feature $k$: $$a\,u_k^\top=f_k+\sum_{j\ne k}f_j\,u_j u_k^\top$$ The sum is interference. For random directions each overlap is about $\pm1/\sqrt d$. So with $s$ *other* features active at strength 1, the interference has spread about $\sqrt{s/d}$.

3 features in 2 dimensions

Take $u_1=(1,0)$, $u_2=(-\tfrac12,\tfrac{\sqrt3}{2})$, $u_3=(-\tfrac12,-\tfrac{\sqrt3}{2})$. Every pair overlaps by $-0.5$. - **Only feature 2 on:** $a=u_2$. Readouts are $(-0.5,1,-0.5)$, and ReLU gives $(0,1,0)$: exact. - **Features 1 and 2 on:** $a=(0.5,0.87)$. Readouts are $(0.5,0.5,-1)$. Each active feature reads 0.5 instead of 1: that loss is interference. - **A neuron** $\mathrm{ReLU}(-a_1)$ outputs $0.5$ for feature 2 *and* for feature 3: it is polysemantic.

2000 features in 400 dims

The code packs 2000 random unit directions into 400 dimensions and turns 3 features on. The active readouts come out near 1, while the worst inactive readout is only about 0.3, so a threshold separates them. Roughly 90 unrelated features have a component above 0.1 along coordinate 0 (think of it as one neuron). A neuron like that is polysemantic.
import numpy as np
rng = np.random.default_rng(0)
d, n = 400, 2000                        # 5x more features than dims
U = rng.standard_normal((n, d))
U /= np.linalg.norm(U, axis=1, keepdims=True)  # feature directions
G = U @ U.T; np.fill_diagonal(G, 0)
print(np.abs(G).mean())                 # ~0.04 typical overlap
on = [3, 77, 1500]; f = np.zeros(n); f[on] = 1.0
read = U @ (f @ U)                      # read every feature from a
print(read[on], np.abs(np.delete(read, on)).max())  # ~1 vs ~0.3
print((np.abs(U[:, 0]) > 0.1).sum())    # ~90 features move neuron 0

Remember this

Features outnumber dimensions. The model stores sparse features along nearly-orthogonal directions and tolerates small interference when several happen to be active together. There are far more features than neurons, so features cannot each get a private neuron. Each feature direction is spread across many neurons, and each neuron overlaps many feature directions, so it fires for several unrelated things. To find a feature, look for its direction, not for a single neuron.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.