Why does a transformer layer use many attention heads instead of one wide head?
answer
- One distribution, one relation
- Attention mass is a budget of one
- Width does not lift the softmax bottleneck
- Independent subspaces, then concatenate and project
- Head dimension is model width over head count
basics
~20 sOne softmax distribution can concentrate on only one thing at a time, so a single head must choose which relation to encode. Splitting the same width into several heads lets a layer attend to several relations in parallel, each in its own subspace, then combine the results.
solid answer
~50 sA head's output is a single softmax-weighted average, and attention mass is a budget of one. If a head spends it resolving a pronoun, it cannot simultaneously spend it tracking the subject-verb agreement or the nearest opening bracket. Widening a single head does not fix that — it adds dimensions to the value it reads out but still leaves one distribution over positions. Multiple heads split the model dimension into h independent subspaces, each with its own query, key and value projections, so each computes its own attention pattern over the same tokens. Their outputs are concatenated and passed through an output projection that mixes them back into the residual stream. Empirically heads specialize: some track syntactic relations, some attend to the previous token, some to delimiters, some to rare tokens. Note the parameter count stays roughly constant, because the head dimension is usually the model dimension divided by the head count — you are re-partitioning capacity, not adding it.
go deeper
Know that a layer runs several attention heads in parallel over the same tokens, and that each can focus on a different relationship before their results are combined.
Explain the constraint that motivates it: one softmax means one distribution and therefore one relation per head, and widening a head does not change that. Then give the mechanics — split width into subspaces, concatenate, project.
Discuss the tradeoff concretely: at fixed model width, more heads means narrower heads and a weaker matching function per head. Be ready to describe how you would measure head redundancy by ablation or attention entropy.
Own the framing that head count allocates a roughly fixed per-layer attention budget, and be honest that specialization is emergent and partly redundant rather than designed. Argue defaults from what the workload's relations actually look like.
## The constraint that motivates multiple heads Attention computes, for each token, one probability distribution over positions and one weighted average of value vectors. That is a strong restriction. A distribution that sums to one is a scarce resource: putting 0.9 on the referent of a pronoun means having 0.1 left for everything else in the sentence. So a single head expresses essentially one relation per token. Sentences contain many relations at once. In "the trophy didn't fit in the suitcase because it was too big", the token "it" simultaneously participates in a coreference relation (to "trophy"), a subject relation to "was", and a position in a clause introduced by "because". A model that can encode only one of these per layer is handicapped. Making the head wider does not lift the constraint. Increasing d_k gives richer queries and keys and increasing d_v gives a richer payload, but the head still produces one distribution over positions. The bottleneck is the softmax, not the vector width. ## What multi-head actually does The layer splits its width. With model dimension d_model and h heads, each head typically projects to d_k = d_model / h. Every head has its own W_Q, W_K and W_V, runs the same scaled-dot-product computation independently on the same input, and produces its own (n, d_v) output. Those h outputs are concatenated back to width d_model and passed through a final output projection W_O before being added to the residual stream. Two consequences follow from the d_model / h convention. First, parameter count is roughly unchanged relative to a single head of full width — this is a re-partitioning of capacity, not an increase. Second, there is a real tension: at fixed model width, more heads means narrower heads. Each head gets a lower-dimensional subspace to work in, and past some point individual heads become too thin to represent a useful matching function. Head count is a genuine hyperparameter with a sweet spot, not something to maximize. The output projection deserves a mention because it is often skipped. Concatenation alone would leave each head's contribution confined to its own slice of the output vector. W_O mixes across slices, letting downstream computation combine what different heads found. ## What individual heads specialize in Interpretability work on trained models consistently finds recognizable, human-nameable behaviours in some heads. Common examples include heads that attend almost entirely to the immediately preceding token, heads that attend to the start-of-sequence token as a kind of no-op sink when nothing is relevant, heads that track matching delimiters or brackets, and heads that carry syntactic dependencies such as a verb attending to its subject. A coreference-flavoured head in the trophy sentence would put most of "it"'s attention mass on "trophy". Three honest caveats belong with that story. Specialization is emergent, not designed — nothing in the architecture assigns roles, and a different training run produces a different assignment. Many heads have no clean interpretation at all, and pruning studies have repeatedly shown that a substantial fraction of heads can be removed from a trained model with modest loss in quality, which suggests real redundancy. And attention weights alone are an incomplete account of a head's function: what the head *writes* through its value and output projections matters as much as where it looks. ## How to talk about this in an interview The strong answer has three beats. First, the constraint: one head, one distribution, one relation. Second, the mechanism: split the width into independent subspaces, run attention in each, concatenate and project. Third, the tradeoff: head count trades the number of relations a layer can attend to against how expressive each one can be, at roughly constant parameter cost. A weak answer says "more heads means the model can look at more things" and stops there. It is not wrong, but it does not identify *why* one head cannot look at more things, which is the actual question being asked. ## A practical framing If you are choosing head count for a model you control, the useful mental model is: total attention capacity per layer is roughly fixed by d_model; heads decide how you slice it. Many narrow heads suit tasks with many simple positional or syntactic relations; fewer wide heads suit tasks where each match needs a richer notion of similarity. In practice the field converged on head dimensions in the 64-128 range and derives the head count from the model width, which is a reasonable default to state if asked.
- At a fixed model width, what happens as you keep increasing the number of heads?Each head gets narrower, since head dimension is typically model width divided by head count. Beyond a point the per-head subspace is too low-dimensional to express a useful query-key matching function, and quality degrades even though the layer can nominally attend to more relations at once. Head count is a tradeoff between number of relations and expressiveness per relation, not a quantity to maximize.
- Why is an output projection applied after the heads are concatenated?Concatenation alone confines each head's contribution to its own slice of the output vector, so nothing downstream can combine what different heads found without doing that mixing itself. The output projection is a learned linear map across the full concatenated width, letting the layer blend heads before the result is added back into the residual stream.
- How would you tell whether a trained model's heads are redundant?Ablate them: zero out one head at a time and measure the change in loss or task metrics. Pruning studies routinely find that a large fraction of heads can be removed with modest degradation, while a small set is critical. Complementary signals are attention entropy — heads that are near-uniform for every input are doing little — and similarity between heads' attention patterns across a corpus.
A single head is like one highlighter pen: you can emphasize one thread through a paragraph, and emphasizing a second means giving up some of the first. Several heads are several pens in different colours running over the same text at once.
saying these in an interview costs you the question
- Saying more heads add parameters or capacity, when width is usually just re-partitioned
- Claiming head roles are assigned by the architecture rather than emerging from training
- Believing every head in a trained model has a clean interpretable function
- Thinking a single wider head could do the same work as several narrow ones
- Forgetting the output projection and treating concatenation as the final step