Abstract
Scaling Transformer models typically involves a significant increase in computational requirements. While Mixture-of-Experts (MoE) has successfully sparsified Feed-Forward Networks (FFN), the attention mechanism has remained largely dense. This paper introduces Mixture of Attention Heads (MoA), an architecture that dynamically selects a subset of attention heads for each token. By sharing Key and Value projections across experts and using a Top-K router for Query and Output projections, MoA increases model capacity while reducing computational overhead. Experimental results on machine translation and language modeling demonstrate that MoA achieves competitive performance with significantly fewer multiply-accumulate operations (MACs) than standard Transformers.
Introduction
The success of large-scale Transformer models is often limited by the computational cost of dense layers. Mixture-of-Experts (MoE) architectures address this by activating only a fraction of parameters per input, but this approach has primarily been applied to FFN layers. The Multi-Head Attention (MHA) mechanism remains a bottleneck, as every token typically attends through every head. However, attention heads often exhibit specialization, suggesting that not all heads are necessary for every token. MoA proposes a sparse attention mechanism where a router selects the most relevant "attention experts" for each token, effectively decoupling model capacity from per-token computation.
Methods: The MoA Architecture
The MoA layer replaces standard MHA with a set of $N$ attention experts. For each input token, a Top-K Router generates a distribution over these experts and selects the top $k$ to process the token.
To maintain memory efficiency, MoA employs a shared Key ($W^k$) and Value ($W^v$) projection strategy. While standard MoE might replicate all parameters, MoA recognizes that the expensive part of attention is often the KV cache. By sharing these projections, the model pre-computes keys and values once. Specialization is achieved through unique Query ($W^q$) and Output ($W^o$) projections for each expert. The final output is a weighted sum of the $k$ selected experts' outputs.
Experimental Evaluation
The authors evaluated MoA on WMT 2014 English-German (EnDe) and English-French (EnFr) translation tasks, as well as language modeling on WikiText-103.
Machine Translation Results
In the WMT14 benchmarks, MoA models demonstrated superior efficiency. The "MoA Big" configuration achieved a BLEU score of 29.4 on EnDe, slightly surpassing the Transformer Big baseline (29.3 BLEU) while requiring only 1220M MACs—a reduction of approximately 40% compared to the baseline's 2090M MACs.
Language Modeling Efficiency
On WikiText-103, MoA showed that increasing the number of experts ($E$) consistently improves perplexity (PPL) without a proportional increase in computational cost. For instance, scaling from 8 to 64 experts improved PPL from 4.82 to 4.21, while MACs remained nearly constant.
Discussion and Conclusion
MoA successfully brings the benefits of sparsity to the attention mechanism. Interpretability analysis suggests that experts learn to specialize in specific linguistic features, such as technical terms, locations, or parts of speech. While the theoretical computational gains are significant, practical speedups on current hardware are currently limited by memory-copy overheads, highlighting a need for optimized CUDA kernels. Future work will explore scaling MoA to thousands of experts, similar to recent trends in FFN-based MoE.
Summary updated