KatInterview

Differentiable Routing Strategies for Mixture-of-Experts Models

Machine LearningModel answer
HardModel answerMachine Learningmixture of expertsgumbel softmaxreinforce

Last updated

Explore techniques to make hard MoE routing differentiable, comparing straight-through estimation, Gumbel-Softmax, REINFORCE, and gate-scaling alongside auxiliary anti-collapse mechanisms.

In a conventional Mixture-of-Experts (MoE) network, a routing head assigns input tokens to specific experts using discrete decisions (e.g., selecting the expert index corresponding to the argmax or top_k of computed router logits). Because the argmax operation has a derivative of zero almost everywhere and is undefined at step discontinuities, backpropagation cannot natively update the router's weights.

Explain how to make a hard MoE router learnable via backpropagation. In your answer:

  1. Identify why naive hard selection blocks gradient flow and explain the two main paradigms for resolving this issue.
  2. Compare at least two distinct relaxation or gradient estimation strategies (such as the Straight-Through Estimator, Gumbel-Softmax with temperature decay, continuous relaxations, or REINFORCE). Contrast them across gradient variance/bias, forward pass fidelity, computational requirements, and overall training stability.
  3. Detail the standard production approach (gate-scaled top-$k$ routing) and explain how it propagates gradients despite discrete selection.
  4. Describe essential auxiliary loss terms, regularizers, and operational controls required to prevent expert collapse and numerical instability during training.