6.3.7Interpretability & Explainability

Circuits and superposition

2,912 words13 min readdifficulty · medium

What Are Circuits?

Why Circuits Form: From First Principles

Start with gradient descent on a neural network. The loss function L\mathcal{L} depends on all parameters θ\theta, so:

Lθi=pathsLoutputoutputθi\frac{\partial \mathcal{L}}{\partial \theta_i} = \sum_{\text{paths}} \frac{\partial \mathcal{L}}{\partial \text{output}} \cdot \frac{\partial \text{output}}{\partial \theta_i}

Key insight: Not all paths contribute equally. Through gradient routing, only certain weight combinations get reinforced for a given task. Over training:

  1. Specialization: Weights form strong connections along task-relevant paths
  2. Pruning: Irrelevant paths have near-zero gradients, their weights stay small
  3. Emergence: The high-weight paths form interpretable circuits

What Is Superposition?

Deriving Superposition Capacity from Geometry

Setup: Model has nn dimensions, must represent mm features (m>nm > n). Each feature ii appears with probability pp (sparsity).

Claim: If features are sparse, superposition lets mm vastly exceed nn.

Derivation:

  1. Orthogonal baseline: Dedicate one dimension per feature. Capacity: exactly nn features. If features are sparse, most dimensions are zero most of the time — wasteful.

  2. Superposition alternative: Represent feature ii as unit vector vi\mathbf{v}_i, tolerating small overlap vi,vjs|\langle \mathbf{v}_i, \mathbf{v}_j \rangle| \le s for iji \neq j (an "almost-orthogonal" set).

  3. How many almost-orthogonal vectors fit? This is the spherical-code / Johnson–Lindenstrauss question. The key, correct fact is: m    exp ⁣(cs2n)m \;\lesssim\; \exp\!\big(c\, s^2\, n\big) for a fixed maximum overlap ss. That is, the number of vectors you can pack while keeping overlaps below ss grows exponentially in nn (for fixed ss), not linearly. This is why a model with only nn dimensions can encode far more than nn features.

    Why exponential, not n/s2n/s^2? Random unit vectors in Rn\mathbb{R}^n have pairwise overlap concentrated around 00 with standard deviation 1/n\approx 1/\sqrt{n}. The probability that a random pair exceeds overlap ss decays like exp(cs2n)\exp(-c\,s^2 n). A union bound over (m2)\binom{m}{2} pairs stays small as long as mexp(cs2n)m \lesssim \exp(c\,s^2 n) — hence exponential capacity.

  4. Sparsity is what makes it usable: Packing many vectors is geometrically possible, but decoding them under interference requires the active features to be few. If only kmpk \approx m p features are active at once, the total interference on any feature is sk\sim s\sqrt{k} (random-sign accumulation). Keeping this below the signal (1\approx 1) requires pp small — so sparser features → more usable superposition.

Why Neurons Become Polysemantic

A polysemantic neuron activates for multiple unrelated features. This is a consequence of superposition.

Mechanism:

  1. Model learns feature vectors {v1,,vm}\{\mathbf{v}_1, \ldots, \mathbf{v}_m\} in nn-dimensional space
  2. Neuron jj has activation aj=ifivija_j = \sum_i f_i \cdot v_{ij} where fif_i is feature presence
  3. If features 3, 17, and 42 all have a component along neuron jj's axis, that neuron responds to all three

Example: An LM neuron might activate for:

  • The word "apple" (fruit feature)
  • Corporate tech mentions (Apple Inc. feature)
  • The color "red" (apple-color feature)

All three use overlapping subspaces → one neuron participates in encoding all three.

How Circuits and Superposition Interact

Key relationship:

  • Circuits are the algorithm (the computational graph)
  • Superposition is the storage format (how features are packed)

A circuit might implement "detect edges then classify cat." The "edge" features might be superposed across 50 neurons, and the "cat" feature might be superposed with "dog" and "fox." The circuit uses specific linear combinations of those neurons to extract the right features.

Experimental Evidence

  1. Induction heads (Anthropic, 2022): Identified repeating-token circuits formed by cross-layer composition of previous-token heads (earlier) and induction heads (deeper). Ablation strongly degrades in-context copying.

  2. Superposition in toy models (Elhage et al., 2022): Trained ReLU networks on sparse features. Found networks reliably learn many more features than dimensions via superposition when features are sufficiently sparse.

  3. Polysemanticity in vision models (Olah et al., 2020): Neurons in InceptionV1 respond to multiple unrelated concepts (e.g., "car" + "dog face"). Sparse autoencoders disentangle these into monosemantic features.

Recall Explain to a 12-Year-Old

Imagine your brain has to remember 1,000 different types of Pokemon, but you only have 100 storage boxes. You can't fit one Pokemon per box!

