NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Training Matryoshka Mixture-of-Experts for Elastic Inference-Time Expert Utilization

Yaoxiang Wang, Qingguo Hu, Yucheng Ding, Ruizhe Wang, Yeyun Gong, Jian Jiao, Yelong Shen, Peng Cheng, Jinsong Su

Abstract

Standard Mixture-of-Experts (MoE) models exhibit significant performance degradation when the number of activated experts is altered at inference time. We introduce Matryoshka MoE (M-MoE), a training framework that instills a coarse-to-fine nested hierarchy into the expert ensemble. By employing layer-wise randomization of active experts during training, M-MoE produces a single model capable of elastic inference. Our experiments demonstrate that M-MoE matches the performance of a suite of specialist models across various computational budgets while maintaining structural robustness and expert specialization.

Introduction: The Rigidity of Standard MoE

Mixture-of-Experts (MoE) has become the primary architecture for scaling Large Language Models (LLMs) efficiently. By activating only a subset of experts for any given token, models like Mixtral or DeepSeek achieve high parameter counts with manageable computational overhead.

However, these models suffer from architectural rigidity. They are typically trained with a fixed "Top-K" routing strategy (e.g., always activating exactly 2 or 6 experts). Because experts become co-adapted to specific group sizes during training, reducing the number of active experts at inference time to save costs leads to a catastrophic collapse in performance. This prevents "elastic inference"—the ability to dynamically trade off speed and quality based on real-time hardware constraints or user requirements.

Methodology

M-MoE is inspired by Matryoshka Representation Learning, forcing the model to learn a hierarchy where the first expert provides essential capabilities and subsequent experts add progressively finer detail. The framework relies on three key techniques:

  • Layer-wise Matryoshka: Instead of a global $k$ value, each Transformer layer independently samples a different number of experts during training. This stochasticity forces every layer to be robust to varying input widths from preceding layers.
  • Capacity-Aware Weighted Sampling: To ensure high-capacity configurations (more experts) are sufficiently trained, the authors utilize a power-law distribution to sample higher $k$ values more frequently.
  • Activation Budgeting: To maintain stable training throughput despite random $k$ values, a budget mechanism caps the total number of active experts across all layers.

Key Insights: The Nested Hierarchy

A critical finding of this work is that M-MoE successfully induces a stable ranking of experts. In standard MoE models, the experts selected for $k=1$ may be entirely different from those selected when $k=6$. In contrast, M-MoE routers exhibit a "nested" property: if an expert is deemed most important at $k=1$, it remains the top choice as $k$ increases.

Spearman correlation heatmaps demonstrating the stable hierarchy in M-MoE compared to the chaotic routing of standard Top-k.

Furthermore, the researchers identified that early layers are more critical for performance; allocating more experts to the beginning of the network provides a larger boost than adding them to later layers. Interestingly, M-MoE experts are more specialized (orthogonal) than those in standard MoEs, as they are forced to function effectively in teams of varying sizes.

Experimental Results

Evaluation across benchmarks like MMLU, ARC-C, and HellaSwag confirms that a single M-MoE model can replace an entire suite of specialist models.

Elasticity and Performance

As shown in the results table, M-MoE avoids the performance collapse seen in standard models. For instance, when a standard Top-6 model is restricted to 1 expert at inference, its MMLU score drops from 54.32 to 35.52. The M-MoE-layer variant, however, maintains a score of 51.69 at $k=1$, nearly matching the performance of a specialist model trained specifically for $k=1$ (52.01).

Performance comparison of specialist baselines vs. elastic M-MoE models across various inference-time expert counts (k).

Efficiency

M-MoE achieves this flexibility at a fraction of the cost of training multiple specialists. The "Activation Budget" trick not only enables elasticity but also improved training throughput by 8% while reducing memory usage compared to standard fixed-K training.

Conclusion and Future Work

M-MoE solves the elasticity problem for MoE architectures, allowing for more practical and adaptable deployments. While this work explored fixed layer-wise patterns for expert allocation, future research may enable "dynamic expert allocation," where the model autonomously decides the optimal number of experts per token based on input complexity. This would further optimize the trade-off between computational cost and model intelligence.

Summary updated

BibTeX
@misc{wang2025training,
  author = {Yaoxiang Wang and Qingguo Hu and Yucheng Ding and Ruizhe Wang and Yeyun Gong and Jian Jiao and Yelong Shen and Peng Cheng and Jinsong Su},
  title = {{Training Matryoshka Mixture-of-Experts for Elastic Inference-Time Expert Utilization}},
  year = {2025},
  eprint = {2509.26520},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.26520},
}
Figure