Define a single attention head, what does one head actually own and produce?
A head owns its own Q, K, V projections of width d_head, runs its own softmax, and produces a d_head-dimensional context vector per token.
Think of a panel of judges scoring an audition. Each judge has a private notebook for what they care about, a private notebook for what each contestant offers, and a private notebook for the contestant's actual material. Every judge scores the contestants independently using only their own three notebooks, never peeking at another judge's notes. After scoring, each judge writes down a short personal verdict. The verdicts are then stapled together and handed to a single producer who reads the whole stack and writes the final result on the show. Each judge is one independent scorer in the layer; the producer at the end is the one who mixes the verdicts back into the show.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6-8 min: what a head owns + shape of W_Q, W_K, W_V + d_head formula + parallel execution + concat + W_O mixing + GQA and MQA variants.
Real products, models, and research that use this idea.
- GPT-3 175B: d_model = 12288, n_heads = 96, d_head = 128. Standard multi-head, every head owns its own Q, K, V.
- Llama-3-70B: d_model = 8192, 64 Q heads, 8 KV heads via GQA, d_head = 128.
- Llama 4 Maverick and DeepSeek V4 follow the same d_head = 128 convention with GQA-style sharing for KV.
- Gemma 4 uses similar head splits with the modern QK-norm and grouped sharing patterns.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf d_head is fixed at 128, what changes when you scale up d_model?
QWhy is W_O specifically d_model by d_model and not something else?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying heads share Q, K, and V projections. They do not in standard multi-head attention. Each head has its own (d_model x d_head) projection matrices.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.