SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention

Róbert Csordás, Piotr Piekos, Kazuki Irie, Jürgen Schmidhuber
2/12/2026

No official code found. Best implementation: RobertCsordas/moe_attention (101 stars, MIT, last commit 2024-09-30). 1 more below.

Abstract

Despite many recent works on Mixture of Experts (MoEs) for resource-efficient Transformer language models, existing methods mostly focus on MoEs for feedforward layers. Previous attempts at extending MoE to the self-attention layer fail to match the performance of the parameter-matched baseline. Our novel SwitchHead is an effective MoE method for the attention layer that successfully reduces both the compute and memory requirements, achieving wall-clock speedup, while matching the language modeling performance of the baseline Transformer. Our novel MoE mechanism allows SwitchHead to compute up to 8 times fewer attention matrices than the standard Transformer. SwitchHead can also be combined with MoE feedforward layers, resulting in fully-MoE"SwitchAll"Transformers. For our 262M parameter model trained on C4, SwitchHead matches the perplexity of standard models with only 44% compute and 27% memory usage. Zero-shot experiments on downstream tasks confirm the performance of SwitchHead, e.g., achieving more than 3.5% absolute improvements on BliMP compared to the baseline with an equal compute resource.

View on arXivView PDF

Code Implementations(2)

MIT

Official repository for the paper "SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention"

1017PythonDec 13, 20232 years agoMIT
MIT
161PythonSep 27, 20241 years agoMIT

Similar Papers

Cite this paper

@article{csords2026switchhead,
  title  = {SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention},
  author = {Róbert Csordás and Piotr Piekos and Kazuki Irie and Jürgen Schmidhuber},
  year   = {2026},
  eprint = {2312.07987},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2312.07987},
  journal = {NEURIPS 2023 2023}
}

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/2312.07987.svg)](https://codeofpaper.com/paper/2312.07987)

Discussion