An interactive explainer

More Features Than Neurons

This is a neural network that has six concepts to store and only two neurons to store them in. Click a concept to fire it and watch what comes back out on the right.

—
six concepts: click one to fire it, or two at once
stored in 2 neurons
read back out (tick = true value, bar = model output)
—
scroll⌄

The dark panel above is a complete neural network with 18 numbers in it, and it trained in your browser when the page opened, storing six concepts using only two neurons. The rest of this page takes it apart, starting with how two neurons can hold six concepts, then when that stops working, and finally how to get the concepts back out of the neurons. If you noticed that it never reads back weather correctly, the sparsity section explains why.

0.One neuron, many meanings

If you open up a trained language model and pick a single neuron, what you have is one number in one layer, which takes some value on every input you feed the model and sits at zero for most of them. If networks were built the way people would build them, you could describe what each of those numbers is for in a short phrase, so one neuron would track quotation marks, another wetness, another the Golden Gate Bridge, and you could work your way down the list until the whole model was catalogued.

Trained networks mostly don't work that way, and you can see it in the four GPT-2 XL neurons below, each shown with the text that activates it most strongly, copied exactly from OpenAI's public dataset of all 307,200 of them.[9] The brighter a token is, the more strongly the neuron fired on it. Try finishing the sentence “this neuron detects ___” for any of the four.

Raw neurons of GPT-2 real model, verbatim records
—
hover a lit token GPT-2 XL · OpenAI neuron dataset · top records
Hover over the lit tokens to see their activation values, then flip to the next neuron and try the sentence again. Neuron 45 of layer 10 fires on a news story about surveillance footage, a lobster recipe, a platform game, and sawfly larvae. The best-known example of this kind of neuron, described by Bricken et al. in a small one-layer transformer, fired on academic citations, English dialogue, HTTP requests, and Korean text [2].

Neuron 3013 in layer 12 is another one. It responds to Kalamazoo, a sumo wrestler's name, and the second half of the word “warhead”, which you could count as three things or one depending on how you feel about tokenization. Neurons like these turn up all over language models. When OpenAI had GPT-4 write an explanation for every neuron in GPT-2 XL and then scored each explanation by how well it predicted the neuron's activity, only a bit over a thousand of the 307,200 scored 0.8 or higher.[9] A low score doesn't prove that a neuron has no single meaning, because the explanations can miss things, but it does suggest that neurons with one clean meaning are uncommon. There is more than one proposed reason for this.[13] The best-studied one, and the one this page is about, is that the network has more things to represent than it has neurons.

GPT-2 small, for example, has 768 numbers per layer and a vocabulary of 50,257 tokens, so even if all it had to record was which token it just read, with no syntax, topic, or speaker, it would need about 65 tokens per dimension. The vocabulary is the easy part, since the model also has to track who is talking, what language the text is in, whether the tone is sarcastic, and whether the current token is inside a quotation, a URL, or a legal citation, along with many things nobody has named. When Anthropic trained a sparse dictionary on one of its production models, they gave it room for 34 million features[3], and while not every entry ended up being used, that is still far more than the number of dimensions in any layer of the model.

So models store more concepts than they have dimensions, layered on top of one another, and accept the interference that comes with it. This is called superposition, and there is a theory of it detailed enough to make testable predictions.[1] The model at the center of that theory has only 18 parameters and trains in about a second, which is small enough that its main experiments can run right here on the page instead of being shown as static figures.

You get to try the first experiment yourself before any network does. Knowing what a vector is will be enough to follow along, and the expandable notes cover the rest as it comes up.

1.The packing problem

If you take away everything except the storage problem, what is left is a puzzle you can solve with a mouse. You have six features to store, meaning six concepts the model cares about, and two dimensions to store them in. Each feature is stored as a direction, which is an arrow in the flat space below, and an arrow needs a length of 1 to count as fully stored. The difficulty is that any two arrows that aren't perpendicular interfere, which means reading one of them also picks up part of the other, and the score adds a penalty for all of that overlap.

Two dimensions only have room for two perpendicular arrows, so with six features, at least some of them will have to overlap.

If vectors are new to you, this is the only math the game needs

