Quant Memo
Advanced

Attention Entropy and Head Collapse

An attention head's entropy measures how spread out its focus is across tokens; when entropy collapses toward zero during training, the head has degenerated into always attending to just one or two tokens, wasting its capacity.

Prerequisites: The Self-Attention Mechanism

Every attention head produces a probability distribution over which tokens to focus on for each query position. The Shannon entropy of that distribution measures how spread out the focus is: high entropy means the head is attending broadly across many tokens with similar weight, while entropy near zero means the head has collapsed onto a single token, putting almost all its attention weight there regardless of context. A small amount of entropy collapse is healthy and expected — some heads genuinely should specialize, for instance a head that always attends to the previous token to track local word order. But when many heads across a model collapse to near-zero entropy, especially onto an uninformative token like the first token in the sequence or a delimiter, it is usually a sign the model has learned a degenerate shortcut: rather than doing useful contextual mixing, that head has effectively become a no-op, always retrieving the same fixed value no matter what the query is.

Widespread head collapse tends to happen with certain training instabilities — poor learning-rate warmup, or heads that never received a strong enough gradient signal early in training to learn something more useful — and it correlates with wasted model capacity, since a collapsed head contributes little beyond what a constant vector would.

Attention entropy tracks how spread out a head's focus is; a small number of low-entropy, specialized heads is normal, but widespread collapse toward a single uninformative token across many heads signals wasted capacity or a training pathology, not learned specialization.

Related concepts

Practice in interviews

Further reading

  • Voita et al., Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting (2019)
ShareTwitterLinkedIn