Part II — Inside the Transformer Chapter 05

Multi-Head Attention: Many Lenses at Once

Why one spotlight isn’t enough — tracking pronouns, grammar, and meaning in parallel.

8 min read · 3 interactive labs · Zero math required

Read this famous sentence carefully:

“The trophy didn’t fit in the brown suitcase because it was too big.”

Without even breaking a sweat, your brain just solved three completely different puzzles at the exact same moment:

Now ask yourself: could a single attention spotlight keep all three of those jobs crisp at once? No — because each job needs a completely different Question Tag (Query).

The Big Idea

Instead of using one spotlight per layer, a Transformer runs dozens of independent spotlights in parallel — called Attention Heads. Each head wears its own specialized lens, tracks its own kind of relationship, and then the model blends all their discoveries together.

1. The Lens Switcher

Below is our trophy-and-suitcase sentence viewed through three different attention heads — plus a combined view. Click through the colored lenses one by one. Then hit the golden Swap “big” ↔ “small” button and watch what happens to the Pronoun Head!

Interactive Lab 1 The Lens Switcher — Multi-Head Attention
With big at the end, the Pronoun Head points it straight back to trophy (86% vs. 10% for suitcase). Click Swap “big” ↔ “small” to see the beam leap!

That leap is one of the most magical sights in language modeling. Flipping a single adjective at the very end of the sentence — big to small — rewires what it means, while the Adjective Head and Action Head stay completely steady on their own jobs.

2. Why Parallel Heads Beat One Giant Spotlight

You might wonder: why bother splitting attention into separate heads? Couldn’t one really big spotlight just point at every relevant word at the same time?

Remember that a single attention spotlight has to divide its total brightness (100%) across all the words it looks at, and then average their Value packets into one single bundle. When you force one spotlight to chase three different questions at once, the beams dilute into a muddy gray soup. Separate heads keep each signal razor-sharp in its own lane before combining them cleanly.

Use the slider below to increase the number of active questions from 1 to 3, and compare what happens on the left (Single Spotlight) versus the right (Multi-Head Team).

Interactive Lab 2 Parallel Heads vs. Single Spotlight
Questions at once: 3
With 3 simultaneous questions, the single spotlight splits its focus into three weak, muddy strands (32% each) that blur together. Meanwhile, 3 parallel heads keep every relationship bright and distinct before merging!
How Many Heads Do Real Models Have?

Small models like GPT-2 use 12 heads per layer. Frontier models use 64 to 128+ heads in every single layer — meaning thousands of specialized spotlights scan your prompt in parallel in a fraction of a second.

3. What Do Real Attention Heads Actually Learn?

Here is the twist: engineers never hand-code a “Pronoun Head” or an “Adjective Head.” Every head starts out completely blank and random. Yet after reading billions of sentences, researchers who peek inside trained Transformers discover remarkably clear specialists emerging all on their own!

Click each specialist card below to watch how these real discovered heads read a sentence.

Interactive Lab 3 Head Specialization Gallery — Real Discovered Patterns

That third specialist — the Induction Head — is one of the most exciting discoveries in modern AI research. It is a big reason why you can show an LLM a brand-new pattern in your prompt and watch it immediately imitate the pattern on the very next line!

We now understand how words pass clues to one another through dozens of parallel lenses. But there is still a huge mystery left: if I type The Eiffel Tower is in, the word Paris is nowhere in the sentence. Where do world facts live inside the Transformer? Let’s open the Memory Vault in Chapter 6.

Check Your Intuition

Why do Transformers use Multi-Head Attention instead of a single large attention spotlight?