SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention

Robert Csordas, Piotr Piękos, Kazuki Irie, Jürgen Schmidhuber

SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention: 40 upvotes on Hugging Face Daily Papers, #1 of 9 papers on 2023-12-14. Day-by-day upvote history.

The costly self-attention layers in modern Transformers require memory and compute quadratic in sequence length. Existing approximation methods usually underperform and fail to obtain significant speedups in practice. Here we present SwitchHead - a novel method that reduces both compute and memory requirements and achieves wall-clock speedup, while matching the language modeling performance of baseline Transformers with the same parameter budget. SwitchHead uses Mixture-of-Experts (MoE) layers for the value and output projections and requires 4 to 8 times fewer attention matrices than standard Transformers. Our novel attention can also be combined with MoE MLP layers, resulting in an efficient fully-MoE "SwitchAll" Transformer model. Our code is public.

Paper page on Hugging Face · arXiv

Data: hysts-bot-data/daily-papers-stats and the Daily Papers API. Open data: tardellirs/paper-pulse-data. Sister project: Model Pulse, the download history of every model on the Hub.