Introduction
Multi-head attention (MHA) has become the standard mechanism for capturing complex dependencies in modern NLP architectures, such as Transformers and BERT. The theoretical appeal of MHA lies in its ability to attend to diverse features—syntax, semantics, and long-range context—simultaneously across different heads. However, empirical studies often reveal a phenomenon known as attention collapse, where multiple heads learn redundant or nearly identical features. This redundancy suggests that the computational cost of maintaining 8 or 16 heads does not yield a proportional increase in representational power.
Methodology: Attention as Bayesian Inference
This paper introduces Repulsive Multi-head Attention (RMA), a novel framework that re-imagines MHA through the lens of Bayesian inference. Rather than viewing attention heads as independent deterministic functions, the authors treat the parameters of each head as "particles" intended to approximate the posterior distribution of an attention model.
The Repulsive Force
To combat attention collapse, the authors move away from standard Stochastic Gradient Descent (SGD). Instead, they employ particle-optimization techniques such as Stein Variational Gradient Descent (SVGD) and Stochastic Particle Optimization Sampling (SPOS). These algorithms introduce a mathematical "repulsive force" during the update rule. While standard gradients push heads toward high-accuracy regions (modes), the repulsive term pushes heads away from one another in the parameter space. Crucially, this method requires no additional trainable parameters and maintains the standard architecture at inference time.
Experimental Evaluation
The effectiveness of RMA was evaluated across a broad spectrum of NLP tasks:
- Sentence Classification: Sentiment analysis (Yelp), author profiling (Age), and textual entailment (SNLI).
- Machine Translation: IWSLT14 (German-to-English) and WMT14 (English-to-German).
- Language Representation: The GLUE benchmark, utilizing ELECTRA as the backbone model.
- Graph-to-Text: Generating scientific abstracts from knowledge graphs (AGENDA).
Results and Discussion
Visualizing Head Diversity
Qualitative analysis of attention maps demonstrates the impact of the repulsive force. In standard MHA, individual heads often collapse, focusing on the same keywords. In contrast, RMA heads distribute their attention across a wider array of relevant terms. For example, in a Yelp review analysis, while standard heads might all focus on the word "amazing," RMA heads successfully attend to distinct aspects like "service" and "downfall," capturing a more nuanced representation of the text.
Pruning Resilience and Essentiality
A significant finding of this research is the increased "essentiality" of RMA heads. In standard Transformers, many heads can be pruned or masked at test time with negligible performance loss, confirming their redundancy. However, RMA models exhibit a much sharper performance drop when heads are removed. This indicates that the repulsive force successfully forces each head to perform unique, non-redundant work.
Performance and Calibration
RMA consistently outperformed standard MHA and traditional regularization techniques. On the IWSLT14 translation task, RMA achieved a 35.2 BLEU score, compared to 34.4 for the baseline. Beyond raw accuracy, RMA models are better calibrated; their confidence scores more accurately reflect their true predictive probability, a direct benefit of the underlying Bayesian framework.
Conclusion
By rethinking multi-head attention as a Bayesian particle optimization problem, Repulsive Attention provides a theoretically grounded solution to the problem of attention collapse. The approach maximizes the utility of each head, leading to more expressive models and consistent performance gains across diverse NLP tasks without increasing the model's parameter footprint.
Summary updated