[论文解读] DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models
DeepSeekMoE 引入细粒度专家分段和共享专家隔离,以实现高度专业化的 MoE 专家,相较传统 MoE 架构提升效率与性能,参数从 2B 到 145B 的示例。
In the era of large language models, Mixture-of-Experts (MoE) is a promising architecture for managing computational costs when scaling up model parameters. However, conventional MoE architectures like GShard, which activate the top-$K$ out of $N$ experts, face challenges in ensuring expert specialization, i.e. each expert acquires non-overlapping and focused knowledge. In response, we propose the DeepSeekMoE architecture towards ultimate expert specialization. It involves two principal strategies: (1) finely segmenting the experts into $mN$ ones and activating $mK$ from them, allowing for a more flexible combination of activated experts; (2) isolating $K_s$ experts as shared ones, aiming at capturing common knowledge and mitigating redundancy in routed experts. Starting from a modest scale with 2B parameters, we demonstrate that DeepSeekMoE 2B achieves comparable performance with GShard 2.9B, which has 1.5 times the expert parameters and computation. In addition, DeepSeekMoE 2B nearly approaches the performance of its dense counterpart with the same number of total parameters, which set the upper bound of MoE models. Subsequently, we scale up DeepSeekMoE to 16B parameters and show that it achieves comparable performance with LLaMA2 7B, with only about 40% of computations. Further, our preliminary efforts to scale up DeepSeekMoE to 145B parameters consistently validate its substantial advantages over the GShard architecture, and show its performance comparable with DeepSeek 67B, using only 28.5% (maybe even 18.2%) of computations.
研究动机与目标
- 激发并解决 MoE 架构中的知识混合与冗余。
- 提出 DeepSeekMoE,在不增加总参数或计算量的情况下提升专家专业化。
- 展示从 2B 到 145B 参数的可扩展性,性能具有竞争力或优越。
- 验证细粒度分段和共享隔离减少冗余、提升效率。
- 通过有监督微调对话场景进行对齐并公开发布的潜力。
提出的方法
- 引入两大核心策略:(i) 通过将 FFN 中间层拆分为 m 个子专家进行细粒度分段,在固定成本下激活 mK 个专家;以及 (ii) 通过指定 Ks 个共享专家始终处于活跃状态以巩固共性知识的共享专家隔离。
- 将 MoE 层表述为细粒度路由与共享专家,同时保持相同的总参数量。
- 引入专家层级和设备层级的负载均衡损失,以减缓路由崩溃并分配计算。
- 在大型多语言语料 (~100B tokens) 上对 2B 参数 MoE 变体进行训练,并与 Hash Layer、Switch Transformer 和 GShard 基线进行比较。
- 将实验扩展到 16B 与 145B,评估相对于密集模型和更大 MoE 基线的性能。
实验结果
研究问题
- RQ1细粒度专家分段是否能增加组合路由的灵活性并提升专家专业化,而不增加总参数或计算量?
- RQ2将少量共享专家隔离是否能减少冗余、提升 MoE 模型的参数利用率?
- RQ3在 2B、16B、以及 145B 规模下,与 GShard 和密集基线在标准 NLP 基准上的表现如何?
- RQ4路由平衡损失对训练稳定性和模型性能有何影响?
- RQ5DeepSeekMoE 是否能够达到 MoE 性能的上界并实现一个具备实际 GPU 要求的可公开发布的 16B 模型?
主要发现
- DeepSeekMoE 2B 在总参数相同、激活参数更少的条件下,较 GShard 2B 有显著优势,并且几乎达到 GShard 2.9B 的性能。
- DeepSeekMoE 2B 靠近同参数密集对手的性能,表明其可达到 MoE 上界性能。
- DeepSeekMoE 16B 使用约40% 的计算量,性能与 DeepSeek 7B 和 LLaMA2 7B 相当,同时优于激活参数数量相近的模型。
- 在 145B 时,DeepSeekMoE 显著优于 GShard,并且仅用 28.5%(也可能是 18.2%)计算量就可媲美 DeepSeek 67B。
- 消融研究证实,细粒度分段和共享隔离均有助于提升性能和专家专业化。
- 分析表明,DeepSeekMoE 在路由专家之间的冗余较低,且共享专家无法被路由专家替代。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。