Circuits in Neural Networks
Circuits in neural networks are sparse, compositional subgraphs of neurons and weights that implement identifiable computational primitives — ranging from simple edge detectors to complex multitoken reasoning patterns — discoverable through mechanistic interpretability methods such as activation patching, causal tracing, and sparse probing. Understanding circuits matters because it provides the first principled ladder from raw parameters to human-interpretable behavior, enabling AI safety researchers to verify whether a model's internal computation is aligned with its stated objectives. Remarkably, the same circuits — curve detectors, high-low frequency detectors, even multimodal neurons — have been found to form independently and near-identically across entirely different model families trained on different datasets, a phenomenon called universal circuits that suggests deep geometric constraints on learned representations.
A neural network is not a monolithic black box but a modular collection of algorithms: specific subsets of weights form circuits that reliably mediate specific behaviors, and these circuits can be reverse-engineered the same way a hardware engineer reads a PCB. The "aha moment" is that gradient descent, despite having access to no inductive bias toward modularity, nevertheless discovers near-modular structure because modular solutions generalize better under natural data distributions. This means interpretability is not merely aspirational — it is a scientific program with falsifiable hypotheses: claim that circuit C computes function f, then verify by ablating C and confirming the model can no longer compute f while leaving unrelated behaviors intact. The completeness criterion (the circuit accounts for the model's full performance on the task) and the minimality criterion (no strict subgraph suffices) together make circuit claims empirically precise.
How It Works
Formal Circuit Definition
Let a transformer (or MLP) be a computational graph where nodes are residual-stream positions or nonlinear units and directed edges carry weight matrices. A circuit is a subgraph together with an associated task distribution and behavior function .
Explanation: The faithfulness loss measures how well the isolated circuit , run with all non-circuit nodes mean-ablated, reproduces the full model's output distribution on the task. Here denotes the model with all nodes outside replaced by their mean activation over , and is KL divergence or cross-entropy; a circuit is faithful when this quantity is near zero.
Activation Patching and Causal Tracing
Given a clean input and a corrupted input (e.g., a subject-swapped factual prompt), the activation patch effect of node at layer is:
Explanation: This measures how much restoring node 's clean activation into the corrupted forward pass recovers the correct behavior logit, isolating 's causal contribution. The operator denotes surgical replacement of activation during the forward pass on with the value computed on . Meng et al. (2022) used this in ROME/MEMIT to localize factual association storage to mid-layer MLP modules in GPT-2 and GPT-J.
Path Patching
Path patching (Wang et al., 2022) refines activation patching by measuring the effect of restoring 's activation only along a specific downstream path , freezing all other incoming edges to :
Explanation: Path patching decomposes the total effect of a node into the contributions flowing through each downstream route, enabling edge-level rather than node-level circuit decomposition. This resolves the ambiguity that a node can have high because it feeds many irrelevant heads that happen to compose with the relevant one.
Logit Lens and Direct Logit Attribution
In a transformer with residual stream (where is the contribution of the -th component — attention head or MLP layer), the direct logit attribution of component to token is:
Explanation: This decomposes the final logit for token into a sum of signed scalar contributions from each attention head and MLP layer, exploiting the linearity of the residual stream. Here is the unembedding matrix and is the one-hot token indicator. Elhage et al. (2021) showed that this decomposition is exact and admits clean circuit-level bookkeeping in the "Mathematical Framework for Transformer Circuits."
Superposition and Polysemanticity
Neurons are rarely monosemantic. The superposition hypothesis (Elhage et al., 2022) posits that a model with neurons represents near-orthogonal features by encoding them as interference patterns, tolerating cross-talk proportional to feature frequency and importance. The capacity of a layer under superposition scales as:
Explanation: The maximum number of features representable with at most interference noise scales inversely with feature sparsity (fraction of inputs on which each feature is active) and inversely with tolerated noise squared. This has profound consequences for circuit analysis: individual neurons are poor primitives; directions in activation space (or sparse dictionary atoms learned by sparse autoencoders) are the correct unit of circuit decomposition.
Chris Olah trained as a self-taught researcher and joined Google Brain before co-founding Anthropic, where he leads mechanistic interpretability research. His 2020 "Zoom In" paper with colleagues at OpenAI introduced the circuits conjecture — that neural networks learn a universal library of reusable, reverse-engineerable circuits — by demonstrating specific curve detectors and high-low frequency detectors shared across InceptionV1, AlexNet, and VGG. Remarkably, Olah's most influential early work, the 2014 blog post "Neural Networks, Manifolds, and Topology," was written before he held any formal research position and circulated purely on his personal blog, yet it shaped a generation of representation learning researchers.
Neel Nanda completed his undergraduate degree at Cambridge and joined DeepMind's interpretability team after a brief stint at Anthropic, publishing at an unusually high rate for a junior researcher. His 2022 paper "Progress Measures for Grokking via Mechanistic Interpretability" reverse-engineered the exact algorithm (modular arithmetic via Fourier components) that a one-layer transformer discovers during the grokking phase transition, providing the first complete mechanistic account of a generalization phenomenon. He also released TransformerLens, the open-source library that has become the de facto standard toolkit for mechanistic interpretability experiments, dramatically lowering the barrier to circuit research.
Intuition
Think of a mature city's electrical grid. The grid as a whole is vastly complex, but it is not random — it is made of identifiable, reusable components: substations, transformers, breaker boxes, and residential circuits. An electrical engineer does not need to simulate every electron to understand why turning off breaker 7 kills the kitchen lights; she traces the specific copper path from the panel to the outlet. Neural network circuits work the same way. Gradient descent, over millions of gradient steps on natural data, finds that the most weight-efficient solution is to reuse primitive computational motifs — edge detectors feeding curve detectors feeding shape detectors — stacked compositionally. The reason the same circuits appear in ResNet-50 trained by Google and VGG trained by Oxford is the same reason that every city's electrical grid uses the same three-phase AC standard: the problem has a unique near-optimal modular solution. Superposition is like running multiple circuits through the same physical wire using frequency-division multiplexing: interference is low as long as signals are sparse, but tracing individual circuits requires the equivalent of a spectrum analyzer — which is exactly what a sparse autoencoder is.