TL;DR
NVIDIA introduces an optimized, production-ready training stack within Megatron-Core designed to scale Mixture-of-Experts (MoE) models to trillions of parameters. By implementing a full-stack co-design—including a novel "Parallel Folding" technique, device-initiated sync-free kernels, and low-precision FP8/FP4 recipes—the framework achieves up to 1,233 TFLOPS/GPU on NVIDIA Blackwell systems, effectively breaking the system bottlenecks inherent to sparse models.
What Problem Does This Paper Address?
While Mixture-of-Experts (MoE) models offer a highly efficient path to scaling model capacity sub-linearly with compute cost, they introduce severe system challenges absent in dense models. Because each token activates only a small subset of experts, a massive "Parameter-Compute Mismatch" occurs: total parameters grow with the number of experts, but per-token computation remains low.
This asymmetry creates three tightly coupled bottlenecks, referred to as the Three Walls:
- The Memory Wall: All expert parameters, gradients, and optimizer states must reside in memory, even though only a fraction are active at any given step.
- The Communication Wall: Expert Parallelism (EP) requires frequent all-to-all collectives to route tokens to their designated GPUs, which quickly saturates inter-node interconnects.
- The Compute Efficiency Wall: Fine-grained expert architectures result in many small matrix multiplications (GEMMs) that underutilize GPU compute units and dramatically increase host-side CPU overhead.
Optimizing one dimension often shifts pressure to another, demanding a unified system-level co-design.
Methods
The authors address these challenges through integrated optimizations across the entire Megatron-Core MoE stack:
- Parallel Folding: A novel parallelism framework that decouples the parallelism mappings of dense attention layers from sparse MoE layers. This breaks the traditional constraint where the Expert Parallelism degree was strictly bounded by Data Parallelism ($EP \le DP$), allowing each layer type to run in its optimal topology.
- Memory Optimizations: Includes Memory-Efficient Permutation (algebraically rearranging routing weights to eliminate intermediate tensors), fine-grained activation offloading, precision-aware optimizers (storing Adam moments in BF16/FP8), and an auxiliary Expert DeviceMesh for FSDP.
- Communication Optimizations: Integration of high-performance token dispatchers (DeepEP and HybridEP) combined with a 1F1B bidirectional schedule to overlap all-to-all communication with expert computation.
- Compute & Graph Optimizations: To eliminate host overhead in dropless MoE architectures, the authors developed device-initiated GPU kernels (Grouped GEMM and sync-free dispatch) that read shape information directly from device memory. This is paired with ECHO (Elastic Cloning for Hot Experts) to mitigate load imbalance and Paged Stashing to reduce memory fragmentation within CUDA Graphs.
- Reduced-Precision Training: Native support for FP8 and NVFP4 (4-bit microscaling) training recipes with selective precision to safeguard numerically sensitive components like the router.
Datasets
As a technical report focused on system performance and scalability, the paper does not introduce or train on new text datasets. Instead, the framework is evaluated using workloads modeled after two state-of-the-art fine-grained MoE architectures:
- DeepSeek-V3-685B (685B total parameters, 37B active per token, 256 experts)
- Qwen3-235B (235B total parameters, 128 experts)
Key Insights and Ideas
- The Parallelism Paradox: Traditional parallelism assumes uniform layer requirements. However, attention layers benefit from high Tensor Parallelism (TP), while MoE layers suffer from it due to expert fragmentation. Parallel Folding resolves this "dense-sparse mismatch" by allowing attention layers to use high TP/CP while MoE layers use high EP independently on the same hardware.
- Bypassing the Host via Device-Initiated Kernels: In dropless MoE, dynamic token counts normally force a host-device synchronization point to determine tensor shapes before launching kernels. By redesigning kernels to be device-initiated, Megatron-Core allows the GPU to manage its own control flow and shapes, unlocking full CUDA Graph coverage for dynamic workloads.
- Decoupling Worst-Case Buffers: To prevent token overflow without wasting massive amounts of memory, Paged Stashing uses a single shared temporary buffer for worst-case allocations and copies actual tokens into a paged stashing buffer for the backward pass, drastically reducing memory overhead from $\mathcal{O}(\text{layers} \times \text{worst\_case})$ to $\mathcal{O}(\text{worst\_case} + \text{actual\_total})$.
Key Results
The framework demonstrates exceptional hardware utilization and scalability across multiple generations of NVIDIA hardware:
- NVIDIA GB300 (Blackwell): Achieves 1,233 TFLOPS/GPU for DeepSeek-V3-685B and 974 TFLOPS/GPU for Qwen3-235B using MXFP8.
- NVIDIA GB200: Delivers 1,048 TFLOPS/GPU for DeepSeek-V3 and 919 TFLOPS/GPU for Qwen3-235B.
- NVIDIA H100 (Hopper): Achieves 368 TFLOPS/GPU for DeepSeek-V3 at a 1,024-GPU scale using blockwise FP8.
- Long-Context Scaling: In a 128-GPU stress test at a sequence length of 131,072 tokens, the system sustains 1,150 TFLOPS/GPU for Qwen3-235B on GB300 systems.
Limitations and Future Work
While the report presents a highly optimized stack, the authors note several areas of ongoing development:
- GEMM Implementations: Advanced features like cuBLASLt Grouped GEMM via batch mode (intended to unblock CUDA Graphs across all precisions) and cuteDSL fused kernels for Blackwell are still under active development.
- Router Fusion: Current fusions consolidate routing, permutation, and auxiliary loss computations, but future work aims to incorporate communication directly into the router fusion scope to minimize global memory access further.
Summary updated