◆ AI All-in-One

Level 3 In-Depth AI · Safety, Ethics and Society

Mechanistic Interpretability

The attempt to reverse-engineer neural networks into human-understandable parts, the way you might decompile a program. It covers features, circuits, superposition, sparse autoencoders, induction heads and how much of a real model we can actually explain today.

Level
●●●●● Advanced
Reading
14 min
To learn it well
1.5 hours to read, an afternoon to practise
↗ Plan a path here

Read first

Interpretability and ExplainabilityThe Transformer

This leads to

—
The full path from zero — 29 concepts before this one
  1. What Is AI?
  2. Vectors
  3. Derivatives and Slopes
  4. Probability Basics
  5. How Machines Learn
  6. Partial Derivatives and Gradients
  7. Matrices and Matrix Multiplication
  8. The Chain Rule
  9. Dot Product, Norms and Similarity
  10. Supervised, Unsupervised and Reinforcement Learning
  11. Gradient Descent
  12. Supervised Learning
  13. Linear Regression
  14. The Perceptron
  15. Logistic Regression
  16. Neural Networks
  17. Recurrent Neural Networks
  18. Backpropagation
  19. Activation Functions
  20. Interpretability and Explainability
  21. Vanishing and Exploding Gradients
  22. Normalization Layers: BatchNorm and LayerNorm
  23. LSTMs and GRUs
  24. Residual Connections
  25. Sequence-to-Sequence Models
  26. Attention
  27. Self-Attention and Multi-Head Attention
  28. Positional Encodings
  29. The Transformer
  30. Mechanistic Interpretability

Read them roughly in this order. See it on the concept map →

Why it matters

The methods in Interpretability and Explainability mostly treat a model as a black box: shuffle an input, measure the change, draw a heat map. They tell you what the model is sensitive to, but not how it computes its answer. Mechanistic interpretability aims for the "how". It tries to reverse-engineer a trained network into understandable pieces (the concepts it represents and the algorithms that connect them), much as a security researcher decompiles an unknown program to see what it really does.

Why go to that trouble?

  • Safety. As models become more capable, we want to check what they are actually doing, not just what they say. If a model has learned to deceive its evaluators, or knows something dangerous, its outputs might not show it, but its internals might. This is a major motivation in AI Alignment and AI Risks and Safety.
  • Debugging and control. If you can find the internal unit for a concept, you can sometimes switch it up or down to change behaviour precisely.
  • Science. Neural networks have discovered algorithms nobody programmed. Understanding them is a new kind of science, a bit like biology for artificial minds.

It is also a young field. As of late 2026, researchers can explain small models in detail and pieces of large ones, but nobody can give a complete mechanistic account of how a frontier LLM answers a question. Keep that in mind throughout.

The intuition

Imagine you find a pocket calculator from an alien civilisation. You could study it from outside, pressing buttons and noting results. Or you could open it, identify the components, work out what each one does, and trace how signals flow from the keypad to the display. Mechanistic interpretability does the second thing for neural networks.

The basic units are:

  • Features: the concepts the network represents, such as "this text is in French", "this is a curve facing left", "this token is inside a quotation". A feature is something that's switched on to some degree for a given input.
  • Circuits: groups of features connected by weights that together carry out a computation, such as "find the previous occurrence of this word and copy what came after it".

The natural guess is that each neuron is one feature. Sometimes that's true. Early work on image networks found neurons that fire for curves, for dog heads or for car wheels. But most neurons in language models are polysemantic: one neuron fires for several unrelated things, such as academic citations, Korean text and HTTP requests. Polysemanticity makes neurons poor units of analysis. The leading explanation is superposition.

