One attention head learns one kind of relationship; a transformer runs many in parallel. Learn why multiple heads help, how to split the model dimension into heads, run them in parallel and concatenate, and backprop through the whole thing — building a gradient-checked multi-head attention layer in NumPy.
Welcome to Multi-Head Attention, the third module. A single attention head, however well trained, can only express one attention pattern per position — one notion of what to look for. Real transformers run several heads at once, each free to attend to a different kind of relationship, and then combine what they find. This module builds that from scratch.
You’ll start with the motivation: why one head isn’t enough, shown with two heads that learn to attend to genuinely different things. Then you’ll implement the mechanics — splitting the model dimension into heads of size , running scaled dot-product attention in parallel across all of them, and concatenating the results before a final output projection mixes them back together. Finally you’ll derive the backward pass through the split, the concatenation, and the projection — reusing the single-head gradients from Module 2 — and verify it against numerical gradients. The guided project assembles a clean, gradient-checked multi-head attention layer you’ll stack into the full transformer block next.
Start with Lesson 1, where a single head runs out of room.
Complete all 5 lessons to finish the Multi-Head Attention module.