Solution: You notice that you rarely see all Pokemon at once—maybe only 10 appear in any battle. So you create a smart labeling system: "Box 47 stores a bit of Pikachu, a bit of Charizard, and a bit of Mewtwo." When Pikachu appears, you look in Box 47 (and Boxes 12, 89) and combine the clues to recognize Pikachu. This is superposition: storing more things than you have space by using overlap (because things don't all appear together).

Circuits are like your battle strategies: "If I see Pikachu, use Water-type." They're the rules you follow. The storage trick (superposition) just helps you remember more Pokemon so your strategies can be smarter!

Connections

  • 6.3.01-Feature-visualization: Circuits process features; superposition encodes them
  • 6.3.05-Attention-head-interpretability: Attention heads are circuit components in Transformers
  • 6.3.08-Concept-activation-vectors: CAVs probe directions; superposition means multiple concepts per direction
  • 4.2.03-Sparse-autoencoders: Used to disentangle superposed features
  • 2.1.02-ReLU-and-activation-functions: Nonlinearity aids feature recovery under interference (but superposition itself is linear compression)

Flashcards

#flashcards/ai-ml

What is a neural network circuit?
A subgraph of the network (neurons + weighted connections) that implements a coherent, interpretable computational algorithm. Ablating it causally breaks the corresponding behavior.
What is superposition in neural networks?
When a model represents more features than dimensions by storing features as nearly-orthogonal (but not perfectly orthogonal) directions. It is fundamentally linear compression: m>nm > n features in nn dimensions.
Why does sparsity enable usable superposition?
Because only a few features are active at once, the accumulated interference smp\sim s\sqrt{mp} stays below the signal, so features remain decodable. Sparser features → more usable superposition.
Roughly how many almost-orthogonal vectors fit in Rn\mathbb{R}^n for fixed overlap ss?
Exponentially many: mexp(cs2n)m \lesssim \exp(c\,s^2 n). The geometric ceiling grows exponentially in nn, so it is rarely the binding constraint — sparsity is.
What is a polysemantic neuron?
A neuron that activates for multiple unrelated features. It's a consequence of superposition: multiple feature vectors have components along that neuron's axis.
How do you identify a circuit?
(1) Observe behavior, (2) Hypothesize which neurons/heads are involved, (3) Ablate (zero out) those components, (4) Check if behavior breaks. Circuits are defined by causal necessity, not correlation.
Where do induction heads live in a Transformer, and why?
In middle/deep layers (e.g. layers 5, 7, 9 in GPT-2), deeper than the previous-token heads they read from — cross-layer composition requires the writer (earlier) to run before the reader (later).
Does superposition require a nonlinear activation?
No. Superposition is linear compression (m>nm>n via a linear map, like random projections). Nonlinearity helps recover/denoise features, but is not needed to store them in superposition.
How are circuits and superposition related?
Circuits are the algorithm (computational graph); superposition is the storage format (how features are compressed). Circuits operate on linear combinations of superposed features.
Why can't you identify circuits by activation magnitude alone?
Because (1) circuits are about causal paths, not magnitude, and (2) superposition means the same neuron participates in multiple circuits. Must use ablation to test causal necessity.

Concept Map

reinforces paths

leads to

leads to

high-weight paths emerge as

leaves

properties

example

early layer

later layer

feeds residual stream to

OV circuit copies token

packs many features per neuron

enables

Gradient descent on loss

Gradient routing

Specialization of weights

Pruning weak paths

Circuits

Localized modular causal

Induction circuit

Previous-token head

Induction head

Output logits

Superposition

Compression

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho yaar, core idea yeh hai ki hum aksar sochte hain ki neural network ka har ek neuron ek specific cheez seekhta hai — jaise ek neuron "cat" detect karta hai, dusra "dog". Lekin reality mein aisa nahi hota. Network ek city ki tarah hai jahan multiple bus routes ek hi road share karte hain. Matlab, ek hi neurons ke group mein bahut saari features encode ho sakti hain — alag-alag activation patterns ke through. Isko superposition kehte hain: jab network ke paas features zyada hain aur dimensions kam, tab woh features ko "nearly orthogonal" directions mein pack kar deta hai taaki sab kuch thodi si jagah mein fit ho jaye. Aur circuits woh specific paths hain layers ke through jo koi ek meaningful algorithm implement karte hain, jaise "curved line detect karna" ya "ek token ko copy karna".

Ab yeh matter kyun karta hai? Socho, agar sirf 100 neurons 1,000 features encode kar sakte hain clever overlapping se, toh network basically compression kar raha hai — bahut efficient storage. Circuits samajhne se pata chalta hai ki network kya compute kar raha hai, aur superposition samajhne se pata chalta hai ki woh itni saari cheezein itni chhoti jagah mein kaise store karta hai. Example mein induction circuit dekho: ek "previous-token head" (early layer) tag karta hai ki har position se pehle kya aaya, phir ek "induction head" (deeper layer) us information ko padhkar pattern match karta hai — jaise "Mary ke baad John aaya tha" — aur next prediction copy kar deta hai. Isliye dono heads alag layers mein hote hain, kyunki jo head padhta hai woh baad mein chalna chahiye jo likhta hai.

Yeh sab interpretability ke liye super important hai. Agar hum verify karna chahte hain ki koi circuit sach mein kaam kar raha hai, toh hum usse ablate (zero out) kar dete hain — agar behavior tut jaata hai, matlab woh circuit causal hai, sirf coincidence nahi. Yeh technique AI ko "black box" se "understandable system" banane ki taraf le jaati hai, jo safety aur trust ke liye zaroori hai. Toh basically, circuits + superposition milkar humein andar jhaankne ka nazariya dete hain — ki yeh giant models actually andar se kaise sochte aur kaam karte hain.

Go deeper — visual, from zero

Test yourself — Interpretability & Explainability

Connections