Abstract
Training massive Mixture of Experts (MoE) models requires a delicate balance between memory constraints and communication bottlenecks. We present MoE Parallel Folding, a novel technique that decouples parallelism strategies for Attention and MoE layers. By optimizing these layers independently and "folding" communication-intensive tasks into high-bandwidth hardware domains, we achieve up to 49.3% Model FLOPs Utilization (MFU) on large-scale clusters.
Introduction
Mixture of Experts (MoE) architectures have become a standard for scaling Large Language Models (LLMs) to trillions of parameters without a linear increase in computational cost. However, the introduction of Expert Parallelism (EP) alongside traditional Tensor (TP), Data (DP), and Pipeline (PP) parallelism creates significant communication overhead. Traditionally, all layers in a Transformer block share the same parallelism mapping, which is suboptimal because Attention layers operate on sequences while MoE layers operate on individual tokens.
Methodology
MoE Parallel Folding
The core innovation is the decoupling of parallelism configurations between dense Attention layers and sparse MoE layers. This "folding" mechanism allows the Attention layer to utilize one strategy (e.g., sequence splitting) while the MoE layer utilizes another (e.g., expert splitting).
By aligning these mappings, the framework ensures that the most intensive "All-to-All" communication remains within the high-bandwidth NVLink domain (intra-node), minimizing reliance on slower inter-node connections.
Flexible Token Dispatcher
To support this decoupled architecture, we implemented a 5-D Hybrid Parallelism dispatcher (TP, EP, CP, DP, PP). It features a sub-sequence-based token-dropping strategy that enables local decision-making, significantly reducing global communication latency without compromising model convergence.
Experimental Results
We evaluated the framework using several MoE architectures, including Mixtral 8x22B and Qwen2-57B-A14B, across up to 1,024 NVIDIA H100 GPUs.
Efficiency and Scalability
The implementation in NVIDIA’s Megatron-Core demonstrated substantial improvements over baseline methods like Fully Sharded Data Parallel (FSDP).
Key performance metrics include:
- Peak Efficiency: 49.3% MFU for Mixtral 8x22B.
- Linear Scaling: Performance scales efficiently up to 1,024 GPUs.
- FP8 Throughput: Achieving 631.7 TFLOPS on Mixtral 8x22B, representing a 1.3x speedup over BF16.
Discussion and Conclusion
While Parallel Folding significantly boosts efficiency for coarse-grained MoE models, fine-grained architectures (with many small experts) still face challenges due to smaller matrix multiplication (GEMM) sizes. Future research will focus on kernel optimization for these fine-grained experts and extending 5-D parallelism to even larger models and longer context windows (up to 128K tokens).
Summary updated