Where LLMs Store Facts
How Multilayer Perceptrons Store Information in Transformers
Facts Inside Large Language Models
Large language models can often complete statements such as:
“Michael Jordan plays the sport of ___”
with basketball. This behavior suggests that the model contains information connecting a particular person with a particular sport. The model does not store this fact as a readable sentence in one location. Instead, the information is distributed across the model’s learned parameters—hundreds of billions of numerical values adjusted during training.
A major question in mechanistic interpretability is:
Where, mathematically, do facts such as “Michael Jordan plays basketball” live inside a language model?
A complete answer remains unknown. However, research indicates that a significant amount of factual knowledge is associated with the multilayer perceptron (MLP) blocks inside transformer networks.
MLPs make up one of the two major computational components in a transformer:
Attention blocks allow token representations to exchange information with one another.
MLP blocks apply learned transformations independently to each token representation and may provide substantial capacity for storing and applying factual associations.
Normalization layers regulate the numerical behavior of the representations between operations.
The computation performed by an MLP is relatively simple compared with attention. It consists primarily of:
A matrix multiplication and bias addition.
A nonlinear activation function.
A second matrix multiplication and bias addition.
Addition of the result back to the original token representation.
Although the computation is simple, determining what the learned matrices represent is extremely difficult.
The Transformer Processing Pipeline
A language model is trained to predict the next token in a sequence.
Tokens and Embeddings
The input text is first divided into tokens. A token may be:
A complete word.
A piece of a word.
Punctuation.
Another frequently occurring text fragment.
Each token is converted into a high-dimensional vector called an embedding. A vector is a long list of numerical components that represents information about the token.
The sequence of token vectors repeatedly passes through transformer layers. Each layer generally includes:
An attention operation.
A normalization step.
An MLP operation.
Another normalization or related architectural operation, depending on the model design.
As the vectors move through the network:
Attention incorporates information from other tokens in the context.
MLPs apply learned transformations that may retrieve, combine, or modify information.
The representations become increasingly contextual and useful for predicting the next token.
By the final layers, each vector must contain enough information about both the input context and the model’s learned knowledge to support next-token prediction.
Contextual Meaning
A token vector does not retain only the isolated meaning of its original token. Its meaning changes as it passes through the network.
For example, the representation associated with a word might eventually encode:
The word’s ordinary semantic meaning.
The grammatical role it plays.
Information from nearby words.
Information from distant words through attention.
Relevant facts learned during training.
Predictions about what should come next.
Thus, a vector associated with the token “Jordan” might eventually encode that it is part of the name “Michael Jordan,” depending on the surrounding context.
Meaning as Directions in High-Dimensional Space
A central idea in neural network representation is that different directions in a high-dimensional vector space can correspond to different features or concepts.
Vector Directions and Semantic Features
Suppose a vector space contains a direction representing gender. A classic example is the relationship between the embeddings of “man” and “woman.” The difference between these embeddings can be treated as a gender-related direction:
If this direction is added to the embedding of another masculine term, such as “uncle,” the resulting vector may be close to the embedding of the corresponding feminine term, “aunt”:
This does not mean that every concept is represented by one perfectly isolated direction. Rather, it illustrates the possibility that directions in vector space encode relationships or features.
Other directions might represent:
Gender.
Number, such as singular versus plural.
Tense.
Names.
Locations.
Occupations.
Sports.
Emotional tone.
Syntactic roles.
Relationships between entities.
Dot Products as Feature Measurements
A vector’s alignment with a particular direction can be measured using a dot product.
If E is a token representation and M is a direction representing the first name “Michael,” then:
indicates how strongly E aligns with the “Michael” direction.
For the simplified toy model:
A dot product of 1 indicates the presence of the feature.
A dot product of 0 or a negative value indicates little or no alignment.
Values greater than 1 are ignored for simplicity.
The same idea applies to directions representing “Jordan” and “basketball.”
These assumptions are deliberately simplified. Real transformer representations are more distributed and complicated, but the toy model makes the MLP computation easier to understand.
A Toy Representation of “Michael Jordan Plays Basketball”
To illustrate how an MLP might store a fact, consider three directions in the model’s vector space:
M: the direction representing the first name “Michael.”
J: the direction representing the last name “Jordan.”
B: the direction representing “basketball.”
The directions for “Michael” and “Jordan” are assumed to be nearly perpendicular. This means that the presence of one does not strongly interfere with the measurement of the other.
A vector representing the full name “Michael Jordan” should satisfy:
and
The vector must therefore contain both name-related features.
Because “Michael Jordan” is normally split into two tokens, an earlier attention block would first need to transfer information between the token representations. In particular, the representation associated with the second token might need to receive information about the first token so that it encodes the complete name.
Once the vector represents both “Michael” and “Jordan,” the MLP can detect this combination and add the “basketball” direction to the representation.
The toy interpretation is that an MLP recognizes the combination “Michael” AND “Jordan” and then writes the associated feature “basketball” into the vector.
The Structure of a Multilayer Perceptron
Independent Processing of Each Token
An MLP receives a sequence of token vectors. It applies the same sequence of operations to every vector individually.
If the input sequence is:
then the MLP processes each vector separately:
and so on.
The vectors do not communicate with one another inside the MLP. They are processed in parallel.
This differs from attention:
Attention: token representations interact and exchange information.
MLP: each token representation is transformed independently.
The input and output vectors have the same embedding dimension because the MLP’s output is eventually added back to the original vector.
Step 1: The Up Projection
The first operation is multiplication by a large learned matrix. This matrix expands the vector into a higher-dimensional space.
Let:
E represent the input embedding vector.
Wup represent the up-projection matrix.
Bup represent the bias vector.
The first transformation is:
The matrix contains parameters learned from training. These parameters determine which properties of the input vector are measured.
Rows as Questions
Matrix multiplication can be understood row by row. Each row of Wup acts like a direction that asks a question about E.
If a row equals the “Michael” direction M, then the corresponding output component is:
This component is large when E strongly represents “Michael.”
A row can also represent a combination of directions. Suppose one row is:
The corresponding dot product becomes:
If E represents both “Michael” and “Jordan,” then both dot products equal 1, so the total is:
If only one feature is present, the result is approximately 1. If neither is present, the result is zero or negative.
Each row can therefore be viewed as a feature detector or a question about the input representation.
The Bias Vector
The bias vector shifts the output of the matrix multiplication. For the toy example, suppose the first component of the bias is −1.
The relevant component then becomes:
Under the simplified assumptions:
If both “Michael” and “Jordan” are present, the value is 2−1=1.
If only one is present, the value is 1−1=0.
If neither is present, the value is less than or equal to −1.
This produces a positive value precisely when both name features are present.
The bias helps shift the detector’s threshold so that it responds to the desired combination rather than to either feature independently.
Number of Up-Projection Rows
In GPT-3, the up-projection matrix has just under 50,000 rows. The embedding dimension is 12,288.
The number of rows determines the number of intermediate values, often called neurons after the activation function. Each row can potentially detect a different property or combination of properties.
Step 2: The Nonlinear Activation Function
The matrix multiplication is a linear operation. However, language and conceptual relationships are highly nonlinear.
A purely linear detector for M+J would also respond partially to unrelated combinations such as:
“Michael Phelps.”
“Alexis Jordan.”
The model needs a mechanism that can behave more like a logical condition:
Activate only when the relevant combination is present.
ReLU
A common nonlinear function is the rectified linear unit, or ReLU. It is defined as:
It has two effects:
Positive values remain unchanged.
Negative values are replaced by zero.
For the toy detector:
A value of 1 for “Michael Jordan” remains 1.
A value of 0 or a negative value becomes 0.
Thus, the ReLU converts the shifted detector into a clean activation:
This behaves approximately like an AND gate:
It is active when both “Michael” and “Jordan” are present.
It is inactive when one or both features are absent.
GELU
Modern language models often use GELU, the Gaussian Error Linear Unit, instead of ReLU. GELU has a similar general shape but changes the values more smoothly rather than sharply clipping every negative value to zero.
For conceptual explanations, ReLU is often easier because its behavior clearly illustrates feature detection and thresholding.
Neurons
The values produced after the nonlinear activation are commonly called the model’s neurons.
A neuron is:
A scalar value produced by a particular row of the up-projection matrix.
Active when its value is positive or otherwise sufficiently large.
Inactive when its value is zero or near zero, depending on the activation function.
The familiar neural network diagram showing dots connected by lines generally represents:
A linear transformation.
A nonlinear function applied to each component.
In an MLP, the intermediate neuron vector is much larger than the original embedding vector.
Step 3: The Down Projection
The second matrix multiplication maps the high-dimensional neuron vector back into the original embedding space.
Let:
H be the activated neuron vector.
Wdown be the down-projection matrix.
Bdown be the second bias vector.
The operation is:
The output D has the same dimension as the original embedding vector E.
Columns as Output Directions
The down projection is easier to understand column by column.
Each column of Wdown has the dimensionality of the original embedding space. Therefore, each column can be interpreted as a direction that will be added to the output when the corresponding neuron is active.
If the first column equals the “basketball” direction B, then the corresponding contribution is:
where H1 is the activation of the first neuron.
If H1=1, the basketball direction is added.
If H1=0, that column contributes nothing.
If H1 is larger or smaller, the basketball direction is added with a corresponding scale.
The model can associate several output features with the same neuron. For example, a column might encode a combination of properties related to:
Basketball.
Professional athletes.
A particular geographic or cultural context.
Other information associated with the detected pattern.
Every column specifies what should be written into the output representation when its corresponding neuron activates.
The Down-Projection Bias
The second bias vector is added regardless of the neuron activations:
Its exact function is difficult to interpret. It may support bookkeeping, shifting, or other learned adjustments. For a simplified explanation of factual retrieval, it can generally be ignored.
Step 4: Adding the MLP Output to the Original Vector
The MLP output is added to the vector that entered the block:
Combining the operations gives the general form:
The use of addition means the MLP modifies the existing representation rather than completely replacing it.
For the toy fact:
The input vector encodes “Michael” and “Jordan.”
A row of Wup detects the combination.
The bias shifts the value so that the detector is positive only for the desired combination.
ReLU activates the corresponding neuron.
The corresponding column of Wdown contributes the “basketball” direction.
The basketball direction is added to the original vector.
The resulting vector may encode the combination:
Michael.
Jordan.
Basketball.
This illustrates how an MLP could, in principle, implement a factual association.
MLPs and Parameter Storage
Number of Parameters in One MLP
For GPT-3, the embedding dimension is 12,288, and the up-projection matrix has just under 50,000 rows. The number of parameters in the up-projection matrix is approximately:
The down-projection matrix has the transposed shape and therefore contains approximately the same number of parameters:
Together, the two matrices contain about:
The bias vectors add additional parameters, but their contribution is small compared with the matrices.
Number of MLPs in GPT-3
GPT-3 contains 96 distinct MLP blocks. Therefore, the total number of parameters associated with the MLPs is approximately:
This represents roughly two-thirds of GPT-3’s total parameters.
The approximate distribution is:
MLP blocks: about 116 billion parameters.
Attention blocks, embeddings, unembedding, and other components: the remaining parameters.
Total: about 175 billion parameters.
Normalization parameters and bias vectors are present but make up only a small fraction of the total.
MLP blocks contain most of the parameters in a large transformer, making them a natural place to investigate how the model stores and applies factual knowledge.
Neurons Across a Sequence
An MLP may have approximately 50,000 intermediate neurons for each token position. If the input contains n tokens, then the computation involves approximately:
individual neuron activations across the sequence.
The MLP weights are shared across positions, but each token position produces its own activation values.
Why the Toy Interpretation Is Incomplete
The toy example is useful because the mathematics supports the interpretation:
Rows of the up-projection matrix detect directions or combinations of directions.
Neurons indicate how strongly those detectors activate.
Columns of the down-projection matrix specify output directions.
Active neurons write those directions into the residual representation.
However, these facts alone do not prove that a real model contains one clean neuron for “Michael Jordan.”
The mathematical interpretation is valid, but the learned representations may be much more distributed.
Research suggests that individual neurons rarely represent one clean, human-interpretable feature. A single neuron may respond to multiple unrelated concepts, and a single concept may be represented by a combination of many neurons.
One explanation for this is called superposition.
Superposition in High-Dimensional Representations
Orthogonal Feature Directions
Suppose a model uses an n-dimensional vector space to represent features. If every feature must occupy a direction that is exactly perpendicular to every other feature, then the space can contain at most n mutually orthogonal directions.
This is closely related to the mathematical definition of dimension.
If features are represented by orthogonal directions:
Adding one feature does not affect the measurement of another.
Each direction can be interpreted independently.
The total number of cleanly separable features is limited by the number of dimensions.
For example, a 100-dimensional space could contain at most 100 mutually perpendicular feature directions.
Nearly Perpendicular Directions
The model does not necessarily require perfect independence. It may tolerate a small amount of interference if feature directions are only approximately perpendicular.
For example, feature vectors could be allowed to lie between 89∘ and 91∘ apart rather than requiring exactly 90∘.
In two or three dimensions, relaxing the condition provides little additional capacity. In very high-dimensional spaces, however, the number of nearly perpendicular vectors can become dramatically larger than the number of dimensions.
This makes high-dimensional representations especially powerful.
Random High-Dimensional Vectors
Random vectors in a high-dimensional space naturally tend to have angles close to 90∘ from one another.
For example, consider:
10,000 random vectors.
Each vector has 100 dimensions.
There are far more vectors than dimensions. Although their pairwise angles initially vary, many are already concentrated near 90∘.
If an optimization process repeatedly adjusts the vectors to make them more perpendicular, the pairwise angles can become tightly concentrated in a narrow interval such as:
Thus, a high-dimensional space can contain many vectors that are approximately independent even though it cannot contain that many exactly orthogonal vectors.
Johnson–Lindenstrauss Lemma
A consequence associated with the Johnson–Lindenstrauss lemma is that the number of vectors that can be placed in a space while preserving approximate distances or near-orthogonality grows very rapidly—roughly exponentially—with the number of dimensions.
The important implication is:
A high-dimensional space can store far more approximately independent features than its raw number of dimensions might suggest.
For example, increasing the number of dimensions by a factor of 10 can provide much more than 10 times the capacity for approximately independent ideas.
This may help explain why language model performance often improves strongly as model size and dimensionality increase.
Superposition in MLP Neurons
Superposition may occur not only in the embedding space but also in the intermediate neuron space of an MLP.
A GPT-3-sized MLP has approximately 50,000 neuron dimensions. A simplistic interpretation would assume that the MLP probes approximately 50,000 separate features—one for each neuron.
Under superposition, the MLP may represent many more than 50,000 features using combinations of neurons.
In that case:
A single feature does not correspond to one neuron.
Several neurons may activate together to represent one feature.
A single neuron may participate in representing several different features.
Individual neuron activations may appear difficult to interpret.
The meaningful representation exists in a pattern across multiple neurons.
This is why a feature such as “Michael Jordan” might not be visible as one neuron lighting up. Instead, it might correspond to a particular combination of activations distributed across many neurons.
Advantages and Costs
Superposition provides additional representational capacity.
Advantage:
The network can encode many more features than there are available dimensions.
Cost:
Features interfere with one another slightly.
Individual neurons become difficult to interpret.
The model’s internal representations become distributed and entangled.
This trade-off may contribute both to the impressive scaling behavior of language models and to the difficulty of explaining their internal computations.
Sparse Autoencoders and Interpretability
A sparse autoencoder is a tool used in interpretability research to investigate hidden features represented in superposition.
The goal is to transform the model’s dense neuron activations into a larger set of more interpretable features. The sparsity constraint encourages only a small number of these features to activate for any particular input.
A sparse autoencoder can be used to:
Receive the original neuron activations.
Represent them using a larger set of candidate features.
Encourage only a few features to be active at once.
Reconstruct the original activation pattern.
Examine the learned features for semantic or conceptual meaning.
This approach attempts to uncover the underlying features even when they are distributed across many original neurons.
Sparse autoencoders do not automatically provide a complete explanation of a model. They are interpretability tools that can help researchers identify patterns hidden by superposition.
Core Conceptual Summary
How an MLP Could Store a Fact
The toy mechanism for storing “Michael Jordan plays basketball” can be summarized as follows:
Attention combines context.
Information from the “Michael” token is transferred to the “Jordan” token so that one vector represents the full name.The up projection detects features.
Rows of Wup take dot products with the input vector and measure properties such as the presence of “Michael” and “Jordan.”The bias sets a threshold.
A learned bias can make a detector positive only when both features are present.The nonlinear function selects the pattern.
ReLU or GELU converts the intermediate value into an activation, approximating an AND-like condition.The down projection writes information.
A column of Wdown contributes the “basketball” direction when the relevant neuron or neuron combination activates.The result is added to the existing representation.
The output vector contains the original information plus the retrieved factual association.
What Is Known and Unknown
Supported by the computation:
Up-projection rows act as input-space directions.
Neuron activations measure responses to those directions.
Down-projection columns specify output-space directions.
MLPs can add learned information to token representations.
Still uncertain:
Whether real factual knowledge is stored as clean individual features.
Which exact MLP block contains a particular fact.
Whether one fact corresponds to one neuron, many neurons, or distributed patterns.
How factual knowledge is organized across layers.
How attention and MLPs jointly retrieve and apply facts.
The strongest current interpretation is that MLPs provide substantial capacity for storing and transforming learned information, but the information is often encoded in superposition rather than in individually readable neurons.
MLPs therefore combine a simple computational structure—two matrix transformations with a nonlinear function—with highly complex internal representations whose meanings are distributed across high-dimensional spaces.

Ask anything
We've read this whole study set, so questions about it get the best answers.