Abstract
Transformers are inherently position-agnostic, requiring explicit position embeddings to process sequences effectively. While absolute position embeddings were popularized by models like BERT, modern pre-training techniques often render them less effective. This paper introduces M4M, a novel multiplicative relative position embedding method. By scaling content attention with positional factors rather than adding biases, M4M achieves superior performance on SQuAD and GLUE benchmarks with minimal parameter overhead.
Introduction
Standard Transformer architectures treat input sequences as unordered sets unless augmented with positional information. Early solutions relied on absolute position embeddings, which assign a unique vector to each index. However, in modern "full-sentence" packing regimes (e.g., RoBERTa), absolute indices become arbitrary noise. Relative position embeddings, which focus on the distance between tokens, have emerged as a more robust alternative. Despite their popularity, the field lacked a systematic comparison of these methods and an optimal integration strategy.
The M4M Approach
The researchers at AWS AI proposed M4M (Multiplicative M4). Unlike previous additive methods that add a positional bias to attention logits, M4M multiplies the content-based attention score by a positional factor. This multiplicative interaction acts as a gating mechanism, allowing the model to more precisely amplify or suppress attention based on token distance.
As shown in the relative position matrix above, the model learns weights based on the relative offset between queries and keys. M4M leverages this structure to scale the attention mechanism, proving more effective than simple additive biases like those used in Shaw's or Raffel's (T5) methods.
Parameter Efficiency and Complexity
A key advantage of M4M is its efficiency. It introduces negligible overhead compared to the base model size while maintaining competitive computational complexity.
As detailed in the table above, M4M adds approximately 785K parameters to a standard 110M-parameter RoBERTa-base model—a mere 0.7% increase. Despite this small footprint, it matches or exceeds the performance of much more complex "untied" methods like TUPE or DeBERTa.
Key Results
- SQuAD Performance: M4M achieved an F1 score of 89.45 on SQuAD 1.1, significantly outperforming the Absolute baseline (87.08) and Shaw’s relative method (88.62).
- GLUE Benchmarks: The method consistently improved accuracy across tasks like SST-2 (reaching 91.62%) and MNLI.
- Scalability: When applied to RoBERTa-Large, M4M improved the SQuAD 2.0 F1 score from 87.62 to 88.34, demonstrating its effectiveness at scale.
Conclusion
The transition from additive to multiplicative positional interactions represents a significant step forward for Transformer efficiency and accuracy. M4M serves as a robust drop-in replacement for standard embeddings, particularly in training scenarios where relative distance is more informative than absolute sequence position. Future work may further explore the theoretical underpinnings of why multiplicative gating outperforms traditional additive biases in self-attention mechanisms.
Summary updated