Mixture of Attention Schemes (MoAS): Learning to Route Between MHA, GQA, and MQA

Esmail Gumaan
12/16/2025
cs.AI
transformer-attention

Official code: Esmail-ibraheem/Mixture-of-Attention-Schemes-MoAS (3 stars, Jupyter Notebook, MIT, last commit 2025-12-16).

Abstract

The choice of attention mechanism in Transformer models involves a critical trade-off between modeling quality and inference efficiency. Multi-Head Attention (MHA) offers the best quality but suffers from large Key-Value (KV) cache memory requirements during inference.

Show full abstract

Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) reduce memory usage but often at the cost of model performance. In this work, we propose Mixture of Attention Schemes (MoAS), a novel architecture that dynamically selects the optimal attention scheme (MHA, GQA, or MQA) for each token via a learned router. We demonstrate that dynamic routing performs better than static averaging of schemes and achieves performance competitive with the MHA baseline while offering potential for conditional compute efficiency. Experimental results on WikiText-2 show that dynamic routing (val loss 2.3074) outperforms a static mixture (2.3093), validating the effectiveness of the proposed method. Our code is available at https://github.com/Esmail-ibraheem/Mixture-of-Attention-Schemes-MoAS.

View on arXivView PDF

Code Implementations(1)

MIT

a novel Transformer architecture that combines different KV-sharing schemes (MHA, GQA, MQA) with learned per-token routing.

31Jupyter Notebook, PythonDec 16, 202511 months agoMIT

Similar Papers

Cite this paper

@article{gumaan2025mixture,
  title  = {Mixture of Attention Schemes (MoAS): Learning to Route Between MHA, GQA, and MQA},
  author = {Esmail Gumaan},
  year   = {2025},
  eprint = {2512.20650},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.20650v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2512.20650.svg)](https://codeofpaper.com/paper/2512.20650)

Discussion