arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.07987cs.LGcs.CLcs.NE
收藏

SwitchHead:利用专家混合注意力加速Transformer

SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention

Stanford University(斯坦福大学);KAUST(阿卜杜拉国王科技大学);Harvard University(哈佛大学);The Swiss AI Lab IDSIA, USI & SUPSI(瑞士IDSIA人工智能实验室(隶属于瑞士意大利语区大学和瑞士应用科学与艺术大学南部))

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

AI总结:

本文提出SwitchHead,一种用于注意力层的专家混合方法,最多减少8倍注意力矩阵计算,可与MoE前馈层结合构建全MoE Transformer,在匹配基线性能的同时大幅降低计算和内存开销。

摘要:

尽管近期有许多关于专家混合(MoEs)用于资源高效Transformer语言模型的研究,但现有方法大多集中于前馈层的MoE。此前将MoE扩展到自注意力层的尝试未能达到参数匹配基线的性能。我们提出的新型SwitchHead是一种用于注意力层的有效MoE方法,成功降低了计算和内存需求,实现了实际时钟加速,同时匹配了基线Transformer的语言建模性能。我们的新型MoE机制使SwitchHead计算注意力矩阵的数量最多比标准Transformer少8倍。SwitchHead还可以与MoE前馈层结合,形成全MoE的“SwitchAll”Transformer。对于我们在C4上训练的262M参数模型,SwitchHead仅用44%的计算量和27%的内存使用量即可匹配标准模型的困惑度。下游任务的零样本实验证实了SwitchHead的性能,例如在BliMP上相比计算资源相同的基线实现了超过3.5%的绝对改进。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