Skip to main content
QUICK REVIEW

[论文解读] Mixture-of-Experts with Expert Choice Routing

Yanqi Zhou, Tao Lei|arXiv (Cornell University)|Feb 18, 2022
Stochastic Gradient Optimization TechniquesComputer Science被引用 58
一句话总结

引入稀疏激活的 Mixture-of-Experts (MoE) 模型中的专家选择路由,每个专家选择前-k 个令牌,达到完美负载均衡并实现每个令牌可变计算,从而在较现有门控方法上实现训练速度提升超过 2 倍并改进微调性能。

ABSTRACT

Sparsely-activated Mixture-of-experts (MoE) models allow the number of parameters to greatly increase while keeping the amount of computation for a given token or a given sample unchanged. However, a poor expert routing strategy (e.g. one resulting in load imbalance) can cause certain experts to be under-trained, leading to an expert being under or over-specialized. Prior work allocates a fixed number of experts to each token using a top-k function regardless of the relative importance of different tokens. To address this, we propose a heterogeneous mixture-of-experts employing an expert choice method. Instead of letting tokens select the top-k experts, we have experts selecting the top-k tokens. As a result, each token can be routed to a variable number of experts and each expert can have a fixed bucket size. We systematically study pre-training speedups using the same computational resources of the Switch Transformer top-1 and GShard top-2 gating of prior work and find that our method improves training convergence time by more than 2x. For the same computational cost, our method demonstrates higher performance in fine-tuning 11 selected tasks in the GLUE and SuperGLUE benchmarks. For a smaller activation cost, our method outperforms the T5 dense model in 7 out of the 11 tasks.

研究动机与目标

  • 解决传统 token-选择 MoE 路由中的负载不平衡与未充分利用的问题。
  • 提出异质 MoE,使专家选择令牌(专家选择)以平衡负载并分配计算。
  • 展示跨尺度的训练效率提升与强劲的下游表现。
  • 探索可选约束以限制每个令牌的专家数量并评估对性能的影响。

提出的方法

  • 提出专家选择路由,让每个专家选择前-k 个令牌,确保固定的桶大小并实现负载平衡。
  • 定义令牌到专家的亲和度分数 S = Softmax(X W_g);为每个专家选择前-k 个令牌来形成 I(索引)、G(门控权重)和 P(一热路由)。
  • 通过 P 计算专家输入 X_in,并对每个专家应用 GeLU-然后线性变换,使用 W_1[i], W_2[i]。
  • 使用 P 和 G 的加权和将输出聚合到 X_out,使每个令牌激活的专家数量可变。
  • 可选地通过基于熵的线性规划对路由进行正则化,以限制每个令牌的专家计数,使用 Dykstra 算法求解。
  • 在 Transformer 架构中采用互插的 MoE 和密集层,MoE 流内使用层相关位置偏置和 GELU 激活。

实验结果

研究问题

  • RQ1专家选择路由与 Switch Transformer 和 GShard 的 top-1/top-2 门控相比,是否能提高训练效率?
  • RQ2在扩大规模时,专家数量的变化如何影响训练困惑度与下游微调表现?
  • RQ3允许每个令牌具有可变数量的专家对 GLUE/SuperGLUE 任务表现有何影响?
  • RQ4容量因子(每个令牌计算量)如何影响收敛性与相对于固定令牌-k 门控的准确性?
  • RQ5对每个令牌的专家数量进行正则化对准确性与负载平衡有何影响?

主要发现

  • 专家选择在容量因子为 2 的情况下(EC-CF2)在可比计算下比 GShard top-2 门控实现了超过 2 倍的训练收敛速度。
  • 在保持专家规模固定的前提下,增加专家数量可在各尺度上提升训练 perplexity。
  • EC-CF2 在微调阶段在 11 个 GLUE/SuperGLUE 任务上持续优于 Switch Transformer top-1 与 GShard top-2,8B/64E 设置平均提升超过 2 个百分点的准确性。
  • 在 8B/64E 下,稠密基线被 EC-CF2 超越,在部分任务上平均准确性提升约 3.4 点。
  • 允许每个令牌具有可变数量的专家提升性能;限制为每个令牌 2 或 3 位专家相比无约束的专家选择略微降低性能。
  • 哈希层路由在平均准确性和方差上不及专家选择,表明仅靠负载均衡不足以获得最佳结果。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。