Probing & the Linear Representation Hypothesis
Linear probes, control tasks, steering vectors and the geometry of concepts.
Train a GPT-style network only on sequences of legal Othello moves and it never sees a board. Yet a small MLP probe reads the state of every square from its activations, and a linear probe does too, once it asks "mine or the opponent's?" instead of "black or white?". This lesson makes probing rigorous: what probe accuracy can and cannot show, how to erase a concept with a provably minimal edit, what it means for a concept to be a direction, how such directions steer a model, and where linearity breaks down.
What you’ll learn
- Design probing experiments, including the structural probe for syntax trees, and interpret them with control tasks and selectivity.
- Prove that a representation hides a concept from every linear predictor exactly when the class means coincide, and use the least-squares eraser built on that fact to test whether a model uses a property.
- State the linear representation hypothesis in its subspace, measurement and intervention forms, prove that an unembedding concept direction acts as a linear probe, and explain the causal inner product.
- Build steering vectors from differences of means, apply activation addition and directional ablation, and weigh the evidence they give.
- Explain where linearity fails, with circular features for days and months as the example.
What a probe measures
Fix a network, a layer and a labeled dataset . A probe from a class (linear maps, small MLPs) is trained on the frozen activations , and its held-out accuracy estimates how much of is extractable by from layer . Probing flourished in NLP: Conneau et al. (2018) built ten probing tasks for sentence embeddings, from sentence length and word content to tree depth, tense and the number of the subject, and probing BERT layer by layer became a literature of its own (Belinkov, 2022, surveys it).
Two refinements turned probing from a classification exercise into a measuring instrument: probes for structure rather than labels, and controls that separate what the representation contains from what the probe can learn.
A parse tree is not a label but a metric: the tree distance counts the edges between two words of a sentence. Look for a linear map under which squared distances between the words' vectors reproduce it:
is a positive semidefinite matrix, so is a valid (pseudo)metric for every . Fit by gradient descent over all word pairs of all training sentences , normalizing by the pairs per sentence:
Decode a tree as the minimum spanning tree of the predicted distances and score the fraction of correct undirected edges (UUAS). A companion depth probe fits to each word's depth in the tree.
On the Penn Treebank, BERT-large's layer 15 reached a UUAS of 82.5 and ELMo's first layer 77.0, against 59.8 for the strongest baseline, non-contextual embeddings passed through a randomly initialized BiLSTM. Raising the rank beyond 64 or 128 gave no further gains. Syntax trees are embedded, approximately, as squared distances in a low-dimensional subspace of these representations.
Decodable versus used
How much of a probe's accuracy belongs to the representation and how much to the probe? Hewitt & Liang (2019) answered with control tasks. For part-of-speech tagging, each word type is assigned one tag drawn at random from the empirical tag distribution, and every occurrence of the word gets that tag. The task has the same inputs and outputs as the real one, but the only way to solve it is to memorize word identities, so a control task measures the probe's own capacity on this representation. A good probe is selective: high accuracy on the real task, low on the control. Selectivity is the difference.
On ELMo's first layer, an MLP probe tagged parts of speech with 97.3% accuracy but also reached 92.8% on the control task, a selectivity of only 4.5 points. A linear probe was nearly as accurate on the real task, 97.2%, and much worse at memorizing:
The linear probe on ELMo's first layer reached 97.2% on part-of-speech tagging and 71.2% on the control task. What is its selectivity, in percentage points?
Show the answer
26 points
points, against for the MLP probe with almost the same task accuracy. The MLP's extra 0.1 point is better explained by its capacity to memorize than by anything in the representation. Selectivity can even reverse comparisons between layers: on ELMo's second layer the linear probe was slightly less accurate (96.6%) but more selective (31.4 points), so which layer "represents part of speech better" depends on the question asked.
Voita & Titov (2020) replaced accuracy by minimum description length: the number of bits needed to transmit the labels given the representations, which also charges for the effort needed to reach that quality: a large probe, or a lot of training data. Either way, a probe can only show that information is there.
Whether the network uses it requires an intervention. Amnesic probing (Elazar, Ravfogel, Jacovi & Goldberg, 2021) removes a property from a layer of BERT-base and measures how the model's own word predictions change. The removal is iterative nullspace projection (INLP; Ravfogel et al., 2020): train a linear classifier for the property, project every activation onto its nullspace, , and repeat until no linear classifier beats the majority class. The results split cleanly. Phrase starts were decodable from BERT's last layer (85.1% against a 59.3% majority baseline), yet removing them left word-prediction accuracy unchanged at 94%: decodable, not used. Removing fine-grained part of speech took 585 of the 768 directions and dropped accuracy from 94.1% to 12.3%; removing 585 random directions dropped it to 56.5%, so part of the damage was lost capacity rather than lost information. These figures are for unmasked input, where BERT predicts each word it can see; with the words masked every accuracy is lower, but the pattern is the same.
Take any linear predictor. Condition on the class, then apply Jensen's inequality inside each class, which is allowed because is convex in ; linearity moves the conditional expectation inside :
With equal centroids, , so the right side is the loss of the constant predictor , which the best constant predictor matches or beats:
The converse needs only the cross-entropy loss: if a constant predictor is optimal for it, every class has the same mean (their Theorem 3.3). So whether a concept is linearly readable depends on the class means alone. That is why the difference of class means keeps reappearing in this lesson as the direction of a concept.
The theorem turns erasure into linear algebra: an affine map guards exactly when it zeroes the cross-covariance . Among all such maps, LEACE (least-squares concept erasure) changes the representation least, in squared distance and in every Mahalanobis-type norm at once. With the whitening matrix and the orthogonal projection onto the column space of , the eraser is . For a concept with classes it removes a subspace of rank at most , a single direction for a binary concept, where INLP often needs dozens of iterations.
import numpy as np
def leace(X, Z):
"""Least-squares linear concept erasure. X: (n, d) activations; Z: (n, k) one-hot labels."""
mu = X.mean(0)
Xc, Zc = X - mu, Z - Z.mean(0)
s_xx, s_xz = Xc.T @ Xc / len(X), Xc.T @ Zc / len(X)
lam, V = np.linalg.eigh(s_xx)
keep = lam > 1e-9 * lam.max()
W = V[:, keep] @ np.diag(lam[keep] ** -0.5) @ V[:, keep].T # whitening (Sigma^1/2)^+
W_inv = V[:, keep] @ np.diag(lam[keep] ** 0.5) @ V[:, keep].T # its pseudo-inverse
U, s, _ = np.linalg.svd(W @ s_xz, full_matrices=False)
U = U[:, s > 1e-9 * s.max()] # basis of colsp(W Sigma_XZ)
M = W_inv @ U @ U.T @ W # the component that is removed
return lambda x: x - (x - mu) @ M.TOn synthetic data with ten correlated features and a binary concept, the erased data have class means equal to within , a logistic-regression probe falls from almost 100% accuracy to the majority rate, and the edit has rank one. Belrose et al. reran amnesic probing on BERT-base with LEACE in place of INLP to avoid the collateral damage of large projections.
Concepts as directions
The linear representation hypothesis says that high-level concepts are represented as directions. Park, Choe & Veitch (2024) noticed that the phrase hides three different claims, and formalized them for a language model whose next-token distribution is , with the final hidden state (the embedding of the context) and the unembedding vector of token :
- Subspace. Words that differ only in the concept differ by a common direction: points the same way as .
- Measurement. A linear probe on reads the concept.
- Intervention. Adding a fixed vector to changes the concept and nothing else.
A binary concept , such as malefemale, is specified by counterfactual pairs of outputs that differ only in , such as (king, queen) or (roi, reine). Its unembedding representation is a vector such that is a positive multiple of for every pair.
Conditioning on the output being one of the pair cancels the softmax normalizer, so the log-odds are a difference of logits:
By the subspace assumption the difference is for some , which gives the claim. The probe direction is shared by all pairs, while may differ between (king, queen) and (roi, reine).
To compare concept directions, or to project one out, you need an inner product, and the Euclidean one is arbitrary: the model is unchanged if and for any invertible , and that changes every Euclidean angle. Park et al. ask instead for a causal inner product, one under which causally separable concepts, which can vary freely and independently (EnglishFrench and malefemale), are orthogonal. Under any such inner product the map sends each concept's unembedding representation to its embedding representation, the vector whose addition steers that concept alone. Assuming that a random word's values of separable concepts are independent, they derive a family of such inner products, and use
where is the unembedding of a word drawn uniformly from the vocabulary.
On LLaMA-2-7B, for 26 of 27 concepts (grammatical, semantic and translation concepts), differences of counterfactual pairs were far more aligned with the estimated direction than differences of random pairs (the exception was thingpart), and causally separable concepts came out roughly orthogonal under this inner product but not under the Euclidean one.
More evidence. Marks & Tegmark (2024) built datasets of simple true and false statements and found, in LLaMA-2 models of increasing size, a direction separating true from false that transferred across datasets; shifting activations along it made the model treat false statements as true and vice versa. Their mass-mean probe is just the difference of class means, : logistic regression tilts its direction to avoid interference from other, non-orthogonal features, while the mean difference does not, and it identified directions that were more causally implicated in the outputs.
Othello. Li et al. (2023) trained a GPT model only on legal move sequences. Linear probes for each square's state (black, white or empty) never got below about 20% error, while two-layer MLP probes reached 1.7%, and editing the activations according to the MLP probe changed the model's predicted legal moves accordingly. Nanda, Lee & Wattenberg (2023) then found the board linear after all, in a different basis: relative to the player to move. Linear probes for {mine, yours, empty} reached 99.6% accuracy against 75.0% for {black, white, empty}, and adding probe directions flipped squares in the model's world model.
In Othello-GPT, linear probes for {black, white, empty} topped out near 75% accuracy, while linear probes for {mine, yours, empty} reached 99.6%. What is the best reading?
- The board is represented nonlinearly, and the second probe found a shortcut
- The board is represented linearly, but as features relative to the player to move; "black" is a nonlinear function of "mine" and whose turn it is
- Linear probes are too weak for game states in general
- The model represents only which squares are empty
Show the answer
B. The board is represented linearly, but as features relative to the player to move; "black" is a nonlinear function of "mine" and whose turn it is
Which color counts as "mine" alternates with every move, so a square's color is the exclusive-or of the linear mine/yours feature and whose turn it is: not linearly decodable, though the underlying representation is linear. A failed linear probe can mean the wrong concept was probed, not that the representation is nonlinear. Interventions along the {mine, yours} directions behaved as the model's world model would predict.
Steering: writing a direction back in
If a concept is a direction, adding the direction should change the concept. Activation addition (Turner et al., 2023) builds a steering vector from a single pair of prompts such as "Love" and "Hate": run both, take the difference of their activations at layer , and add times it to the activations of a new prompt at the same layer. Middle layers worked best. Inference-time intervention (Li, Patel, Viégas, Pfister & Wattenberg, 2023) trains probes on individual attention heads to find those whose outputs separate truthful from untruthful answers, then shifts those heads along truth-related directions during generation. In the paper's own evaluation it raised the share of Alpaca's answers on the TruthfulQA benchmark judged both true and informative from 32.5% to 65.1%, at a cost in helpfulness that the strength of the shift trades off. Representation engineering (Zou et al., 2023) generalizes the program: population-level directions, read from contrasting stimuli, used to monitor and control concepts such as honesty and harmlessness.
The cleanest test of a direction combines writing and erasing. Arditi et al. (2024) took the difference of mean residual-stream activations between harmful and harmless instructions, at one layer and position, and intervened in two ways:
Think first Why is the ablation applied at every layer and position, while the addition is applied at a single layer?
The two interventions test different things. Addition asks whether the direction is sufficient to produce refusal: writing it once is enough if later components read it. Ablation asks whether it is necessary, and removing it at one layer would not settle that, because later attention and MLP sublayers could write the direction back from other information. Projecting it out of every residual-stream activation keeps the model from ever representing it, which is what "refusal is mediated by this direction" requires.
Where linearity ends
The Othello story is a warning in two directions: a failed linear probe may have probed the wrong concept, and a successful one says nothing about concepts nobody probed. Engels, Michaud, Liao, Gurnee & Tegmark (2025) went looking for features that are inherently multi-dimensional. Clustering the dictionary features of sparse autoencoders (Dictionary Learning at Scale) in GPT-2 and Mistral 7B, they found strikingly interpretable ones: the days of the week and the months of the year, each arranged on a circle in a two-dimensional subspace.
Points spread around a circle are the basic example: rotating the circle leaves the distribution unchanged, and its two coordinates stay dependent (knowing one pins the other to two values), so no choice of axes makes them independent. Engels et al. measured how far real clusters are from separable or mixed with two empirical indices, and then tested use. On modular-arithmetic questions about days and months (which day comes two days after Monday?), intervening on the circle subspace in Mistral 7B and Llama 3 8B shifted the models' answers in the way the circular representation predicts. The models appear to do modular arithmetic on days and months on the circle. "Linear representation" is thus a property of a concept, a layer and a choice of coordinates together, not of a network as a whole.
Key takeaways
- A probe measures what a class of readouts can extract from a layer. Structural probes find syntax trees as squared distances in a low-rank subspace; control tasks and selectivity separate the representation from the probe's capacity.
- A representation is linearly guarded against a concept exactly when the class means coincide, so erasure is linear algebra: LEACE removes the smallest possible subspace, rank at most , and amnesic experiments use erasure to test whether a property is used.
- The linear representation hypothesis has subspace, measurement and intervention forms. If counterfactual unembedding differences share a direction, that direction is a linear probe, and a causal inner product such as makes separable concepts orthogonal.
- Difference-of-means directions read and steer concepts: truth, refusal, board states. Adding a direction writes a concept; projecting it out at every layer removes it.
- Linearity has limits: some features are irreducibly multi-dimensional, such as the circles on which language models place days and months.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
After applying an eraser, the class-conditional means of a layer's activations are identical for every value of a concept. What is guaranteed?
- No classifier of any kind can recover the concept from the erased activations
- The model can no longer use the concept anywhere in its computation
- No linear predictor, trained with any convex loss, does better at predicting the concept than a constant
- The eraser removed at least as many dimensions as there are classes
Show the answer
C. No linear predictor, trained with any convex loss, does better at predicting the concept than a constant
Equal class means are equivalent to linear guardedness: by Jensen's inequality every linear predictor's loss is at least that of a constant predictor. Nonlinear probes, and the network's own nonlinear layers, may still extract the concept, and the minimal eraser removes at most dimensions.
Phrase starts are decodable from BERT's last layer with 85% accuracy (majority baseline 59%), yet erasing them leaves the model's word-prediction accuracy unchanged. What does this show?
- The probe was broken, since decodable information must be used
- BERT's word predictions do not rely on the linearly available phrase-boundary information at that layer
- BERT never computes phrase boundaries at any layer
- Erasure destroyed too much information to measure anything
Show the answer
B. BERT's word predictions do not rely on the linearly available phrase-boundary information at that layer
Amnesic probing separates "encoded" from "used". The property was there and linearly readable, yet removing it changed nothing in the behavior studied. That is a statement about this layer, this behavior and linear information; it does not say that phrase structure is never computed.
Why do Park, Choe & Veitch reject the Euclidean inner product for comparing concept directions in a language model?
- Euclidean angles change under invertible reparameterizations that leave the model's outputs unchanged, so they need not reflect semantics; a causal inner product makes causally separable concepts orthogonal
- The Euclidean inner product is too expensive to compute in thousands of dimensions
- The Euclidean inner product cannot be negative, so it cannot represent opposite concepts
- Concept directions have different lengths, and only cosine similarity is allowed
Show the answer
A. Euclidean angles change under invertible reparameterizations that leave the model's outputs unchanged, so they need not reflect semantics; a causal inner product makes causally separable concepts orthogonal
The logits are unchanged by , , which alters Euclidean geometry arbitrarily. Requiring separable concepts to be orthogonal pins down a family of inner products, such as , under which unembedding and embedding representations coincide.
Truth is represented along a direction , and an unrelated feature along that is not orthogonal to it. Why can the difference of class means identify better than logistic regression?
- Logistic regression cannot separate true from false statements at all
- The mean difference is computed with more data
- Logistic regression is nonlinear
- Logistic regression tilts its weight vector away from to cancel interference from , while the mean difference ignores variation that is independent of truth
Show the answer
D. Logistic regression tilts its weight vector away from to cancel interference from , while the mean difference ignores variation that is independent of truth
Variation along that is independent of the label averages out of , but logistic regression rotates its boundary to avoid it. Both classify well; the mean difference points along the direction the model actually uses, which is what interventions need.
Further reading
- J. Hewitt & C. D. Manning, "A structural probe for finding syntax in word representations," NAACL (2019).
- J. Hewitt & P. Liang, "Designing and interpreting probes with control tasks," EMNLP (2019).
- N. Belrose, D. Schneider-Joseph, S. Ravfogel, R. Cotterell, E. Raff & S. Biderman, "LEACE: Perfect linear concept erasure in closed form," NeurIPS (2023).
- K. Park, Y. J. Choe & V. Veitch, "The linear representation hypothesis and the geometry of large language models," ICML (2024).
- A. Arditi, O. Obeso, A. Syed, D. Paleka, N. Panickssery, W. Gurnee & N. Nanda, "Refusal in language models is mediated by a single direction," NeurIPS (2024).