Abstract
The Mixture of Experts (MoE) for language models has been proven effective in augmenting the capacity of models by dynamically routing each input token to a specific subset of experts for processing. Despite the success, most existing methods face a challenge for balance between sparsity and the availability of expert knowledge: enhancing performance through increased use of expert knowledge often results in diminishing sparsity during expert selection. To mitigate this contradiction, we propose HyperMoE, a novel MoE framework built upon Hypernetworks. This framework integrates the computational processes of MoE with the concept of knowledge transferring in multi-task learning. Specific modules generated based on the information of unselected experts serve as supplementary information, which allows the knowledge of experts not selected to be used while maintaining selection sparsity. Our comprehensive empirical evaluations across multiple datasets and backbones establish that HyperMoE significantly outperforms existing MoE methods under identical conditions concerning the number of experts.
Introduction
Large Language Models (LLMs) increasingly rely on Mixture of Experts (MoE) architectures to scale parameter counts without a linear increase in computational cost. In a standard sparse MoE, a router directs each input token to a small subset of available experts. However, this design introduces a fundamental trade-off: high sparsity maintains efficiency but ignores the specialized knowledge stored in the unselected experts, while high performance usually requires selecting more experts, which destroys the computational benefits of sparsity.
HyperMoE addresses this "zero-sum game" by introducing a mechanism to transfer relevant knowledge from unselected experts to the selected ones. This allows the model to benefit from the collective knowledge of the entire expert pool while maintaining the inference speed of a sparse model.
Methodology: The HyperExpert Framework
The core innovation of HyperMoE is the HyperExpert module, which is dynamically generated by a shared Hypernetwork.
1. Selection Embedding
For every token, the system identifies which experts were not selected by the router. It aggregates the embeddings of these unselected experts into a single "selection embedding." This embedding captures the specific knowledge gaps left by the router's primary choices.
2. Cross-Layer Hypernetwork
To maintain parameter efficiency, a single hypernetwork is shared across all Transformer layers. This network takes the selection embedding and a unique layer ID as input to generate weights for a lightweight, bottlenecked HyperExpert module.
3. Dynamic Weight Generation and Parallel Computation
The HyperExpert acts as a "knowledge bridge," bringing in relevant information from the unselected pool. It runs in parallel with the standard selected experts, and its output is added to the final result. By using a bottleneck structure similar to Adapters or LoRA, the additional computational overhead is kept to a minimum.
Experimental Evaluation
The researchers conducted an exhaustive evaluation across 20 representative NLP datasets, including GLUE, SuperGLUE, SQuAD v1.1, and summarization tasks like Xsum and CNN/Daily Mail. They also tested the framework on the 16-billion parameter DeepSeek-MoE to ensure the method scales to massive models.
Key Results
- Superior Accuracy: HyperMoE consistently outperformed standard MoE (Switch Transformer) and other baselines, achieving a +0.48% average gain on GLUE and +0.84% on SuperGLUE.
- Scaling Success: On the DeepSeek-MoE 16B backbone, HyperMoE improved scores across the board, notably jumping from 39.38 to 40.77 on the BBH reasoning benchmark.
- Manageable Overhead: Despite the additional hypernetwork machinery, training speed only decreased by approximately 15%, and inference speed decreased by only 10%.
Discussion and Insights
A critical finding of the study is that conditioning the hypernetwork on unselected experts is more effective than using the selected ones. This suggests that the HyperExpert successfully identifies and compensates for the specific knowledge gaps inherent in sparse routing. Furthermore, sharing the hypernetwork across layers facilitates information flow between different depths of the model, leading to more robust representations.
Conclusion and Future Work
HyperMoE effectively breaks the sparsity-knowledge trade-off in MoE models. By leveraging hypernetworks to capture the "dark knowledge" of unselected experts, it achieves state-of-the-art performance with minimal impact on efficiency. Future research will explore incorporating actual expert weights into the embedding process and utilizing even more efficient structures, such as LoRA, to further reduce the parameter footprint of the HyperExpert.
Summary updated