The Interp Mindset & Observational Tools
Features, circuits, and the discipline of causal evidence — plus logit lens and probes.
- → Define features, circuits, and universality with examples
- → Run logit lens and train a linear probe on activations
- → Explain why a probe finding a direction doesn't prove the model uses it
Reverse-engineering a program nobody wrote
You now know how a transformer computes. That is not the same as knowing what any particular transformer does. Training wrote billions of numbers into the weights; those numbers implement algorithms; nobody chose those algorithms and nobody has read them. Mechanistic interpretability is the attempt to read them — to take a trained network and recover, in human terms, the program it is running.
The framing that started the modern field comes from Olah et al.'s Zoom In: a neural network is more like a compiled binary than like a statistical black box. It has structure. The structure has parts. The parts connect. And, crucially, the parts recur across models — which means there is a stable subject matter to study rather than a fresh mystery per checkpoint.
It is worth being clear about what interp is for, because there is a competing tool that is cheaper and often better. Behavioural evaluations ask the model questions and grade the answers. They are the workhorse of AI safety today and they scale beautifully. But they only see what the model chooses to show you. Interp is the microscope: slower, narrower, higher resolution, and — this is the point — it looks at the mechanism rather than the output.
The logit lens: reading an unfinished thought
Here is the cheapest observational tool in the field, and one of the most revealing. Recall from Module 1.3 that the residual stream is a running sum: every block adds to it, and the final unembedding turns the last value into logits. Nothing stops you from applying to the residual stream early.
where is the residual stream after layer and is the model's final layer norm. That is the whole method. It works because the residual stream keeps one basis from start to finish — the vector after layer 4 lives in the same coordinate system as the vector the unembedding was trained on.
nostalgebraist reported the result in 2020 and it has held up: the model's prediction does not appear at the end. It crystallizes. Early layers unembed to near-copies of the current token. Middle layers commit to a syntactic category. Somewhere around two-thirds depth the actual answer arrives, often in one or two layers. The rest of the network mostly sharpens a decision already made.
Probes, and the discipline that keeps you honest
The other standard observational tool: cache activations at some layer, label each one with a property you care about, and fit a linear probe — usually logistic regression — from activation to label.
If the probe gets high accuracy, the property is linearly decodable from the activation. That is a real, non-trivial finding: probes have found board state in a game-playing transformer, truthfulness-correlated directions, sentiment, syntactic role, and the geometry of numbers and time. It is also much less than it sounds like.
Three ways a probe can mislead you, in increasing order of embarrassment:
- The probe learned the task. A high-capacity probe on high-dimensional activations can fit labels that the model never represented. Random-vector baselines and control tasks exist for this reason.
- The information is present but unread. The residual stream carries far more than any given layer consumes. Something can be decodable and causally inert.
- The direction is right but the probe's is not. Two directions can both correlate with the property while only one feeds the computation. The probe optimizes for decoding accuracy, so it happily picks the wrong one. This is the case the widget below constructs, and it is the one people actually get wrong in practice.
The move that converts one into the other is always the same: intervene. Add to the activation and see whether behaviour moves. Zero out the component along and see whether behaviour breaks. If the model's output does not care, then whatever you found is a readout, not a mechanism.
Look, then intervene
Two toys, in the order the field learned them. The first is pure observation: watch a prediction assemble itself across depth. The second is why observation is not enough — a probe that reads a property beautifully and points in a direction the model does not use.
Before any block runs, the lens is unembedding the raw token embedding of “ of”. GPT-2 ties its embedding and unembedding matrices, so the read-out mostly echoes the input token back. No prediction is happening yet — this is the lens looking at itself.
Fill = what the model outputs now. Ring = the true label.
Things to try: (1) In the lens, hit Play through depth and watch which tokens are competing at each stage — the category (“a famous city”) shows up several layers before the answer, which is a hint about how factual recall is organized. (2) In the probe demo, push λ to −2.5 along the probe direction: the probe goes from 50% positive to about 1%, while the model's output barely moves. You have fooled the monitor without touching the model. (3) Reveal the causal direction and push the same distance: now the probe reading does not move at all (its boundary is perpendicular to your push) while the model flips every positive example. A perfect double dissociation — and note the flip rate tops out near 50%, because the other half of the examples were already negative.
Problem set
The first two are quick and clarify the vocabulary. The code problems are your first real TransformerLens session — install it once here and you will reuse the setup for the rest of Part 3.
For each of the following, say whether it is best described as a feature, a circuit, or neither, and why:
- Neuron 373 in layer 6 fires on French text.
- The model attends from a pronoun back to the name it refers to, then copies that name into the output.
- The model achieves 32% accuracy on GSM8K.
- A direction in layer 8 whose presence predicts that the next token is a closing bracket.
A logit lens on a 24-layer model shows the correct answer at rank 1 from layer 14 onward, with probability rising 0.09 → 0.11 → 0.14 → … → 0.72 by layer 24. A colleague concludes: “the fact is retrieved at layer 14.” Give two distinct reasons that conclusion might be wrong, and describe one intervention that would raise your confidence.
In a Colab notebook, install transformer_lens and load gpt2-small. Run logits, cache = model.run_with_cache("The Eiffel Tower is in the city of"). For each layer L, take cache["resid_post", L] at the final position, apply model.ln_final, then model.unembed, and record the top-5 tokens and the probability of " Paris".
Success check: you produce a 13-row table like the widget above, and the probability of " Paris" rises monotonically over the last third of the network. Then repeat for two prompts of your own — one factual, one syntactic (e.g. a bracket-closing prompt) — and compare where the answer appears.
Build a dataset of ~400 short prompts labelled by a simple binary property (suggestion: the prompt is about a person vs about a place). Cache resid_post at layer 6 of gpt2-small at the final token. Fit sklearn.linear_model.LogisticRegression and report held-out accuracy.
Then run the control: shuffle the labels and refit. Then run the causal test: take the learned direction w, normalize it, and use a TransformerLens hook to add ±3·w to the layer-6 residual stream at every position. Measure how the model's output distribution changes.
Success check: real accuracy > 85%, shuffled accuracy ≈ 50%, and you can state — with numbers — whether steering along w changed behaviour.
Reproduce the widget from scratch in NumPy, without a transformer. Define a toy “model” whose output is sign(a · v) for a fixed direction v. Generate two classes of activations so that (i) both coordinates separate the classes, and (ii) the optimal linear probe direction is orthogonal to v.
Success check: your probe reaches >95% accuracy, and shifting every activation by 2·w (the probe direction) changes the model's output on <10% of points, while shifting by 2·v changes it on ~50%.
Open neuronpedia.org and pick any GPT-2 small SAE feature that looks interpretable from its top activating examples. Write down, in one sentence, what you think it detects.
Now look for evidence against your sentence: scroll to the weaker activations, check the negative logit effects, and see whether the feature fires on things your description does not cover. Then write down what kind of experiment would settle it.
Check yourself
Go deeper
Zoom In is the field's founding document and worth your full attention. The logit lens post is short and you should read it before the problem set. Keep Nanda's glossary open for the whole of Part 3.