Skip to content

Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Experts

optionalextendedfrontierpaperrubric 8/122024 · ~25 min

Lean Wang, Huazuo Gao, Chenggang Zhao, Xu Sun, Damai Dai

Status

TL;DR. Instead of an auxiliary loss, keep a bias bib_i per expert. Add it to the router scores only when choosing the top-K experts. After each batch, lower the bias of overloaded experts and raise it for under-loaded ones by a fixed step. The model gets better balance and better perplexity, because no balancing gradient touches the language-modelling objective.

With gating score si,ts_{i,t} for token tt and expert ii (sigmoid gating in the main experiments):

gi,t={si,t,si,t+bi∈Topk⁡({sj,t+bj}j=1N,K)0,otherwise,bi←bi+u⋅sign⁡(cˉ−ci),g_{i,t} = \begin{cases} s_{i,t}, & s_{i,t} + b_i \in \operatorname{Topk}\big(\{s_{j,t} + b_j\}_{j=1}^{N}, K\big) \\ 0, & \text{otherwise,} \end{cases} \qquad b_i \leftarrow b_i + u \cdot \operatorname{sign}(\bar c - c_i),

Here cic_i is expert ii‘s token count on the previous batch and cˉ\bar c is the mean count. The bias only decides who is chosen. The gate value gi,tg_{i,t} that weights the output is the unbiased score. Balance is measured by MaxVio=(max⁡iLoadi−Load‾)/Load‾\text{MaxVio} = (\max_i \text{Load}_i - \overline{\text{Load}})/\overline{\text{Load}}.

Results. On DeepSeekMoE-style models with sigmoid gating (1B trained on 100B tokens and 3B on 200B tokens), compared against an auxiliary loss with α = 0.001, loss-free balancing lowers validation perplexity from 9.56 to 9.50 (1B) and from 7.97 to 7.92 (3B). It cuts global MaxVio from 0.72 to 0.04 and from 0.52 to 0.04 (Table 2). Batch-level balance also stays better for most of training (Figure 3). The gain in perplexity is small. The main win is near-perfect balance at no quality cost.

  • Replaces the f·P auxiliary loss from Switch Transformers and the expert-level loss in DeepSeekMoE.
  • Used in DeepSeek-V3.
  • Related idea in IR: this is a feedback controller on allocation, much like adaptive load balancing across index shards. It acts on routing decisions and not on the scoring model.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    An MoE layer has 8 experts with sigmoid gating scores in (0, 1), top-2 routing and bias update rate u = 0.001. (a) In one batch the per-expert token counts are 150, 100, 100, 100, 50, 100, 100, 100. Compute MaxVio for this batch and the bias change for each expert. (b) Expert 1 beats expert 5 on raw score by 0.05 for a typical token. If expert 1 stays overloaded and expert 5 stays under-loaded, after how many batches can the bias flip that choice? (c) What does this imply about how fast the method reacts?

    What a strong answer covers
    • (a) The expected load is 800/8 = 100, so MaxVio = (150 − 100)/100 = 0.5. With eᵢ = mean − cᵢ: expert 1 gets e = −50, so its bias falls by 0.001. Expert 5 gets e = +50, so its bias rises by 0.001. Experts at exactly the mean have sign(0) = 0 and do not move.
    • (b) The gap between the biases changes by 0.002 per batch, so closing a 0.05 score gap takes about 25 batches.
    • (c) The sign rule is a fixed-step controller: its speed does not depend on how large the imbalance is. A small u is slow to fix a big imbalance (the paper finds u = 0.0001 too slow). A large u (0.01) makes the bias jitter late in training.
  2. Mechanism

    Explain why adding the bias only to the top-K selection, and not to the gate value that weights the expert output, avoids the trade-off created by an auxiliary loss. Also explain why the bias must be updated from previous batches rather than from the current one.

    What a strong answer covers
    • An auxiliary loss adds a gradient to the router that has nothing to do with language modelling. Large α distorts the routing the task wants, and small α lets load collapse. The paper shows this dilemma by sweeping α over 1e-2, 1e-3, 1e-4 and 0.
    • The bias changes which experts are chosen, but the output is still weighted by the raw score sᵢ,ₜ. So the task gradient on the router stays clean, and the bias receives no gradient at all.
    • Using the current batch's loads to choose experts would make one token's routing depend on other tokens in the same sequence, including future ones. That leaks future information, the problem the paper raises with Expert Choice routing.
    • Updating from history keeps routing causal: each token's experts depend only on its own score and on biases fixed before the batch.
  3. What if…

    The paper compares the sign update with a proportional update, b ← b + u·e, and with a multiplicative bias, and sweeps u. Interpret these results and design one further ablation needed before using the method to fine-tune a pretrained MoE on a small retrieval dataset.

    What a strong answer covers
    • Proportional updates reach slightly better balance (MaxVio about 0.028–0.040) with no better perplexity (9.51–9.53 versus 9.50 for sign). A multiplicative bias is slightly worse (9.52–9.54). The additive sign rule is simple and good enough.
    • u = 0.001 works. 0.0001 converges slowly and 0.01 fluctuates late in training.
    • Fine-tuning on small IR data has small batches and a narrow domain, so per-batch loads are noisy and skewed by topic. The bias may chase noise or force domain tokens onto unsuitable experts.
    • Ablation: compare frozen biases from pretraining, continued bias updates, an auxiliary loss and no balancing at all. Measure nDCG and expert-load histograms on in-domain and out-of-domain queries.

Done with this page?

Status