In this article a vector is an arrow that starts at the center of the plot and has a direction and a length. Storing a feature as a vector means that whenever the feature is active, the model moves its hidden state in that arrow's direction, and to read the feature back it measures how far the hidden state reaches along the same direction.

That measurement is called the dot product, and for two arrows a and b it is the length of a times the length of b times the cosine of the angle between them. Perpendicular arrows give 0, so reading one picks up none of the other, and the smaller the angle between two arrows, the more of the other one gets picked up by accident. That accidental overlap is all “interference” means here.

Any introduction to linear algebra covers this, and episodes 1 and 9 of 3Blue1Brown's Essence of Linear Algebra are a good place to start.

There is one more rule, which is that the six features aren't equally valuable. F1 matters most and F6 least, and the thicker an arrow is drawn, the more it is worth. Drag the arrow tips to get the score as low as you can, and then hand your layout to gradient descent. It starts from your arrangement rather than from scratch, so whatever it ends up with is an improvement on your layout.

The packing game: you vs. gradient descent no network yet, just you
drag the arrow tips · dashed circle = length 1
—
your loss
—
gradient descent
Loss is how far each arrow falls short of length 1, plus the interference between overlapping arrows. Lower is better. Gradient descent starts from your layout.
Drag the tips and try to get the score below 3.0. Then press the button and see what gradient descent does starting from your layout. The score is the toy model's loss written out directly [1]. Each feature adds a penalty for falling short of length 1, weighted by its importance, and every pair of arrows that aren't perpendicular adds a penalty for their overlap. Keeping two perpendicular arrows and dropping the other four scores 2.60, spreading all six evenly around the circle scores 2.25, and gradient descent gets to about 1.47 in our runs, with all six features kept at a bit less than full length.

After a minute of dragging you have probably found both of the strategies this problem allows. One is to give the two most valuable features perpendicular arrows and drop the other four, so that nothing interferes but four concepts aren't stored at all. The other is to fit the extra arrows into the gaps, so that every feature overlaps a little with its neighbors, each one gets a small amount of interference, and none are dropped.

In this game the overlapping layout scores better, but which strategy works better in general depends on how often the features actually show up, and that is what the next two sections are about.

With more features than dimensions, some interference can't be avoided. The network has to choose between dropping features so the rest don't interfere, and overlapping them so that every feature gets a little interference.

2.The toy model

Next we give the same problem to an actual network. This is the toy model from Elhage et al., set up the way they published it[1]. It's an autoencoder with two hidden neurons between a six-number input and a six-number output, and it has 18 parameters in total.

input x (6 features)hidden h = Wx (2 neurons)output x′ = ReLU(Wᵀh + b) W (compress)Wᵀ (reconstruct)
Six sparse features go in on the left, get compressed into two hidden neurons in the middle, and are rebuilt on the right. Column i of W is the same arrow you were dragging for feature i in the game, meaning it's the direction in the hidden space where that feature is stored, and training lowers the reconstruction error after weighting each feature by its importance.

Each of the six features in the input x is off most of the time, and when one does turn on (5% of the time here) it takes a random strength. Importance falls from F1 to F6, so an error on F1 counts about six times as much in the loss as the same error on F6. The model has to pass all six features through the two hidden neurons and then reconstruct them at the output.

How to read x′ = ReLU(WᵀWx + b), and what training does

x is the list of six feature values going in, and x′ is the model's attempt to reproduce them. W is a grid of 12 numbers with 2 rows and 6 columns, so multiplying by W takes six numbers down to two, and multiplying by its transpose Wᵀ takes those two back up to six. Column i of W is the arrow you dragged for feature i in the game, and b is a list of six learned offsets that get added at the end.

ReLU is about the simplest nonlinearity there is, since all it does is replace a negative number with zero and leave everything else alone. Most of the results in the rest of this article depend on it.

Training means scoring the model by its reconstruction error, weighted by how important each feature is, and then nudging every number in W and b a little in whichever direction lowers that score, thousands of times over. It's the same process you watched in the game when gradient descent took over your layout, only now it's adjusting more numbers.

The model is defined in section 2 of Elhage et al., Toy Models of Superposition [1].

