Skip to content

ARENA Chapter 1: Transformer Interpretability

optionalextendedfundamentalcourserubric 8/122023 · ~1200 min

Callum McDougall and the ARENA team

Status

TL;DR. ARENA (“Alignment Research Engineer Accelerator”) Chapter 1 is a set of coding notebooks with exercises, tests and solutions. They take you from a transformer written from scratch to replicating published circuits. Neel Nanda’s guide calls them “fantastic” and tells newcomers to just do them, prioritising ruthlessly. The current home is learn.arena.education. The older streamlit URL quoted in many posts now redirects there.

You learn interpretability by re-implementing it. Each section has learning objectives, then exercises where you write functions such as induction_score_hook, residual-stream patching and head-to-head path patching. Tests check your code against reference solutions.

SectionWhat you buildPriority (Nanda’s guide)
1.1 Transformers from ScratchGPT-2 in PyTorch, loading pretrained weightsEssential background
1.2 Intro to Mech InterpTransformerLens, induction heads, hooks, direct logit attribution, ablations, QK/OV and K-composition circuitsEssential (first 3 sections)
1.3.1 Linear Probesprobes for deception in a model playing CoupUseful
1.3.2 Function Vectors & Model Steeringnnsight, task-encoding vectors, function vectors, GPT2-XL steering vectorsSteering is nice to have
1.3.3 Interpretability with SAEsdecompose activations, monitor and steer with SAE latentsWorthwhile
1.3.4 Activation Oraclesreveal hidden knowledge with activation oraclesFrontier
1.4.1 Indirect Object Identificationlogit attribution, activation patching, path patching, minimal circuit (faithfulness, completeness, minimality)Recommended
1.4.2 SAE Circuitstrace SAE features across layersLater
1.5.x Toy modelsbrackets, grokking, OthelloGPT, superpositionPick by interest

Why it matters for this track. Every causal page on this site assumes you can run a patching sweep. ARENA 1.4.1 is where you actually build one, on the IOI circuit. For IR, the same pipeline transfers almost directly to rankers, as MechIR shows. The main change is that the metric becomes a relevance score.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Mechanism

    In the 1.4.1 IOI exercises, explain the logit-difference metric, the difference between noising and denoising patches, and what a residual-stream patching sweep over layers and positions reveals.

    What a strong answer covers
    • The metric is logit(IO) minus logit(S), e.g. Mary vs John; the model puts almost all its mass on these two names, so the difference measures task performance.
    • Denoising patches clean activations into a corrupted run and asks what is sufficient to restore behaviour; noising patches corrupted activations into a clean run and asks what is necessary.
    • A sweep over layers and positions shows information moving from the S2 and name positions in early and middle layers to the final position in later layers.
    • Results are usually normalised so 0 means corrupted performance and 1 means clean performance.
  2. Derive / compute

    In 1.2 you compute an induction score with a hook. For a sequence of random tokens repeated twice, derive which attention offset an induction head attends to and how to turn the attention pattern into one score per head.

    What a strong answer covers
    • With a random sequence of length T repeated, the token at position i in the second half matches position i minus T.
    • An induction head attends from i to the token after the earlier match, at position i minus T plus 1, so it sits on the diagonal offset by T minus 1.
    • Score: hook the attention pattern (hook_pattern), take that off-diagonal stripe in the second half and average it per head.
    • Heads above a chosen threshold are candidate induction heads; confirm by ablating them and checking that the loss on the repeated half goes back up.
  3. Design

    Adapt ARENA's IOI pipeline to a BERT cross-encoder that scores a query–document pair. What replaces the logit difference, the clean and corrupted inputs, and path patching's senders and receivers?

    What a strong answer covers
    • Metric: the relevance logit, normalised between the clean (relevant) and corrupted (term removed or swapped) runs.
    • Clean and corrupted inputs must have the same length: e.g. the document with a query term versus one with a non-query token of the same length.
    • Residual and head patching locate the positions and heads that carry the term-match signal.
    • Path patching: senders are candidate matching heads, receivers are the heads or the final classifier position, to separate direct and mediated effects.

Done with this page?

Status