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
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.
Pack features at slight angles
Readout = signal + interference
3 features in 2 dimensions
2000 features in 400 dims
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
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.
Bytewise
All courses