Handbooks  /  Mechanistic Interpretability
Handbook~16 min readAI Safetyworked math + runnable code
Handbook

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.

01

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.

02

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.

The mental model

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.

03

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").

activation ≈ Σk ak·featurek  with  ‖a‖0 small (few active) and dictionary size ≫ dimensions

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.

04

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:

attribution(o, i) = Σh W2[o][h] · W1[h][i]  =  (W2·W1)[o][i]

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.

find → trace → verify
Inputs x
Hidden features
W1
Output
W2
Ablate input i
Δ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.

05

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.

prompt engineering: ask the model nicely and hope
feature steering: find the responsible direction, clamp it, measure the change
06

What you can actually debug today — and what you can't

Feasible nowStill research
Find & name features for concrete conceptsA complete, exhaustive feature dictionary
Locate features involved in a specific behaviourEnd-to-end explanation of a frontier model
Steer behaviour by clamping a featureGuaranteeing you found every relevant feature
Causally verify a small circuit by ablation/patchingReliable 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.

RUN IT YOURSELF

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.

CPython · WebAssembly
Frequently asked

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.

Finished this one? 0 / 160 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.