FoundationsChecking saved investigationReading browser-local route memory before showing a continuation.

Foundation Lab

Transformer Circuits, Induction Heads & Mechanistic Interpretability

These frameworks study GPT-style models, including Llama-3 and Claude-3, by identifying concrete circuits

Concept 13 of 100RepresentationsPhase 5
#13CircuitsRepresentations
key equationr_{l+1} = r_l + W^{\text{attn}}_l r_l + W^{\text{mlp}}_l r_l

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 13 of 100CircuitsRepresentations / Phase 5: Representation & interpretability
Current question

Interactive visualizations of how QK and OV matrices implement algorithms like induction

r_{l+1} = r_l + W^{\text{attn}}_l r_l + W^{\text{mlp}}_l r_l
PredictionCommit before the demo.

Ask what should change when the equation is manipulated, then let the visualization test that expectation.

EvidenceCompare local witness and source.

Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue through the atlas.

Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.

Why It Matters for Modern Models

  • These frameworks study GPT-style models, including Llama-3 and Claude-3, by identifying concrete circuits
  • Inform safety research (locating deception-related circuits) and architecture design

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Interactive visualizations of how QK and OV matrices implement algorithms like induction
  • Broader taxonomies of circuit motifs beyond a few toy examples

Interactive Visualization

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.

Key Equation
rl+1=rl+Wlattnrl+Wlmlprlr_{l+1} = r_l + W^{\text{attn}}_l r_l + W^{\text{mlp}}_l r_l

Decompose transformer computations into linear components on the residual stream:

rl+1=rl+Wlattnrl+Wlmlprlr_{l+1} = r_l + W^{\text{attn}}_l r_l + W^{\text{mlp}}_l r_l

Induction heads: specific attention heads implement an algorithm:

[A][B][A][B][A][B]\dots[A] \rightarrow [B]

by attending from the final [A] token to previous [A] tokens and copying the subsequent token's representation.

The sudden appearance of these heads is tied to a phase transition in in-context learning.

Canonical Papers

A Mathematical Framework for Transformer Circuits

Elhage et al.2021Anthropic
Read paper →

In-Context Learning and Induction Heads

Olsson et al.2022Anthropic
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.