cats French text DNA base64 legal text neuron 1 neuron 2 5 concepts stored in 2 neurons Neuron 1 alone is polysemantic: legal text +0.93 cats +0.64 base64 -0.07 French text -0.53 DNA -0.97 how strongly each concept moves neuron 1 Each concept is a direction, not a neuron. There are more concepts than neurons, so the directions cannot all be at right angles. This works because concepts are rarely active together: the overlap (interference) only causes errors when two fire at once.
Fig. 1 Superposition. Five concepts are stored in a layer with only two neurons, each concept as a direction. Neuron 1 responds to "legal text" and "cats" positively and to "DNA" and "French text" negatively, so reading one neuron gives a muddle. The concepts can share space because they are rarely active at the same time.

Here is the idea. A network often needs to track far more concepts than it has neurons. If each concept had its own neuron, it would run out. Instead it gives each concept a direction in the space of neuron activations. With nn neurons you can have only nn directions at perfect right angles, but you can fit many more directions that are almost at right angles. In 1,000 dimensions you can fit vastly more than 1,000 nearly perpendicular directions. Overlapping directions interfere: if two concepts are active together, each leaks into the other's reading. But most concepts are sparse. Any one sentence is about very few of the millions of things a model knows. So the interference is rare, and the network accepts it in exchange for storing more. Anthropic's "Toy Models of Superposition" (2022) showed this happening in small networks trained from scratch, with features arranged in exactly such geometric patterns (for example, five features as a pentagon in two dimensions).

Key idea In a neural network the natural units are not neurons but directions in activation space. Many more concepts than neurons are packed in as nearly perpendicular directions (superposition). Mechanistic interpretability tries to find those directions and the circuits that connect them.

The assumption that concepts are directions, so that "how French is this?" is a matter of how far the activation vector points along one line, is called the linear representation hypothesis. It has a lot of evidence behind it, from word-vector arithmetic (king − man + woman ≈ queen) to the features below, though it is unlikely to hold for everything.

How it works

Sparse autoencoders: un-mixing the features

If features are directions superimposed in the neurons, can we recover them? This is a classic problem called dictionary learning: find a large "dictionary" of directions such that every activation vector is a sum of just a few of them. The tool of choice since 2023 is the sparse autoencoder (SAE).

model activations 10 neurons, dense, mixed reconstruction should match 10 numbers encoder ReLU(W·x + b) decoder each feature adds its own direction many features, few active “Golden Gate Bridge” “inside a code block” “sarcastic tone” (thousands to millions in real SAEs) loss = reconstruction error + λ × (sum of feature activations) Training pushes for two things at once: rebuild the activations, but use as few features as possible.
Fig. 2 A sparse autoencoder. The encoder maps a dense vector of neuron activations to a much wider vector of features, only a few of which are switched on. The decoder rebuilds the original activations as a sum of those features' directions. Real SAEs have thousands to millions of features.

An SAE is a small autoencoder trained on activations recorded from the model you want to study. It has two parts:

f=ReLU(Wencx+b),x^=Wdec f\mathbf{f} = \mathrm{ReLU}(\mathbf{W}_{\text{enc}}\mathbf{x} + \mathbf{b}), \qquad \hat{\mathbf{x}} = \mathbf{W}_{\text{dec}}\,\mathbf{f}

In words: the encoder turns the activation vector x\mathbf{x} (say, 4,096 numbers from one layer) into a much longer feature vector f\mathbf{f} (say, a million numbers), and the ReLU keeps each feature at zero or above. The decoder rebuilds x^\hat{\mathbf{x}} ("x-hat", the reconstruction) by adding up one direction per feature, weighted by how strongly that feature is on. Each column of Wdec\mathbf{W}_{\text{dec}} is one dictionary direction. The training loss has two terms:

L=∥x−x^∥2⏟rebuild the activations+λ∑ifi⏟use few featuresL = \underbrace{\lVert \mathbf{x} - \hat{\mathbf{x}} \rVert^2}_{\text{rebuild the activations}} + \lambda \underbrace{\sum_i f_i}_{\text{use few features}}

