True or false: swapping a single-head attention layer for a 12-head one (same d_model) raises the parameter count.
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
False. Multi-head attention reshapes the existing d_model-wide projections into h smaller blocks; the parameter count is identical to single-head at the same d_model.
Picture a giant table you can either use as one large workspace or partition with movable dividers into 12 smaller workspaces. The wood is the same; the dividers are free. Multi-head attention is the partitioned version of the same table, no extra material spent. What you gain is the ability for 12 people to work in parallel on different problems, not a bigger workspace.
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.
4m: the projection shape accounting, why multi-head is a reshape and not new parameters, the parallel-specialization inductive-bias argument, the distinction between parameter count and capacity, and the KV cache asymmetry.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming each head adds its own full-width (d_model x d_head) projection on top of the existing one. The heads slice the existing matrix; they do not add to it.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.