Mechanistic Interpretability
Mechanistic interpretability is the scientific program of reverse-engineering neural networks into human-understandable algorithms—identifying the specific circuits, features, and computations that implement model behavior, rather than treating the network as a black box characterized only by input-output statistics. It matters because as frontier models are deployed in high-stakes domains, behavioral evaluations alone cannot detect deceptive alignment, hidden capabilities, or subtle failure modes that only manifest under distribution shift. The remarkable fact: a handful of attention heads in GPT-2 Small implement an identifiable, transferable "indirect object identification" circuit that can be surgically ablated with predictable behavioral consequences—demonstrating that large language models contain discrete, interpretable subroutines rather than diffuse distributed computation.
A trained neural network is not a learned statistical table—it is a compiled program written in weight space, and mechanistic interpretability is the discipline of decompiling it. The central hypothesis, formalized as the Linear Representation Hypothesis, is that neural networks represent concepts as directions in activation space and compose them via approximately linear superposition; this means that features, circuits, and algorithms are in principle recoverable using linear algebra over the residual stream. The "aha moment" is that what looks like inscrutable high-dimensional computation is, in many cases, implemented by a small number of attention heads and MLP neurons executing identifiable, nameable operations—induction, copying, inhibition, lookup—that compose into a recognizable algorithm. If this hypothesis holds at scale, interpretability becomes an engineering discipline rather than a philosophical one.
How It Works
The Residual Stream Framework
The transformer architecture is most naturally analyzed through the residual stream lens (Elhage et al., 2021). Each layer reads from a shared vector and writes additive updates back to it, enabling clean attribution of computational contributions.
Explanation: Each layer's output is a residual correction to the stream, meaning any layer's contribution can be isolated and analyzed independently via direct path decomposition. Here is the residual stream at layer , is the multi-head attention block, and is the feedforward sublayer. The additive structure means the final logits decompose as a sum of contributions from every component, amenable to logit lens analysis.
Attention Head Decomposition
Each attention head in layer computes an output that can be written as a rank-factored linear map composed with a softmax routing pattern:
Explanation: Each head moves information from source positions to destination positions, scaled by attention weight , via a fixed OV (output-value) circuit that can be analyzed as a standalone linear map. Here and are value and output projection matrices; is the attention score from position to destination; and is the OV matrix whose eigenstructure encodes what the head copies. Separately, the QK circuit encodes where it attends. This factorization enables independent circuit analysis.
Superposition and the Polysemanticity Problem
A key mathematical obstacle is superposition: networks represent more features than they have dimensions by encoding features as nearly-orthogonal directions in a compressed space. Elhage et al. (2022) formalize this via a sparse coding objective. Let be a data point with latent features with sparsity . The network learns a matrix such that:
Explanation: The network trades off faithful reconstruction of frequent features against interference between all features, producing a geometry where features pack into superposition rather than occupying dedicated dimensions. The consequence is polysemanticity: individual neurons respond to multiple semantically unrelated features because they are simultaneously encoding components of many superposed feature directions, making naive neuron-level interpretation misleading.
Sparse Autoencoders for Feature Recovery
The current dominant approach to disentangling superposed representations is training a sparse autoencoder (SAE) on the residual stream (Cunningham et al., 2023; Bricken et al., 2023). Given activations , the SAE learns encoder and decoder with :
Explanation: The sparsity penalty forces the hidden code to use only a few active features at once, recovering the sparse ground-truth features that the network has superposed into a lower-dimensional activation space. Here is a bias, is the dictionary size (typically – the activation dimension ), and controls sparsity pressure. The decoder columns are interpreted as feature directions; the -th hidden unit activates when that feature is present in .
Causal Intervention and Circuit Analysis
Identifying a circuit requires not just correlation but causal proof via activation patching (Meng et al., 2022). The patch effect of replacing component 's activation with a counterfactual value on output logit is:
Explanation: A large implies that component causally mediates the behavior of interest, not merely correlates with it, providing the empirical basis for circuit identification. Here is the clean input, is a corrupted or counterfactual input, is the activation of component on input , and denotes Pearl's do-calculus intervention. Systematic patching across all components yields a causal attribution graph identifying the minimal circuit.
Chris Olah trained as a computer scientist and joined Google Brain, later Anthropic, becoming the primary architect of mechanistic interpretability as a formal discipline. His 2020 "Zoom In" essay and subsequent circuits papers established the core methodology of identifying individual features in neurons, composing them into circuits, and verifying claims via visualization and ablation on CNNs before scaling to transformers. Unusually for a leading AI researcher, Olah has no PhD and is largely self-taught—his influence stems entirely from the explanatory clarity and empirical rigor of his published work.
Neel Nanda completed his undergraduate degree at Cambridge and joined Anthropic then DeepMind, becoming the most prolific empirical practitioner of transformer mechanistic interpretability. He developed TransformerLens, the standard open-source library for activation patching and attention head analysis, and produced the definitive mechanistic account of how a two-layer transformer learns modular arithmetic ("grokking"), revealing that generalization corresponds to a phase transition in the weight structure implementing discrete Fourier features. Nanda's public daily research logs and tutorials have trained the majority of the current generation of interpretability researchers.
David Bau is a professor at UMass Amherst whose background spans computer graphics and program analysis, giving him an unusual perspective on networks as editable computational systems. His ROME paper (2022, with Meng et al.) introduced causal tracing—systematic activation patching to localize where factual associations are stored in GPT models—and demonstrated that mid-layer MLP modules in specific positions function as key-value stores for world knowledge. A striking result from this work: single factual associations can be edited with sub-1% collateral damage via rank-one weight updates, demonstrating that transformer weights are more modularly organized than previously assumed.
Intuition
Imagine you have recovered an ancient device and want to understand how it works. You could characterize it behaviorally—press button A, light B turns on—and build a comprehensive input-output table. That is what behavioral evaluations of neural networks do. Mechanistic interpretability is the decision to open the device and trace the wiring: not just what outputs follow from what inputs, but why—which transistors fire, which signals propagate, what intermediate states exist. The complication is that the device was assembled by an optimizer with no obligation to use human-readable components. So the circuit diagram you find may look like a pentagonal arrangement of directions in a 2D space rather than clean labeled wires—the optimizer discovered that packing five overlapping signals into two wires is more efficient than using five separate wires, because the signals are rarely all active simultaneously. Sparse autoencoders are the tool you use to unpack those overlapping signals back into separate, labeled wires before you can trace the circuit. Once unpacked, you discover that specific groups of attention heads are doing specific named operations—like the heads in GPT-2 that exclusively implement "copy the previous token" or the heads that implement "skip back to the beginning of the current subject"—and these compose into a recognizable subroutine, not unlike a for-loop with a hash-table lookup.