The first term says "reconstruct the original faithfully". The second, an L1 penalty with strength λ\lambda (the sum of feature activations, which are never negative), says "use as few features as possible for each input". The tension between the two forces the SAE to find a dictionary in which each input is explained by a handful of features. If superposition is real, those features should line up with the model's true concepts.

To find out what a feature means, you look at the inputs that switch it on most strongly, and check what happens when you turn it up or down. In Anthropic's 2023 "Towards Monosemanticity" work on a small one-layer transformer, SAE features were far easier to describe than neurons: one fired on Arabic script, another on DNA sequences, another on base64-encoded text. In 2024, "Scaling Monosemanticity" trained SAEs with up to about 34 million features on Claude 3 Sonnet, a production model. It found features for the Golden Gate Bridge, for code bugs, for sycophantic praise, and abstract ones that fire on the same concept across languages and in both text and images. OpenAI (GPT-4) and Google DeepMind (Gemma Scope, for Gemma 2) published similar large SAEs the same year.

Steering: proof by intervention

Finding a feature that correlates with a concept is only half the job. To show the model uses it, you intervene. Activation steering adds a feature's direction to the model's activations while it runs. Anthropic's demonstration was "Golden Gate Claude" (May 2024): with the Golden Gate Bridge feature clamped high, the model brought the bridge into every answer, and even described itself as the bridge. That is strong evidence that the feature causally represents the concept for the model.

Circuits: how features connect

