Transformer Internals · 5 Interactives

A Committee of Spotlights Reads Your Sentence

Every transformer layer runs many attention heads in parallel — and they are not clones. One head only looks one word back. One links verbs to their subjects. One hunts the rarest word. And some do nothing at all. Point the spotlights yourself and watch the committee divide the labor.

One head Four specialists The merge Dead heads & pruning Ablation surgery
EP 01

One head, one habit — the spotlight that only looks back

An attention head is a rule for pointing: for each word (the query), it spreads a fixed budget of attention over the words before it. Meet the simplest specialist found in every real transformer — the previous-token head. Click any word below: whatever you pick, ~85% of its attention snaps to the word immediately to the left. Then click the first word.

Why it matters: this exact head exists in GPT-class models and it is position-driven, not meaning-driven — which is why it works on sentences it has never seen. Boring on its own, but in EP 03 you'll see other heads can only do their jobs because this one keeps handing every token its left neighbor.
EP 02

Four heads, four jobs — switch the spotlight

Same sentence, four different heads. Pick a head, then click words to move the query. The syntax head leaps six tokens from “slept” back to “fox” (the thing that slept), the rare-token head stays locked on “hounds” from anywhere, and the dead head… see for yourself.

The real thing: when researchers opened up BERT and GPT-2, they found exactly this zoo — heads for previous tokens, heads for subject–verb links, heads for rare words, and many that fixate on one position and carry no usable signal. Multi-head attention is not one smart reader; it's a committee of narrow specialists.
EP 03

The merge — why a committee beats any single head

The model doesn't use heads one at a time — it adds all their outputs together. Below, every arc is a relationship this sentence needs (each next-word link, two long-range syntax links, one rare-word link). Toggle heads in and out of the committee and watch which relationships the merged attention still captures (green) and which go dark (red). Then try the killer experiment: replace all four heads with four copies of the same head.

Division of labor is the whole point: four diverse heads cover 100% of the relationships; four clones of the “best” head cover barely three-quarters, no matter how good that head is. This is why transformers use 12–128 heads per layer instead of one big one — capacity spent on different views beats capacity spent on the same view four times.
EP 04

Dead weight — find the heads you can delete

Here is a 12-head mini-model and a battery of 24 live queries (next-word, syntax, rare-word recall). Each tile shows a head's attention fingerprint and how much accuracy drops if you remove it — computed by actually re-running the battery without it. Drag the slider to prune the weakest heads first, or click any tile to cut that head yourself. Watch how far you can go before anything breaks.

Head behaviors are hand-scripted to mirror what interpretability studies find in trained transformers; the accuracy numbers are computed live from this page's 24-query battery, not quoted from a paper.

This is why pruning works: Voita et al. cut 38 of 48 attention heads from a trained translation model with almost no quality loss — most heads are redundant, dead, or noise, exactly like the nine here. The catch is the cliff: the last few specialist heads carry nearly everything, and one cut too far is catastrophic, not gradual.
EP 05

Ablation surgery — break grammar by removing one head

“The keys to the cabinet ___” — is it is or are? The verb must agree with keys (far away, plural), not cabinet (nearby, singular). A syntax head solves this by attending straight past the distractor to the true subject. Run the model, then ablate that one head and watch the prediction — computed live from the attention mass on each noun — flip to the wrong answer.

Causality, not correlation: ablation is how interpretability researchers prove a head really does a job — knock it out and the specific ability dies while everything else survives. Without its agreement head the model doesn't crash; it degrades to “agree with the nearest noun”, the same shortcut humans blurt out when rushed. Whole abilities in GPT-scale models hang on a handful of such heads.
Keep playing
Language Models
Self-Attention vs Cross-Attention
Same math, two sockets: itself or another sequence
Language Models
Induction Heads
The copy circuit behind in-context learning