LLM & Transformer Fundamentals·Question 6 of 109Basic

Why does the transformer use multiple attention heads instead of one large one?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Because a single softmax produces a single weighting over positions per token - one "view" of the context. A token often needs several different relations resolved simultaneously: which noun does this pronoun refer to, what's the syntactic head of this phrase, what came just before me, which delimiter opened this bracket. Averaging those into one attention distribution destroys information. Multi-head attention runs h independent attention operations in parallel subspaces so each can specialise.

Full worked answer with diagram

Because a single softmax produces a single weighting over positions per token - one "view" of the context. A token often needs several different relations resolved simultaneously: which noun does this pronoun refer to, what's the syntactic head of this phrase, what came just before me, which delimiter opened this bracket. Averaging those into one attention distribution destroys information. Multi-head attention runs h independent attention operations in parallel subspaces so each can specialise.

Mechanically: instead of one attention over d_model-dimensional Q/K/V, split into h heads of dimension d_model/h (e.g. 4096 → 32 heads × 128). Each head gets its own learned Q/K/V projections into its subspace, computes attention independently, and the h outputs are concatenated and mixed by the output projection W_o. Total parameter count and FLOPs are approximately the same as one full-width head - you're partitioning the computation, not adding to it. What you gain is h independent softmaxes; what each head loses is representational width (a 128-dim dot product is a lower-rank similarity measure than a 4096-dim one).

Empirically, interpretability work has found heads with recognisable roles - previous-token heads, positional heads, and famously induction heads (pairs of heads implementing "find the previous occurrence of this token and copy what followed it"), which are central to in-context learning. It's also empirically true that many heads are redundant after training - head-pruning studies showed you can remove a substantial fraction with modest quality loss - which is part of the intuition for why sharing K/V across query heads (MQA/GQA) works.

Head count is a tuned hyperparameter: too few heads underfits the diversity of relations; too many makes each head's subspace too narrow. head_dim between 64 and 128 has been a stable sweet spot across model generations.

Worth sketching. It makes clear you are partitioning one computation, not stacking h copies of it.

flowchart LR
    X["x, d_model = 4096"] --> SP["split into 32 subspaces<br/>head_dim 128"]
    SP --> H1["head 1: own Q/K/V,<br/>own softmax"]
    SP --> H2["head 2"]
    SP --> HN["head 32"]
    H1 --> C["concat back to 4096"]
    H2 --> C
    HN --> C
    C --> WO["W_o mixes the heads"]

What a good answer covers

  • Because a single softmax produces a single weighting over positions per token - one "view" of the context
  • A token often needs several different relations resolved simultaneously
  • Averaging those into one attention distribution destroys information
  • Multi-head attention runs h independent attention operations in parallel subspaces so each can specialise
  • Mechanically: instead of one attention over d_model-dimensional Q/K/V, split into h heads of dimension…

Key terms: induction heads

Interviewer follow-ups to expect

  1. What is an induction head and why does it matter for in-context learning?

  2. If many heads are redundant, what architectural optimisations does that motivate?

  3. Does multi-head attention cost more FLOPs than single-head at equal d_model?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep