DSelect-k: Differentiable Selection in the Mixture of Experts with Applications to Multi-Task Learning

Hussein Hazimeh, Zhe Zhao, Aakanksha Chowdhery, Maheswaran Sathiamoorthy, Yihua Chen, Rahul Mazumder, Lichan Hong, Ed H. Chi

Introduction

Mixture-of-Experts (MoE) models scale neural network capacity by using a gating mechanism to route inputs to specialized "expert" sub-networks. While sparse gating—selecting only $k$ out of $n$ experts—is computationally efficient, traditional methods like the Top-k gate suffer from training instabilities. Because Top-k is a non-smooth step function, small parameter updates can cause sudden, oscillatory shifts in expert assignments. This paper introduces DSelect-k, a continuously differentiable sparse gate that enables stable, end-to-end training for MoE models.

Architecture and Multi-Task Learning

In an MoE architecture, a gate processes the input to produce weights for a set of experts. The final output is the weighted sum of these experts' outputs. This structure is particularly useful in Multi-Task Learning (MTL), where different tasks can share a pool of experts but use distinct gating networks to specialize their behavior.

MoE architectures for single-task (left) and multi-task (right) learning.

The DSelect-k Mechanism

DSelect-k transforms the discrete expert selection problem into a smooth, unconstrained optimization task through several key innovations:

  1. Binary Encoding: Expert indices are represented using $m = \log_2 n$ variables, making the gate parameters scale logarithmically rather than linearly with the number of experts.
  2. Smooth-step Relaxation: The authors replace discrete selection with a smooth-step function (a cubic piecewise polynomial). Unlike standard logistic functions, the smooth-step can reach exactly 0 or 1, allowing for true sparsity while remaining differentiable.
  3. Entropy Regularization: To ensure the model eventually settles on specific experts, an entropy penalty pushes the smooth variables toward binary values as training progresses.

Training Stability and Performance

The primary advantage of DSelect-k is its stability during the training process. By providing a smooth gradient, it avoids the "jumps" and oscillations characteristic of Top-k gating.

Comparison of expert weight trajectories during training for Top-k (left) and DSelect-k (right).

As illustrated in the comparison above, Top-k weights (left) fluctuate significantly, which can hinder convergence. In contrast, DSelect-k weights (right) transition smoothly and stabilize, allowing experts to specialize effectively.

Key Results

The authors demonstrated the effectiveness of DSelect-k across diverse datasets:

  • Real-world Recommender System: On a large-scale Google recommendation system involving billions of examples, DSelect-k achieved a 22% improvement in predictive performance over the Top-k gate.
  • Multi-Task Benchmarks: On Multi-MNIST, DSelect-k outperformed Top-k while using fewer experts on average (1.7 vs. 4), proving that accuracy does not need to be sacrificed for sparsity.
  • Synthetic Tasks: In tests with 128 regression tasks, DSelect-k improved Mean Squared Error (MSE) by over 40% and was significantly better at identifying the correct experts for related tasks.

Conclusion and Future Work

DSelect-k offers a robust solution to the instability of sparse MoE training. By making expert selection differentiable, it enables more reliable scaling of large models. While DSelect-k starts "dense" and only achieves computational savings as it converges to a sparse state, its superior predictive power and stability make it a powerful tool for complex multi-task and recommendation architectures. Future research may explore more complex functional forms for gate parameters to further enhance performance.

Summary updated

BibTeX
@inproceedings{hazimeh2021dselect,
  author = {Hussein Hazimeh and Zhe Zhao and Aakanksha Chowdhery and Maheswaran Sathiamoorthy and Yihua Chen and Rahul Mazumder and Lichan Hong and Ed H. Chi},
  title = {{DSelect-k: Differentiable Selection in the Mixture of Experts with Applications to Multi-Task Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=tKlYQJLYN8v},
}
Figure