Google:Switch Transformers- Scaling to Trillion Parameter Models with Simple and Efficient Sparsity
论文标题:Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity
作者:William Fedus, Barret Zoph, Noam Shazeer(Google)
提交:2021-01-11
正式发表:JMLR(Journal of Machine Learning Research),2022,Volume 23,Paper 120
论文下载地址:
链接:https://pan.quark.cn/s/f229115f0369
提取码:8mDs
原文摘要
In deep learning, models typically reuse the same parameters for all inputs. Mixture of Experts (MoE) models defy this and instead select different parameters for each incoming example. The result is a sparsely-activated model—with an outrageous number of parameters—but a constant computational cost. However, despite several notable successes of MoE, widespread adoption has been hindered by complexity, communication costs, and training instability. We address these with the introduction of the Switch Transformer. We simplify the MoE routing algorithm and design intuitive improved models with reduced communication and computational costs. Our proposed training techniques mitigate the instabilities, and we show large sparse models may be trained, for the first time, with lower precision (bfloat16) formats. We design models based off T5-Base and T5-Large (Raffel et al., 2019) to obtain up to 7x increases in pre-training speed with the same computational resources. These improvements extend into multilingual settings where we measure gains over the mT5-Base version across all 101 languages. Finally, we advance the current scale of language models by pre-training up to trillion parameter models on the “Colossal Clean Crawled Corpus”, and achieve a 4x speedup over the T5-XXL model.arXiv
摘要中文翻译
在深度学习中,传统模型对所有输入复用同一套参数。
混合专家(MoE)模型则不一样:它为每个输入样本选择不同的参数,得到稀疏激活模型—— 参数量可以极大,但每次计算开销保持恒定。
尽管 MoE 已有不少成功案例,但复杂的路由逻辑、高额通信开销、训练不稳定阻碍了它普及。为此本文提出 Switch Transformer:简化 MoE 路由算法,降低通信与计算开销;配套训练方案缓解训练不稳定问题,首次证明超大稀疏模型可以直接用 bfloat16 低精度训练。
基于 T5-Base / T5-Large 改造后,同等算力下预训练速度最高提升 7 倍;在多语言任务上,覆盖全部 101 种语言,相比 mT5-Base 都有收益。
最终在 C4 语料上训练到万亿参数规模,相比 T5-XXL 提速 4 倍。
一句话主旨:Switch Transformer = Top-1 路由的 MoE Transformer,用极简稀疏路由,以固定激活算力撑起万亿大模型,是后续 GLaM、PaLM-E、Mixtral 等 MoE 模型的奠基之作。
核心贡献
1、Top-1 路由(Switch 核心) 传统 MoE 一般选 Top-2 专家;Switch 每个 token 只路由给1 个专家,路由逻辑最简单、通信最少,是它速度优势的来源。配套负载均衡损失,防止专家被极少 token 选中、出现负载坍塌。
2、稳定稀疏训练工程方案
bfloat16 低精度训练大 MoE(之前很难稳定跑)
初始化策略、选择性 dropout、专家随机路由等 trick 抑制震荡
3、算力 - 参数量解耦
稠密模型:参数量变大 → FLOPS 同步暴涨; Switch MoE:可以堆海量专家(总参数量拉到万亿),但每个 token 只走少量专家,单 token 计算量不变。
4、验证:万亿参数模型
在 C4 上训练万亿版本,对比稠密 T5-XXL,相同算力下预训练速度提升 4 倍;多语言 mT5 基线也获得一致增益。
Google:Switch Transformers- Scaling to Trillion Parameter Models with Simple and Efficient Sparsity
https://www.devpilot.cloud/archives/switch-transformers-scaling-to-trillion-parameter-models-with-simple-and-efficient-sparsity
评论