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 while maintaining manageable computational costs. In a standard MoE setup, a router dynamically directs each input token to a small subset of specialized sub-networks, or "experts." However, this approach introduces a fundamental trade-off: high sparsity (selecting few experts) preserves efficiency but restricts the specialized knowledge applied to each token, while high performance (selecting more experts) increases computational overhead, negating the benefits of the MoE design.
HyperMoE addresses this "zero-sum game" by identifying that the knowledge within unselected experts is typically wasted. By "transferring" this latent knowledge to the selected experts via a lightweight auxiliary module, HyperMoE breaks the traditional trade-off between computational sparsity and knowledge availability.
Methods: The HyperExpert Framework
The core innovation of HyperMoE is the HyperExpert, a lightweight module generated on-the-fly by a shared Hypernetwork.
The process involves several key components:
- Selection Embedding: For each token, the router identifies unselected experts. Their embeddings are aggregated into a "selection embedding" that summarizes the "missing" knowledge.
- Hypernetwork ($H_e$): A shared network across all Transformer layers that takes the selection embedding and a layer-specific embedding as input. It outputs the weights for the HyperExpert.
- Conditional Generation: The generated weights form a temporary neural network—the HyperExpert—which runs in parallel with the standard selected expert.
- Cross-Layer Sharing: Sharing the hypernetwork across layers ensures sub-linear parameter growth, preventing a memory explosion as the model depth increases.
This design allows the HyperExpert to act as a "consultant," providing the selected expert with context derived from the entire expert pool without the cost of executing every expert module.
Experimental Evaluation and Results
HyperMoE was evaluated across 20 representative NLP datasets, including NLU benchmarks (GLUE, SuperGLUE), question answering (SQuAD), summarization (Xsum, CNNDM), and large-scale evaluations (MMLU, GSM8K).
Performance and Scaling
HyperMoE consistently outperformed standard MoE (Switch Transformer) and "MoE-Share" baselines. On GLUE and SuperGLUE, it achieved average increases of +0.48% and +0.84%, respectively. Notably, the performance advantage of HyperMoE becomes more pronounced as the number of experts increases, demonstrating superior scaling properties.
Key Insights
- Knowledge Transfer: Empirical evidence suggests that information from unselected experts is more beneficial for generating the HyperExpert than information from selected ones, confirming that the framework successfully fills "knowledge gaps."
- Large-Scale Application: When integrated into the DeepSeek-MoE 16B model, HyperMoE improved MMLU scores from 46.52 to 47.06 and GSM8K scores from 17.97 to 18.75.
- Efficiency: These gains come with a modest computational cost, with training and inference speeds decreasing by approximately 15% and 10%, respectively.
Conclusion
HyperMoE effectively mitigates the conflict between sparsity and knowledge availability in MoE models. By leveraging hypernetworks to transfer knowledge from unselected experts, it achieves state-of-the-art performance across various tasks and scales. Future work will focus on further optimizing computational overhead using techniques like LoRA and exploring the training of large-scale HyperMoE models from scratch.
Summary updated