Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Pruned
arXiv:1905.09418
Abstract
Multi-head self-attention is a key component of the Transformer, a state-of-the-art architecture for neural machine translation. In this work we evaluate the contribution made by individual attention heads in the encoder to the overall performance of the model and analyze the roles played by them. We find that the most important and confident heads play consistent and often linguistically-interpretable roles. When pruning heads using a method based on stochastic gates and a differentiable relaxation of the L0 penalty, we observe that specialized heads are last to be pruned. Our novel pruning method removes the vast majority of heads without seriously affecting performance. For example, on the English-Russian WMT dataset, pruning 38 out of 48 encoder heads results in a drop of only 0.15 BLEU.
ACL 2019 (camera-ready)
References in corpus (3)
Cited by in corpus (21)
- Reducing Transformer Depth on Demand with Structured Dropout
- Graph Transformer for Graph-to-Sequence Learning
- Medical Image Segmentation Using Squeeze-and-Expansion Transformers
- DeeBERT: Dynamic Early Exiting for Accelerating BERT Inference
- Pre-Trained Models: Past, Present and Future
- Low-Rank Bottleneck in Multi-head Attention Models
- SANST: A Self-Attentive Network for Next Point-of-Interest Recommendation
- KDLSQ-BERT: A Quantized Bert Combining Knowledge Distillation with Learned Step Size Quantization
- Let's measure run time! Extending the IR replicability infrastructure to include performance aspects
- Understanding and Improving Encoder Layer Fusion in Sequence-to-Sequence Learning
- Understanding Multi-Head Attention in Abstractive Summarization
- Do Transformer Attention Heads Provide Transparency in Abstractive Summarization?
- On the Dynamics of Training Attention Models
- On the Importance of Local Information in Transformer Based Models
- Shatter: An Efficient Transformer Encoder with Single-Headed Self-Attention and Relative Sequence Partitioning
- Attend What You Need: Motion-Appearance Synergistic Networks for Video Question Answering
- Super Tickets in Pre-Trained Language Models: From Model Compression to Improving Generalization
- WaLDORf: Wasteless Language-model Distillation On Reading-comprehension
- A Dynamic Head Importance Computation Mechanism for Neural Machine Translation
- Unbiased Sentence Encoder For Large-Scale Multi-lingual Search Engines
- How BPE Affects Memorization in Transformers