[论文解读] Harder Tasks Need More Experts: Dynamic Routing in MoE Models
本文提出了一种用于Mixture-of-Experts(MoE)模型的动态路由机制,根据路由置信度为更难的输入激活更多专家,从而提升效率与性能。与固定Top-K路由不同,该方法自适应地选择专家,直至累积概率超过阈值,实现了在参数激活率低于90%的情况下,平均准确率较Top-2路由提升0.7%。
In this paper, we introduce a novel dynamic expert selection framework for Mixture of Experts (MoE) models, aiming to enhance computational efficiency and model performance by adjusting the number of activated experts based on input difficulty. Unlike traditional MoE approaches that rely on fixed Top-K routing, which activates a predetermined number of experts regardless of the input's complexity, our method dynamically selects experts based on the confidence level in expert selection for each input. This allows for a more efficient utilization of computational resources, activating more experts for complex tasks requiring advanced reasoning and fewer for simpler tasks. Through extensive evaluations, our dynamic routing method demonstrates substantial improvements over conventional Top-2 routing across various benchmarks, achieving an average improvement of 0.7% with less than 90% activated parameters. Further analysis shows our model dispatches more experts to tasks requiring complex reasoning skills, like BBH, confirming its ability to dynamically allocate computational resources in alignment with the input's complexity. Our findings also highlight a variation in the number of experts needed across different layers of the transformer model, offering insights into the potential for designing heterogeneous MoE frameworks. The code and models are available at https://github.com/ZhenweiAn/Dynamic_MoE.
研究动机与目标
- 为解决固定Top-K路由在MoE模型中的低效问题,该方法避免对所有输入一视同仁,无论其复杂度如何。
- 通过动态分配更多专家仅在需要时处理复杂输入,提升计算效率。
- 通过将专家容量与输入难度相匹配,提升模型在推理密集型任务上的性能。
- 探究Transformer架构中各层对专家需求的差异。
- 通过动态、输入感知的专家路由,实现异构MoE框架的设计。
提出的方法
- 该方法为每个输入标记计算专家上的概率分布,并利用置信度阈值确定激活多少专家。
- 若最高专家概率超过阈值$p$,则仅选择该专家;否则,累计添加更多专家,直至总概率超过$p$。
- 该动态选择机制确保模糊或复杂输入激活更多专家,而简单输入则激活更少专家,基于路由置信度。
- 该方法应用于所有Transformer层,专家数量从底层到顶层逐步减少。
- 路由机制被集成到MoE Transformer架构中,并使用标准目标端到端训练。
- 该方法在多个基准测试上进行评估,包括BBH和Hellaswag,以评估性能与专家分配模式。
实验结果
研究问题
- RQ1基于输入难度的动态专家选择是否相比固定Top-K路由能提升模型性能?
- RQ2动态路由能否在简单输入上减少计算浪费,同时增强对复杂输入的推理能力?
- RQ3Transformer编码器中不同层对所需专家数量有何差异?
- RQ4动态路由能否在不增加总激活参数数量的前提下实现更好的参数效率?
- RQ5专家激活数量与输入标记的语义模糊性之间是否存在相关性?
主要发现
- 该动态路由方法在多个基准测试上平均性能相比Top-2路由提升0.7%,尽管激活的参数少于90%。
- 模型在BBH等复杂推理任务上激活了更多专家,证实了其与输入难度一致的动态分配机制。
- 在Hellaswag等简单任务上,激活的专家更少,从而在不损失性能的前提下降低了计算开销。
- 标记级别的分析显示,语义模糊的标记会触发更高的专家数量,表明对输入复杂度具有敏感性。
- 激活的专家数量从底层到顶层逐步减少,第一层每个标记最多激活4个专家,顶层仅激活1个。
- 观察到的各层专家需求差异表明,未来可设计具有每层不同专家数量的异构MoE架构。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。