Multi-head attention
What it is
Several attention heads run in parallel on projected subspaces, then concatenate — different heads learn different relations.
When to use it
The core mixing operation in every transformer; head specialization explains much of interpretability work.
Caveats
Many heads turn out to be redundant and can be pruned with little loss. For a fixed model width, more heads means fewer dimensions per head, and the cost is still quadratic in sequence length.
Key ideas
- Runs several attention operations in parallel, each in its own subspace
- Different heads can attend to different relations or positions
- The outputs are concatenated and projected back to the model width
Related architectures
Original paper
Attention Is All You Need (2017, arXiv)