TensorX
返回文献探索

Paper · arXiv 2312.07987

SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention

Róbert Csordás, Piotr Piękos, Kazuki Irie, Jürgen Schmidhuber

40 upvotesDecember 13, 2023arXiv 预印本
AI 摘要

SwitchHead reduces memory and compute for Transformers by using Mixture-of-Experts layers, matching performance with significant speedup.

self-attention layersmemorycomputeMixture-of-Expertsvalue projectionsoutput projectionsattention matricesfully-MoESwitchAllTransformer model

Abstract

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.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention | TensorX