Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
Mechanistic
interpretability.
"The model is a black box" is the excuse that stops most debugging before it starts. It's also, increasingly, not true. You can name the features a model uses, trace the circuit that turns an input into an answer, and even reach in and change a behaviour by editing one feature. This handbook is the engineer's version: not the philosophy of understanding minds, but the toolkit for turning a model into something you can inspect, explain, and fix.
Interpretability is a debugger, not a séance
Reframe the goal. You're not trying to read the model's "mind"; you're trying to answer engineering questions: Why did it hallucinate that citation? Which feature does this jailbreak flip? Is it using the demographic field it's not supposed to? Mechanistic interpretability answers those by reverse-engineering the actual computation — the features the model represents and the circuits wiring them together.
That framing sets the bar. A useful interpretability result isn't "we understand the model." It's "we found the feature responsible for X, confirmed it causally, and changed X by intervening on it." Everything below builds toward that loop: find a feature → trace its circuit → verify by intervention.
Features, not neurons
The first thing that trips up newcomers: a single neuron is polysemantic — it fires for many unrelated concepts. That's because the model stores concepts as directions spread across many neurons, packing far more features than it has dimensions. This is superposition, and it works because features are sparse — few are active at once, so their interference rarely collides.
The full geometry — why d dimensions can hold many more than d near-orthogonal features, and why sparsity keeps them separable — is worked out in the Concept Circuits breakdown. The engineering consequence is what matters here: you cannot read features off individual neurons. You have to recover the directions first, which is exactly what the next tool does.
A neuron is a coordinate, not a concept. Asking "what does neuron 4,182 do?" is the wrong question; asking "which directions does the model use, and what does each mean?" is the right one.
Sparse autoencoders: pull features out of the tangle
If features are superposed, how do you get them back? Train a sparse autoencoder (SAE) on a layer's activations: it re-expresses each activation vector as a sparse combination of a much larger dictionary of candidate features, with a sparsity penalty forcing only a few to be active at once. Done well, each learned feature becomes monosemantic — it means one thing you can name ("Golden Gate Bridge," "code comment," "a sense of danger").
The dictionary is over-complete (more features than neurons); the sparsity penalty is what makes each one crisp instead of a blur. This is the workhorse that turned interpretability from "stare at neurons" into "enumerate features."
Once you have a dictionary of named features, the rest of the toolkit becomes concrete: you can ask which features fire on an input, which drive an output, and what happens when you turn one up or down.
Attribution and circuit tracing
A circuit is the path of features the model uses to get from input to output. Attribution measures how much each feature contributes to a downstream one; chain those contributions and you have the circuit graph. In a linear toy — inputs → hidden features → output — the contribution of input i to output o is just the sum over hidden paths of the weights along the way:
And you can verify it causally: ablate input i (zero it) and the output must change by exactly attribution(o,i)·x[i]. Attribution that doesn't survive ablation is a story, not a circuit.
W1
W2
Δout = attr·x[i]
Real circuit tracing (activation patching, attribution graphs) is this idea scaled up through nonlinearities and many layers — but the discipline is identical: an attribution is only real if intervening on the cause changes the effect. The runnable tracer below builds the linear version end to end.
Steering: change behaviour by editing a feature
The payoff of naming a feature is that you can intervene on it. Clamp a feature's activation up and the model leans into that concept; clamp it down and the behaviour recedes. This is activation steering — the "Golden Gate Claude" demonstration is the famous example: amplify one feature and the model can't stop talking about a bridge.
For an engineer, steering is the difference between explanation and control. If you've found the feature behind an unwanted behaviour — a refusal misfire, a spurious correlation, a leaked style — you can often suppress it directly, without retraining. It's surgery on a specific direction rather than persuasion through prompts, and it's testable: the intervention either moves the behaviour the predicted way or your feature attribution was wrong.
feature steering: find the responsible direction, clamp it, measure the change
What you can actually debug today — and what you can't
| Feasible now | Still research |
|---|---|
| Find & name features for concrete concepts | A complete, exhaustive feature dictionary |
| Locate features involved in a specific behaviour | End-to-end explanation of a frontier model |
| Steer behaviour by clamping a feature | Guaranteeing you found every relevant feature |
| Causally verify a small circuit by ablation/patching | Reliable detection of deception or hidden goals |
Hold both halves honestly. Interpretability has gone from "stare at neurons and hope" to a genuine debugger with causal tools — but "we found the deception feature" is still far more aspiration than product at frontier scale. Treat it as a powerful partial debugger: it can explain and fix specific behaviours you go looking for; it cannot yet certify a model is safe. That gap is exactly why it's one of the most active frontiers in AI safety.
Trace a circuit, then verify it by ablation
Here's the whole find → trace → verify loop in a 2-layer linear network: inputs feed hidden features (W1) which feed an output (W2). The attribution of input i to the output is the summed path weight (W2·W1). The point is the causal check: ablate that input — zero it — and the output changes by exactly the attributed amount. A disconnected input attributes zero and, when ablated, changes nothing. Edit the weights and watch which input the circuit blames.
Cost and trade-offs of each tool
Here Time is the compute a method needs. Space is what it stores or needs access to. Why is what you can, and cannot, conclude from it.
| Case | Time | Space | Why |
|---|---|---|---|
| Read one neuron | One forward pass | Nothing extra | Cheap and misleading: neurons are polysemantic, so a neuron’s label is a guess. |
| Linear probe on a layer | Train a small classifier on stored activations | One weight vector per concept | Shows a concept is decodable there, not that the model uses it. Correlational only. |
| Train an SAE | A training run over a large sample of one layer’s activations | Say d = 4,096 and a 16× dictionary: 65,536 features, and 2·d·m ≈ 537M encoder and decoder weights | You trade sparsity against reconstruction. More sparsity gives crisper features but leaves more of the activation unexplained. |
| Attribution (gradient × activation) | One forward and one backward pass | One score per feature | Fast, but it is a linear approximation. Past a nonlinearity it can point at the wrong cause. |
| Activation patching | One forward pass per component patched: a 32-layer, 32-head grid is 1,024 runs per prompt pair | Activations from a clean and a corrupted run | Causal, and the gold standard for small circuits. The cost scales with what you patch. |
| Ablation (the runnable) | One forward pass per input zeroed: n inputs, n runs | Nothing extra | Exact in a linear toy. In a real model, zero can be a value training never produced. |
| Steering | Add a vector at inference: almost free per token | One direction per feature | Cheap control, but side effects are hard to predict. Too strong and fluency collapses, as the bridge-obsessed demo shows. |
There is one more cost, and it rules out a lot of work: every row needs the model’s activations. On an API-only model you can do none of this. Interpretability work runs on open-weight models, or inside the lab that trained the model.
Common mistakes
- Naming a feature from its top activations
The ten strongest examples always look clean. The label also has to hold for weak activations, and for inputs that should fire it but do not. Check the whole activation range, then confirm the label by intervening on the feature.
- Zero-ablating and trusting the result
Setting an activation to zero can push the model into a state it never saw in training. The output then changes because the model is confused, not because you removed the cause. Mean-ablation, or patching in the activation from a counterfactual prompt, is a cleaner control.
- Ignoring the SAE’s reconstruction error
An SAE never reconstructs a layer exactly. If the behaviour lives in the part it misses, no feature will explain it. Splice the reconstruction back into the forward pass and measure how much the model’s loss rises before trusting any feature.
- One prompt, one circuit
A circuit found on one prompt template may not be the one the model uses on a paraphrase. Build a set of prompts that vary wording but keep the behaviour, and keep only the paths that hold across the set.
- Steering with one coefficient
Pick a strength, see the behaviour move, ship it, and the model quietly gets worse at unrelated tasks. Sweep the coefficient. At each value, measure the target behaviour and a general benchmark, and pick the weakest setting that does the job.
Where this shows up in the real world and interviews
- Open tooling
TransformerLens exposes a hook on every activation of supported open models, which is what patching and ablation need. Gemma Scope is a set of open SAEs trained on Gemma 2. With it you can explore features without training a dictionary first.
- Safety research at frontier labs
Anthropic trained SAEs on Claude 3 Sonnet’s activations and reported features tied to concepts like deception and sycophancy, alongside the Golden Gate Bridge feature. This is the “find and name” half of the page’s table. Proving such a feature is the whole story is still the research half.
- Probes as monitors
A cheap, practical spin-off: a linear probe that reads one layer at inference time and flags a state, such as a request it should refuse. It costs little per token. But it is a correlational detector, so it needs the same red-teaming as any classifier.
- The interview version
Research-engineer interviews ask you to explain superposition and why it forces SAEs. Then they ask how you would show a feature is causal: patching or ablation, a counterfactual baseline and a prompt set. They also want you to say plainly what interpretability cannot certify yet.
Check yourself
In the runnable (W1 rows [1,0,0] and [0,1,0], W2 = [2, 0.5], x = [3, 4, 9]), what is the output, and how much does it drop when you ablate input 1?
Output = 2·3 + 0.5·4 = 8. Input 1’s attribution is the path weight 0.5·1 = 0.5, so ablating it drops the output by 0.5·4 = 2. Input 0 drops it by 6. Input 2 is wired to nothing, so ablating it changes nothing.
Change W1’s second row to [0, 1, 1], so hidden feature 1 also reads input 2. Which input does top_cause blame, and which input’s ablation moves the output most after input 0?
The attributions are now 2, 0.5 and 0.5, so top_cause still says input 0. But the output is 12.5. Ablating input 2 drops it by 0.5·9 = 4.5, more than input 1’s 2, because x[2] is larger. Attribution is a weight; the effect on this input is weight × value. Say which one you are reporting.
You find a feature that fires on Python code. Clamp it to zero and the model still writes Python fine. What have you learned?
That the feature is correlated with Python but not necessary for writing it. The model may have redundant features, or the computation runs elsewhere. Your label may be right, but your causal story is not. This is the page’s rule: an attribution is only real if the intervention moves the behaviour.
Say a linear probe on layer 20 detects “the user is angry” with high accuracy. Can you claim the model uses anger to choose its reply?
Not yet. A probe shows the information is decodable from that layer; the model may never read it. To claim use, intervene: steer or patch along the probe’s direction and check that the reply changes in the predicted way.
Quick answers
What is mechanistic interpretability?
Reverse-engineering the computation a model performs — its features and the circuits connecting them — so you can explain and debug a behaviour instead of treating the model as a black box. For engineers it's a debugger: find a feature, trace its circuit, verify by intervention.
What is a sparse autoencoder for?
Features live in superposition, so you can't read them off neurons. An SAE re-expresses a layer's activations as a sparse combination of a large feature dictionary, making each learned feature monosemantic (one nameable meaning).
How does circuit tracing work?
Measure each feature's contribution to a downstream one and chain them into a graph. In a linear toy, contribution of input i to output o is the summed path weight (W2·W1)[o][i] — validated causally by ablation: zero the input, confirm the output drops by the attributed amount.
What can it debug today?
You can find/name features, locate ones behind a behaviour, steer by clamping a feature, and verify small circuits causally. What's still research: exhaustive dictionaries, end-to-end explanation of frontier models, and reliable deception detection.
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Handbooks
- The Prompting HandbookA friendly, hands-on field guide for everyday humans — learn the CRISP framework, spot bad prompts, practice with real recipes, play a drag-and-drop game, and test yourself with a quiz. No code required.Read →
- The Senior AI Engineer Interview Handbook60 questions across architecture, production incidents, agentic systems, RAG, evals, cost, safety, and leadership — what staff-level AI interviewers actually probe for.Read →
- The LLM Serving HandbookHow to serve large language models fast and cheap — prefill vs decode, the KV cache, continuous batching and PagedAttention (vLLM), quantization, speculative decoding, and the latency-vs-throughput tradeoffs that decide your inference bill.Read →
- The Transformers HandbookThe architecture behind every LLM, built up from scratch — tokens and embeddings, positional encoding, self-attention (query/key/value), multi-head attention, the transformer block (FFN, residuals, layer norm), and how a decoder-only model generates text autoregressively.Read →
- The Fine-Tuning HandbookWhen to fine-tune vs RAG vs prompting, full fine-tuning vs parameter-efficient methods, how LoRA and QLoRA make it cheap enough for a single GPU, why the data matters more than the method, catastrophic forgetting, and how to evaluate and decide.Read →
- The On-Device AI HandbookSmall models, everywhere: why 1–14B models got frontier-adjacent (distillation + textbook data), the napkin law of local inference (tokens/sec ≈ bandwidth ÷ bytes), quantization and the llama.cpp / GGUF / Ollama / MLX stack, the honest local-vs-cloud decision table, four hybrid patterns that ship, and the evals craft of choosing a small model that actually fits the device.Read →