Vol. IV · Attention Plate 9 of 9drills, review, attention, causal mask, multi-head, costAC

Drills: Attention.

Five questions at a time from the whole volume, until attention is a tool you can reason about.

This plate draws rounds of five from the questions and predictions of the eight plates before it, with the reasoning and source plate after each answer.

Attention is the one mechanism that distinguishes a Transformer from the networks of Vol. III. Its arithmetic — dot products, a softmax, a mask, a weighted average — and its cost — quadratic in length — are used on nearly every later plate.

Below: a round of five. Answer each, read the explanation, and press “Next round” for another five.

What you will learn
Drills
A round of five questions drawn at random from the volume’s knowledge checks and try-its.

What to carry forward

Attention replaces a fixed-size memory with a lookup over every earlier token (plate IV.1): queries match keys by dot products, scaled by √d, and a softmax blends the values (plates IV.2–IV.3). The causal mask keeps every lookup honest and lets one pass train every position (plate IV.4), and several heads look in different ways at once (plate IV.5).

Trained heads fall into recognisable kinds — previous-token, sink, induction (plate IV.6) — but where a head looks is not proof that it matters (plate IV.8). And attention’s work grows with the square of the length (plate IV.7), which shapes much of the rest of the course. Vol. V assembles attention, MLPs, norms and residuals into the Transformer.

Questions whose answers depend on a workshop’s current reading are left out of the drill pool.

Terms

Attention
softmax(QKᵀ/√d)V.
Causal mask
No attention to later positions.
Head
One of several parallel attentions.
Ablation
Remove and measure.
Drill until softmax(QKᵀ/√d)V, the mask and 4Td are automatic.