Abstract
Mixture-of-Expert (MoE) models have obtained state-of-the-art performance in Neural Machine Translation (NMT) tasks. Existing works in MoE mostly consider a homogeneous design where the same number of experts of the same size are placed uniformly throughout the network. Furthermore, existing MoE works do not consider computational constraints (e.g., FLOPs, latency) to guide their design. To this end, we develop AutoMoE -- a framework for designing heterogeneous MoE's under computational constraints. AutoMoE leverages Neural Architecture Search (NAS) to obtain efficient sparse MoE sub-transformers with 4x inference speedup (CPU) and FLOPs reduction over manually designed Transformers, with parity in BLEU score over dense Transformer and within 1 BLEU point of MoE SwitchTransformer, on aggregate over benchmark datasets for NMT. Heterogeneous search space with dense and sparsely activated Transformer modules allows for adaptive compute -- where different amounts of computations are used for different tokens in the input. Adaptivity comes naturally from routing decisions which send tokens to experts of different sizes.
Introduction
Mixture-of-Experts (MoE) models are the current state-of-the-art for large-scale AI because they allow for massive parameter counts with relatively low computational costs—only a small subset of "experts" is activated for any given input. However, most existing MoE designs are homogeneous: they use the same number of experts of the same size, usually placed uniformly (e.g., every other layer).
This "one-size-fits-all" approach is rarely optimal for real-world hardware. It ignores the fact that different layers in a Transformer contribute differently to performance and that some tokens are harder to process than others. Furthermore, manual design doesn't account for specific hardware constraints like CPU latency or memory. AutoMoE addresses these limitations by treating MoE design as an architecture search problem, asking: How many experts do we really need? Where should we put them? And what size should they be to maximize efficiency?
The AutoMoE Framework
The AutoMoE framework treats MoE design as an architecture search problem consisting of three main pillars:
- Heterogeneous Search Space: Unlike standard MoEs, AutoMoE can choose a different number of experts for each layer, vary the size (FFN hidden dimension) of individual experts, and adjust the number of decoder layers.
- Supernet Training: Training thousands of MoE variants from scratch is impossible. Instead, a single "Supernet"—the largest possible MoE in the search space—is trained. All smaller "sub-networks" share weights with this Supernet, allowing for performance estimation without full retraining.
- Evolutionary Search with Hardware Constraints: An evolutionary algorithm finds the best-performing architecture, guided by "partially gold latency"—actual measurements on target devices like Intel Xeon CPUs.
Weight Sharing and Adaptive Computation
A core component of the framework is the weight-sharing mechanism. Sub-transformer weights for modules like the Router and Feed-Forward Networks (FFNs) are sampled from the larger Supernet weights. This allows the model to perform "adaptive computation": the router sends "easy" tokens to smaller experts and "hard" tokens to larger ones, optimizing the FLOPs-per-token budget.
Key Insights and Results
The framework was evaluated on standard NMT benchmarks including WMT’14 (En-De, En-Fr) and WMT’19 (En-De). Several key architectural insights emerged:
- Encoder-Decoder Asymmetry: The search consistently favored placing more experts in the encoder. Keeping decoders "light" is the most effective way to reduce latency in autoregressive translation.
- Layer-wise Specialization: Middle encoder layers typically received the most experts, while the first layer received the fewest, suggesting feature extraction is most intensive in the middle of the stack.
- Efficiency Gains: AutoMoE achieved a 4x inference speedup on CPUs and a similar reduction in FLOPs compared to manually designed "Big" Transformers, while maintaining quality parity (BLEU scores).
- Sparsity: The generated models were highly sparse, often having 60-80% of their parameters inactive during any single forward pass.
Conclusion
AutoMoE demonstrates that heterogeneous, hardware-aware MoE design can significantly enhance inference efficiency without sacrificing translation quality. By leveraging NAS and weight-sharing, the framework discovers architectures that outperform manually designed models and state-of-the-art dense NAS methods. Future work will explore scaling to trillion-parameter models and improving Supernet training stability through advanced sampling and distillation techniques.
Summary updated