Since so much depends on the nonlinearity, the figure below lets you run the model both with it and without it. The model is training in your browser while you read this, and the arrows on the left are the columns of W moving under gradient descent.

The toy model, training live a separate model, trained from scratch —
feature directions (columns of W)
how strongly each feature is represented ‖Wᵢ‖
loss —steps — features active 5% of the time · importance decays F1 → F6
Switch to Linear and four of the features drop to zero, and when you switch back they return. Retrain ↻ starts the training over from a new random seed, and the result is computed fresh each time rather than played back from a recording. With the linear model, the two most important features stay at full strength and the other four go to zero, which is the same answer principal component analysis would give. Adding the ReLU keeps the same data and the same two dimensions, and now four or five features fit, either in pairs pointing opposite ways or spread around the circle, depending on the seed. Across ten seeds we tested, the linear model kept two features every time and the ReLU model kept four or five.

The linear model can't use overlapping directions no matter how long you train it, because when two features overlap, the interference between them goes directly into the output every time. The best it can do is keep the top two features and drop the rest, which is one of the strategies you probably tried in the game. That solution is the same one principal component analysis gives, and the model arrives at it even though nothing in the setup mentions PCA.

With the ReLU, some of that interference can be removed, and how it gets removed depends on which of two layouts the run ends up in. In the default run, F1 and F2 point in nearly opposite directions, so when F1 fires on its own the model's reading for F2 comes out at about −1, and because the ReLU turns every negative number into zero, F2's output is still correct. Hit Retrain a few times and you'll also see runs where five features spread out around the circle instead. In that layout the interference comes out slightly positive, so the model learns a negative bias of around −0.2 that lowers every output a little. That's enough to put the small interference values below zero, where the ReLU sets them to zero, while a feature that's actually on is large enough to stay above zero. The ReLU and the bias together work like a noise gate on a microphone, which silences anything below a threshold and lets louder signals through, and this is how the model stores more features than it has dimensions. Nobody designed this arrangement, since it's simply the one that happens to minimize the loss.

Cell phone networks have used a similar idea in a scheme called CDMA, which many 3G phones relied on. It let dozens of phones share one radio channel by giving each phone its own code, letting all the signals overlap on the channel, and having the receiver match each phone's code and cut everyone else's signal below a threshold. In the toy model the features are the phones, the two-dimensional hidden space is the shared channel, and the ReLU with its bias is the receiver. The comparison has limits, since CDMA uses long codes that Qualcomm's engineers designed on purpose while the toy model has two dimensions and finds its layout by gradient descent, but CDMA was used for the same reason the overlap works here, which is that there were more phones than the channel could carry if each had its own slice, and each phone only transmitted some of the time.

Without a nonlinearity, any overlap between features ends up as error in the output, so the model keeps only as many features as it has dimensions. With a ReLU, negative interference gets set to zero and a small negative bias brings slightly positive interference below zero as well, which lets the model store more features than it has dimensions.

3.Sparsity

The noise gate from the last section only removes small interference. When two overlapping features are active on the same input, the interference between them is large enough to get past the bias, and the output comes out wrong. So superposition only works well if overlapping features are rarely active at the same time, which is the case when features are sparse, meaning each one is active on only a small fraction of inputs.

