[Paper Review] Are Sixteen Heads Really Better than One?
The paper shows that many transformer attention heads can be pruned at test time with minimal or no loss in performance, sometimes reducing layers to a single head and improving inference speed significantly.
Attention is a powerful and ubiquitous mechanism for allowing neural models to focus on particular salient pieces of information by taking their weighted average when making predictions. In particular, multi-headed attention is a driving force behind many recent state-of-the-art NLP models such as Transformer-based MT models and BERT. These models apply multiple attention mechanisms in parallel, with each attention "head" potentially focusing on different parts of the input, which makes it possible to express sophisticated functions beyond the simple weighted average. In this paper we make the surprising observation that even if models have been trained using multiple heads, in practice, a large percentage of attention heads can be removed at test time without significantly impacting performance. In fact, some layers can even be reduced to a single head. We further examine greedy algorithms for pruning down models, and the potential speed, memory efficiency, and accuracy improvements obtainable therefrom. Finally, we analyze the results with respect to which parts of the model are more reliant on having multiple heads, and provide precursory evidence that training dynamics play a role in the gains provided by multi-head attention.
Motivation & Objective
- Motivate an empirical study on the necessity of multi-head attention in trained Transformer models.
- Quantify how many attention heads are essential for performance in machine translation and natural language inference.
- Develop a pruning strategy to identify and remove less important heads without retraining.
- Analyze the impact of head pruning on different attention components (Enc-Enc, Enc-Dec, Dec-Dec) and across training dynamics.
Proposed method
- Define a masking mechanism to disable individual attention heads within multi-headed attention.
- Evaluate performance after removing single heads and after reducing entire layers to one head.
- Propose an importance score I_h based on the expected sensitivity of the loss to head masking, estimated via forward/backward passes.
- Perform iterative pruning by ordering heads by I_h (or proxy) and pruning in steps to study cumulative effects.
- Compare pruning effects on two established models: WMT English→French Transformer and BERT base on MNLI.
- Measure performance (BLEU, accuracy) and inference speed gains on GPUs.
Experimental results
Research questions
- RQ1How essential are individual attention heads in trained Transformer-based models for MT and NLI tasks?
- RQ2Can layers be reduced to a single head without harming performance, and which layers resist such reduction?
- RQ3What is the effect of head pruning on encoder-decoder vs. self-attention components in MT models?
- RQ4How does head importance evolve during training, and when are heads determined to be important or redundant?
- RQ5What practical efficiency gains (speed/memory) arise from pruning heads, and under what conditions are these gains most pronounced?
Key findings
- Most attention heads can be removed at test time without significant performance loss.
- Some layers can be reduced to a single head with little to no impact, though encoder-decoder attention often requires more heads.
- Iterative pruning using an importance proxy can prune up to ~20% of heads in WMT and ~40% in BERT without noticeable drop; further pruning causes sharp declines.
- Encoder-decoder attention in MT is more sensitive to pruning than self-attention, indicating differential reliance on multi-headedness.
- Training dynamics show heads become more clearly important early in training, with a pruning-tolerant regime emerging later.
- Pruning yields notable efficiency gains, with up to 17.5% faster inference for BERT at higher batch sizes when 50% of heads are removed; parameters allocated to MHA are nontrivial (roughly one third of total parameters).
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.