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
- Builds on
- 29 concepts →
- Quiz
- 5 questions ↓
This leads to
—The full path from zero — 29 concepts before this one
- What Is AI?
- Vectors
- Derivatives and Slopes
- Probability Basics
- How Machines Learn
- Partial Derivatives and Gradients
- Matrices and Matrix Multiplication
- The Chain Rule
- Dot Product, Norms and Similarity
- Supervised, Unsupervised and Reinforcement Learning
- Gradient Descent
- Supervised Learning
- Linear Regression
- The Perceptron
- Logistic Regression
- Neural Networks
- Recurrent Neural Networks
- Backpropagation
- Activation Functions
- Interpretability and Explainability
- Vanishing and Exploding Gradients
- Normalization Layers: BatchNorm and LayerNorm
- LSTMs and GRUs
- Residual Connections
- Sequence-to-Sequence Models
- Attention
- Self-Attention and Multi-Head Attention
- Positional Encodings
- The Transformer
- 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.
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 neurons you can have only 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).
An SAE is a small autoencoder trained on activations recorded from the model you want to study. It has two parts:
In words: the encoder turns the activation vector (say, 4,096 numbers from one layer) into a much longer feature vector (say, a million numbers), and the ReLU keeps each feature at zero or above. The decoder rebuilds ("x-hat", the reconstruction) by adding up one direction per feature, weighted by how strongly that feature is on. Each column of is one dictionary direction. The training loss has two terms:
The first term says "reconstruct the original faithfully". The second, an L1 penalty with strength (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:
- 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".
- 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:
- Run the model on a "clean" prompt ("The Eiffel Tower is in the city of") and record all activations. It answers "Paris".
- Run it on a "corrupted" prompt ("The Colosseum is in the city of"). It answers "Rome".
- 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 and grow the decoder to dodge the L1 penalty), and the penalty strength (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
- AI Alignment and AI Risks and Safety: interpretability is one hoped-for way to detect misaligned goals, deception or dangerous knowledge that behavioural tests miss.
- The Transformer, Self-Attention and Multi-Head Attention and the residual stream view: mechanistic interpretability reads the transformer as many components reading from and writing to a shared stream of vectors.
- Adversarial Examples: some work links adversarial vulnerability to the non-robust features models rely on.
- Reasoning Models and Test-Time Compute: comparing a model's written reasoning with its internal computation is a growing use of these tools.
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
- In the code, change
n_conceptsto 40 while keeping 10 neurons andm = 80. How many concepts does the SAE recover now? Increase the L1 strength to 0.6 and compare.- Change the activation probability
pfrom 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?- Work the induction-head example by hand for
A B C D A B C. At the finalC, 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.
Learn more
Hand-picked courses, books, videos and tutorials for going deeper. See all resources →
Concrete Steps to Get Started in Transformer Mechanistic Interpretability
A practical roadmap into the field from one of its best-known researchers, with the prerequisites, tools (TransformerLens) and first projects to try.
Transformer Circuits Thread
Research reverse-engineering Transformers: circuits, superposition, features and model biology.
Toy Models of Superposition
Small networks that store more features than they have neurons, showing when and how superposition happens. The origin of the pentagon picture.
Scaling Monosemanticity: Extracting Interpretable Features from Claude 3 Sonnet
Scales sparse autoencoders to a production model and finds millions of features, including the Golden Gate Bridge feature, and shows that steering them changes behaviour.
ARENA (Alignment Research Engineer Accelerator)
A free, hands-on curriculum of PyTorch exercises on transformers, mechanistic interpretability (induction heads, superposition, sparse autoencoders) and RL for alignment.
Neuronpedia
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.
In-context Learning and Induction Heads
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