Language data looks sparse in this sense, since specific concepts like Korean text, HTTP requests, or academic citations each show up in only a small fraction of sentences, and they rarely show up together. (The dictionaries learned from real models are sparse too, but that is partly because they are trained with a penalty that makes them sparse, so it isn't separate evidence.) Superposition depends on this rarity, and the slider below sets how rare the features are.

This is the same model as before, with the importances made nearly flat (they go from 1 down to 0.69), so that no feature gets kept just because it matters more. The slider changes one number, which is how often each feature is active, and it works best if you move it slowly from left to right. Training runs the whole time, so the model keeps re-solving the problem for whatever data the slider gives it.

Sparsity controls the geometry 6 features, nearly equal importance live
densesparse
feature directions, adapting live
representation strength ‖Wᵢ‖ regime map (approximate), with your position marked
sparsity — features represented — / 6 the model takes a few seconds to adapt after each move
Move the slider slowly and count the arrows as they appear, from two up to three, four, and five. Give the model a few seconds to settle after each move. At the dense end, features are active together so often that overlapping them doesn't help, and the model keeps exactly two features, the same answer PCA gives. As the features get sparser and collisions become rare, more arrows fit in one at a time, first as opposite pairs and then, at the sparse end, usually as five arrows spread evenly around the circle, although occasionally a run fits all six.

These changes happen suddenly, in that a layout stays the same across a wide range of slider positions and then rearranges within a few percent of the slider's travel, a bit like water that stays ordinary water all the way down to 1°C and then freezes. Elhage et al. call these phase changes, by analogy with physics, and map out where they happen for different numbers of features and dimensions.[1]

At the sparse end, the five arrows are close to full length and evenly spaced, so each one has a small and equal amount of interference with its neighbors. Features are rarely active together at this sparsity, so the ReLU and bias remove almost all of that interference, and the model stores five features in two dimensions with very little error.

The sparser the features, the more of them a space can hold. Features that are rarely active together can share dimensions with little error, so how many features a model can store depends on how often they collide as well as on how many dimensions it has. The layout changes in sudden jumps as sparsity increases.

4.Feature geometry

Nothing in the loss function asks for the regular pentagon at the end of the last section, since all the loss measures is squared reconstruction error. If you add a dimension, regular shapes show up again, which suggests the pentagon wasn't a coincidence. Below is the same kind of model with eight features in three dimensions, shown two ways: the arrows themselves, which you can rotate, and a quantity Elhage et al. call feature dimensionality:

Di = ‖Wi‖² / Σj (Ŵi·Wj)²

You can read Di as how much of a dimension feature i has to itself. A feature with its own axis that nothing else touches gets D=1, a feature that shares an axis with one partner pointing the opposite way gets exactly ½, and a dropped feature gets 0.

Why the fractions come out to exactly ½ and 3/8

The numerator ‖Wi‖² measures how strongly feature i is stored. The denominator adds up how much every feature, including i itself, projects onto i's direction. If i has an axis to itself, the only contribution is from i, and the ratio is 1. If two features share one axis and point in opposite directions, each one's denominator counts both of them, so each gets ½ of a dimension.

More generally, when n features split m dimensions evenly, with every pair equally spread out as in a regular polytope, each feature gets exactly m/n. Eight features in three dimensions gives 3/8, and five in two gives 2/5. The fractions come out this clean because the shapes are regular, and the shapes are regular because an uneven arrangement has a higher loss, so gradient descent moves away from it.

Feature dimensionality is defined in section 5 of Elhage et al. [1].

8 features, 3 dimensions 8 features, 3 neurons, equal importance live
densersparser
drag to rotate · dots = arrow tips
fraction of a dimension each feature gets
Rotate the sphere until the eight dots line up as two squares, one turned 45° from the other. Then watch the chart on the right, where each feature settles at about 3/8 of a dimension. At high sparsity, all eight D values settle at about 3/8, which means the eight features split three dimensions evenly. The arrow tips sit at the corners of a square antiprism, the best known arrangement of eight points for the Thomson problem described below. Lower the sparsity and the features move onto the other flat steps, ½ for an opposite pair and 1 for a feature with its own dimension.

The flat steps at clean fractions point to what the model is doing. It spreads its feature directions over the sphere so that they sit as far from each other as possible, even though nothing in the loss mentions geometry, which is close to a question J. J. Thomson asked in 1904 about how electrons would arrange themselves if they all repelled each other.[6] The best known arrangements for that problem on a sphere are the same shapes on your screen: opposite pairs, triangles, tetrahedra, and square antiprisms. The toy model's loss isn't Thomson's energy, so the two problems don't have to agree in general, but for the cases on this page gradient descent ends up at the same shapes.[1]

The hidden neurons in this toy have no nonlinearity on them, so you could rotate every arrow by the same angle and the model would work exactly as well. That means the neuron axes in this toy carry no meaning of their own, and only the directions of the features matter. (The idea that features correspond to directions is called the linear representation hypothesis, and Park et al. state it precisely enough to test.[10]) Real models are different here, because the GPT-2 neurons at the top of the page come after a nonlinearity, which gives the model a reason to line some features up with individual neurons, and when Elhage et al. tested a model like that, they found some neurons that matched a single feature and many that still didn't.[1]

In this toy, features are stored as directions, and the network spreads those directions into regular shapes that match known solutions to Thomson's problem. The toy's hidden layer has no nonlinearity, so its neuron axes don't matter, but in real models with nonlinear neurons some features do line up with neurons.

5.Polysemanticity

This brings us back to the question from the top of the page. Five feature arrows are spread around a circle and a neuron is one axis through that circle, so we can ask what a single neuron in this model responds to.

Below is the model from the top of the page, the same network you fired concepts into, trained at high sparsity into the pentagon from the sparsity section and then frozen. Each panel shows one hidden neuron's weight on every feature. It is also the model shown in the margin on the left, if your screen is wide enough to show it.

What each neuron “means”the model itself—
Each neuron reads a weighted mix of nearly every feature, positive for some and negative for others, so neither neuron corresponds to any one feature by itself. The features can still be read back almost perfectly, but only along directions that run diagonally across both neurons.

This is the same thing you saw with the lobster and larvae neuron at the top of the page, reproduced in a model with 18 parameters. If five features are stored as a pentagon, any axis you draw passes close to several of them, so each neuron reads out a weighted mix of unrelated features. In this toy, polysemanticity follows directly from the geometry rather than from anything going wrong in training. Olah et al. documented polysemantic neurons in vision models before this mechanism was worked out,[7] and Arora et al. found a similar overlapping structure in word embeddings even earlier.[12]

This helps explain why labeling what each neuron does has been so hard in language models. It doesn't always fail, and the same vision models have many neurons that respond to one clear thing, like curves or dog heads.[7] But when features outnumber neurons and are stored this way, the neuron axes aren't the directions the features are stored along. In the toy nothing is lost, since all the features are still there and can be read back almost perfectly along their own directions, which are rotated away from the neuron axes we were reading.

If superposition mixes the features together in a way we understand, it might be possible to undo it.

In this toy, polysemanticity follows directly from superposition. When n features are stored as a regular shape in m<n dimensions, every neuron axis crosses several features, so reading single neurons gives mixed results. In real models with nonlinear neurons, some features line up with neurons and many don't.

6.Sparse autoencoders

The reverse problem is to start from the hidden activations h, which are two numbers per input with all the features mixed together, and recover the original features from them. You don't know how many features there are or which directions they point in, and there is no answer key to check against.

The usual approach relies on sparsity, the same property that made superposition possible. If the true features are sparse, then any single activation can be explained using only a few of them, so the sparsest explanation that still reconstructs the data accurately is likely to be the true one. This is the idea behind the sparse autoencoder.[2][4] It learns a dictionary of candidate directions that is larger than needed (ten here, for at most six real features), rebuilds each activation out of those dictionary entries, which are called atoms, and adds a penalty of strength λ for every atom an explanation uses.

Background on autoencoders, dictionaries, and why an L1 penalty produces zeros

An autoencoder is a network trained to output its own input. That would be pointless except that the middle is constrained, and the constraint forces it to learn something about the structure of the data. The toy model was an autoencoder too, and its constraint was that the middle had only two dimensions. A sparse autoencoder uses a different constraint, where the middle layer is bigger than the input (10 slots for 2 numbers, which is what “overcomplete dictionary” means), but it is penalized for having many slots active at the same time.

That penalty, λ times the sum of the activations, is called an L1 penalty. It pushes activations all the way to zero instead of just making them smaller because it charges the same amount for the first bit of activation as for the last, so the cheapest way to lower the penalty is to turn slots off completely. A squared penalty would charge almost nothing for values near zero, so activations would get small without ever quite reaching zero. If you raise λ far enough, slots stop being used entirely, and you will see that happen in the figure below.

The setup is described in the “Problem Setup” section of Bricken et al., Towards Monosemanticity [2].

Because this is a toy, we have something nobody has for a real model, which is the true features, so we can check how well the SAE did instead of just looking at its output. The thick colored arrows below are the true features and the pale arrows are the dictionary atoms, training live, and when you move λ the dictionary changes in response. This figure also lets you click any atom to ablate it, which forces it to stay at zero so you can see what the reconstruction loses without it.

Sparse autoencoder vs. ground truth trained on the model's activations —
λ lowhigh—
thick color = true features · pale = SAE atoms · dashed = dead · click an atom to ablate it
—
feature recovery
—
live atoms
—
atoms used per input
—
reconstruction error
Slide λ to both ends and back to the middle. Then click an atom to ablate it, and watch the reconstruction error go up, one feature drop out of the recovery score, and the remaining atoms shift toward the gap. Click it again to restore it. Recovery measures how closely each true feature direction is matched by some live atom. When λ is too low, reconstruction is good, but each input gets spread across four or five atoms, which is another mixed code and no easier to read than the neurons. Between about 0.1 and 0.5, each active feature uses one atom, the atoms line up with the true directions, and the extra atoms go unused. When λ is too high, atoms drop out one at a time until nothing is represented.

The SAE wasn't told there were five features or that they formed a pentagon. It only saw two-dimensional points, and the sparsity penalty was enough to move its atoms onto the true directions. That works here because, for this data, the sparsest accurate description of the hidden activations is the original set of sparse features. That isn't guaranteed in general, and on real models SAEs sometimes merge features or split one feature into several. The idea is also much older than interpretability research. In 1996 Olshausen and Field got receptive fields resembling those in visual cortex out of natural images just by asking for a sparse code,[8] and at the time it was a claim about how the visual system works.

The two ends of the slider show the same problems people run into with SAEs on real models. With too little penalty the dictionary stays mixed, and with too much, features disappear or break into pieces. On a real model there are no thick colored arrows showing the right answer, so choosing λ relies on proxy metrics, and changes to the method like k-sparse autoencoders, which set the number of active atoms directly, are one current way around it.[5] It isn't a solved problem, which is part of why a toy where the answer is known is useful for checking the method.

Removing a suspected feature to see what breaks is a basic experiment in interpretability. Here it takes one click and the effect shows up on a meter, while on a large model the same kind of experiment takes much more work.

Below are three atoms from a dictionary trained the same way on GPT-2's residual stream, with their records copied exactly. At the top of the page you couldn't finish the sentence “this neuron detects ___”, so try it again with these.

Real dictionary atoms real model, verbatim records
—
hover a lit token gpt2-small · layer 6 residual · SAE by Joseph Bloom · via Neuronpedia
Flip through all three atoms and try to name each one. Records retrieved from Neuronpedia [3], and each atom's ID links to its live page. Each of these atoms has one meaning you can name, unlike the neurons at the top of the page, with two caveats. We picked these three because they are easy to read, and many atoms in dictionaries like this are harder to name. They also come from GPT-2 small, while the neurons at the top came from GPT-2 XL, so this isn't a comparison within one model.
The same sparsity that lets networks store features in superposition can be used to pull them back apart. Dictionary learning with a sparsity penalty recovers the true feature directions in this toy, and the bet behind SAE-based interpretability is that it does something similar in real models.

7.What carries over to real models

Everything on this page used six or eight features and two or three dimensions, which is very far from a real model. The smallest GPT-2 has 768 dimensions per layer, and the largest published dictionaries have tens of millions of features. Even so, the same method has worked at that scale in some cases. Trained on a production model's residual stream, the dictionary included atoms for the Golden Gate Bridge, for backdoors in code, and for sycophantic praise, each a single direction in the residual stream that a person could name.[3]

A lot about this is still unsettled. SAEs have their own versions of superposition's tradeoffs, since the features they recover split and merge as the dictionary grows,[2] and some structure isn't a straight-line direction at all. Days of the week and months of the year, for example, come out arranged in circles, which a dictionary of single directions can't recover cleanly.[11] You have already seen two of these problems in the λ slider, where features died at one end and broke into pieces at the other.

The overall picture still holds up with those caveats. A model has far more things to track than it has dimensions, most of those things are rare, and the model stores them as overlapping directions and uses the ReLU and bias to remove most of the interference. If you read the result one neuron at a time, you get something like the lobster and larvae neuron from the top of the page, but along the right directions much of it becomes readable again. A large part of interpretability research right now is about finding those directions, and the sparse autoencoder you trained above is one of the main tools for doing it.