A circuit is a set of features plus the weights that connect them, which together perform a computation. Circuits were first traced in image networks (Olah and colleagues' "Zoom In", 2020), where curve detectors are built from edge detectors in the previous layer, arranged by orientation.

The best-known circuit in language models is the induction head, described by Anthropic in 2022. It explains a basic piece of in-context learning: if the text contains "Mr Dursley ... Mr", the model predicts "Dursley". The rule is if token A was followed by B earlier, and A appears again, predict B. Two attention heads in different layers cooperate:

  1. A previous-token head in an early layer writes into each position a note saying which token came just before it. Now the position holding "Dursley" carries the note "I came after Mr".
  2. The induction head in a later layer, at the current position (the second "Mr"), searches for positions whose note says "came after Mr". It finds "Dursley" and copies that token towards the output.

Worked through on the sequence the cat sat . the cat: at the final cat, the induction head looks for earlier positions preceded by cat, finds sat, and boosts sat as the next token. Induction heads form suddenly during training, at the same moment as a visible bump in the loss curve and a jump in the model's ability to use its context. This "phase change" is one of the clearest links found so far between a specific circuit and a general capability.

Activation patching: finding which parts matter

To locate a circuit in a big model you need to know which components matter for a behaviour. Activation patching (also called causal tracing or interchange intervention) does this experimentally:

  1. Run the model on a "clean" prompt ("The Eiffel Tower is in the city of") and record all activations. It answers "Paris".
  2. Run it on a "corrupted" prompt ("The Colosseum is in the city of"). It answers "Rome".
  3. Rerun the corrupted prompt, but paste in ("patch") the clean activation at just one location, for example one attention head at one position. If the answer swings back towards "Paris", that location carries the critical information.

Repeating this across every layer and position gives a map of where the fact flows. Meng and colleagues used this in 2022 to find that factual associations in GPT-style models are retrieved mainly in middle-layer MLP blocks at the last token of the subject. In 2025 Anthropic combined SAE-like features with tracing into "attribution graphs" for Claude 3.5 Haiku. These showed, for example, the model looking up an intermediate fact for two-step questions (the capital of the state containing Dallas: Dallas → Texas → Austin) and choosing a rhyming word before writing the line of a poem that ends with it.

Reverse-engineering a whole algorithm

The most complete success so far is on small models trained on toy tasks. Neel Nanda and colleagues (2023) trained a one-layer transformer on addition modulo 113 and fully decoded its method: it represented numbers as rotations (sines and cosines at a few frequencies) and used trigonometric identities to add them. Nobody had told it to. This showed that full reverse-engineering is possible in principle, and that networks can find elegant, unexpected algorithms.

In code

This toy shows superposition and how a sparse autoencoder undoes it. We invent 20 "concepts", each a random direction in a 10-neuron layer, and generate activations where each concept is rarely on. Then we check whether any single neuron captures a concept, and whether an SAE trained only on the activations rediscovers them.

import torch, torch.nn as nn

torch.manual_seed(0)
n_concepts, d = 20, 10            # 20 hidden "concepts" stored in a layer of only 10 neurons
concepts = nn.functional.normalize(torch.randn(n_concepts, d), dim=1)   # one direction each

def activations(n, p=0.02):       # each concept is active in about 2% of inputs (sparse)
    on = (torch.rand(n, n_concepts) < p).float()
    strength = 0.5 + 0.5 * torch.rand(n, n_concepts)
    return (on * strength) @ concepts          # what we would record from the 10 neurons

m = 40                                         # dictionary size: more features than neurons
enc, dec = nn.Linear(d, m), nn.Linear(m, d, bias=False)
with torch.no_grad():
    dec.weight /= dec.weight.norm(dim=0, keepdim=True)
    enc.weight.copy_(dec.weight.T); enc.bias.zero_()
opt = torch.optim.Adam([*enc.parameters(), *dec.parameters()], lr=3e-3)

for step in range(8000):
    x = activations(1024)
    f = torch.relu(enc(x))                                  # sparse feature activations
    loss = ((dec(f) - x) ** 2).sum(1).mean() + 0.2 * f.sum(1).mean()   # reconstruct + L1
    opt.zero_grad(); loss.backward(); opt.step()
    with torch.no_grad():
        dec.weight /= dec.weight.norm(dim=0, keepdim=True)  # unit-length dictionary vectors

neuron_match = concepts.abs().max(1).values          # best single neuron for each concept
sae_match = (concepts @ dec.weight).max(1).values    # best SAE feature for each concept
print(f"concepts matched by a single neuron (cos > 0.9): {(neuron_match > 0.9).sum()} / 20")
print(f"concepts matched by an SAE feature  (cos > 0.9): {(sae_match > 0.9).sum()} / 20")
print(f"median match: neurons {neuron_match.median():.2f}, SAE {sae_match.median():.2f}")

# concepts matched by a single neuron (cos > 0.9): 0 / 20
# concepts matched by an SAE feature  (cos > 0.9): 18 / 20
# median match: neurons 0.63, SAE 0.99

No neuron lines up well with any concept (a cosine similarity of 0.63 is a poor match), so reading neurons one at a time would show only mixtures. The SAE, which never saw the true concepts, recovers 18 of 20 almost exactly. Two details matter in practice: the decoder directions are kept at unit length (otherwise the SAE can shrink f\mathbf{f} and grow the decoder to dodge the L1 penalty), and the penalty strength λ\lambda (here 0.2) trades sparsity against reconstruction. Try 0.02 and you will recover fewer concepts.

For real models, the open-model ecosystem has TransformerLens for recording and patching activations, and SAELens plus Neuronpedia for pre-trained SAEs you can browse.

Common pitfalls and open problems

  • Interpretation is subjective. Labelling a feature by its top-activating examples is easy to get wrong. A "Golden Gate Bridge" feature might really be "famous San Francisco landmarks". Check with interventions and with examples of weak activation, not only the top ones.
  • SAEs don't explain everything. The reconstruction is imperfect, and the leftover error (sometimes called "dark matter") can matter for the model's behaviour. Features can also split into finer and finer versions as the dictionary grows, so there may be no single "true" set of features.
  • Mixed results on practical tasks. In 2025 Google DeepMind's interpretability team reported that SAE-based methods did worse than simple linear probes at detecting harmful intent in prompts, and said it would put less emphasis on SAEs. Whether SAEs are the right tool, or a stepping stone, is debated.
  • Scale. Explaining one behaviour in one large model can take researchers weeks. Automating interpretation, often using LLMs to label features, is an active area.
  • Illusions. Patching and steering can produce effects that don't reflect the model's normal operation. Careful baselines matter.

Watch out Be wary of headlines such as "researchers found the deception neuron". Finding a feature that correlates with a concept is far from being able to verify that a model is safe. As of late 2026, mechanistic interpretability is a promising research programme, not a reliable safety audit.

Where it leads

A bit of history

Chris Olah and colleagues at Google Brain and then OpenAI built much of the early vision work: feature visualisation (2017) and the Distill "Circuits" thread (2020), which introduced the vocabulary of features and circuits and noted polysemantic neurons. Anthropic, which Olah co-founded in 2021, published "A Mathematical Framework for Transformer Circuits" (2021), "In-context Learning and Induction Heads" and "Toy Models of Superposition" (both 2022). Meng and colleagues' ROME paper (2022) popularised causal tracing. In 2023, Anthropic's "Towards Monosemanticity" and an independent paper by Cunningham and colleagues showed that sparse autoencoders find interpretable features in language models. 2024 brought SAEs on production-scale models from Anthropic, OpenAI and Google DeepMind, and 2025 brought attribution graphs that trace computation step by step. The field remains fast-moving, so check the latest work before relying on any claim here.

Try it

  1. In the code, change n_concepts to 40 while keeping 10 neurons and m = 80. How many concepts does the SAE recover now? Increase the L1 strength to 0.6 and compare.
  2. Change the activation probability p from 0.02 to 0.3, so concepts are often active together. What happens to recovery, and why does that support the "sparsity enables superposition" story?
  3. Work the induction-head example by hand for A B C D A B C. At the final C, which earlier position does the induction head attend to, and what does it predict?

Hint for 2: with many concepts on at once, interference between overlapping directions becomes the norm rather than the exception.

Check your understanding

5 quick questions. Pick an answer to see whether you were right and why. Your best score is saved on this device.

  1. A single neuron fires for academic citations, Korean text and HTTP requests. What is the leading explanation?

  2. In the toy code, setting each concept active in 30% of inputs instead of 2% makes the SAE recover far fewer concepts. Why?

  3. On the sequence A B C D A B, what does an induction head predict as the next token?

  4. You find an SAE feature whose top activations are all about the Golden Gate Bridge. What is the strongest further evidence that the model uses it for that concept?

  5. You patch one attention head's clean activation (Eiffel Tower prompt) into the corrupted run (Colosseum prompt) and the answer swings from Rome to Paris. What does this show?

Finished this chapter?

Learn more

Hand-picked courses, books, videos and tutorials for going deeper. See all resources →

Article

Transformer Circuits Thread

Anthropic interpretability team · Advanced · Free

Research reverse-engineering Transformers: circuits, superposition, features and model biology.

Paper

Toy Models of Superposition

Elhage et al. (Anthropic) · 2022 · Advanced · Free

Small networks that store more features than they have neurons, showing when and how superposition happens. The origin of the pentagon picture.

Course

ARENA (Alignment Research Engineer Accelerator)

ARENA · Intermediate · Free

A free, hands-on curriculum of PyTorch exercises on transformers, mechanistic interpretability (induction heads, superposition, sparse autoencoders) and RL for alignment.

Interactive

Neuronpedia

Neuronpedia · Beginner · Free

An open platform for browsing sparse-autoencoder features of real models, with the text that activates each one. A good way to see what "features" look like.

Paper

In-context Learning and Induction Heads

Olsson et al. (Anthropic) · 2022 · Advanced · Free

Identifies induction heads, a two-head circuit that copies earlier patterns, and argues they drive much of in-context learning.

Facts checked as of 30 November 2026. Fast-moving details (products, prices, laws) change often. · Source: content/entries/society/mechanistic-interpretability.md