TL;DR
DeepSpeed-TED introduces a novel 3D hybrid parallelism strategy that combines tensor, expert, and data parallelism to scale Mixture-of-Experts (MoE) models. By introducing a tiled optimizer and targeted communication filters, the framework enables the training of MoEs with 4–8× larger base models while delivering up to a 26% speedup over baseline implementations.
What Problem Does This Paper Address?
Mixture-of-Experts (MoE) architectures are highly popular because they allow researchers to scale a model's parameter count drastically without a proportional increase in computational cost. They achieve this by replacing standard feedforward networks with multiple "experts" and routing individual tokens to only a subset of them.
However, recent findings show that simply adding more experts yields diminishing returns. To achieve state-of-the-art quality, the base model (the non-expert parts, like self-attention layers) must also grow. Existing distributed training frameworks like DeepSpeed-MoE rely solely on data and expert parallelism, meaning the entire base model must fit within the memory of a single GPU or node.
To scale the base model further, one must introduce tensor parallelism (splitting individual layers across multiple GPUs). Unfortunately, naively combining tensor, expert, and data parallelism introduces two severe bottlenecks:
- Memory Spikes: A massive surge in memory usage occurs during the mixed-precision optimizer step.
- Communication Redundancy: Tensor parallelism duplicates tokens across GPUs, causing massive network congestion during the MoE routing phase.
Methods
The authors present DeepSpeed-TED, which organizes GPUs into distinct virtual topologies depending on the layer type: a 2D grid (tensor + data parallelism) for non-expert blocks, and a 3D grid (tensor + expert + data parallelism) for expert blocks.
To resolve the bottlenecks of this 3D combination, they introduced three core optimizations:
- Tiled Optimizer: Instead of processing all expert parameters at once during the mixed-precision optimizer step—which requires a massive temporary buffer to up-cast 16-bit gradients to 32-bit—the optimizer processes parameters in fixed-size "tiles." This caps the memory spike to a small, constant size.
- Duplicate Token Dropping (DTD): Because tensor parallelism naturally duplicates activations across ranks, naively performing an MoE
all-to-allrouting step results in sending identical tokens multiple times. DTD filters out these redundant tokens before communication and uses anall-gatheroperation to safely reassemble them afterward. - Communication-aware Activation Checkpointing (CAC): Activation checkpointing saves memory by re-running the forward pass during the backward pass, but this normally duplicates expensive communication. CAC stashes the outputs of the
all-to-allandall-reducecollectives during the first forward pass, completely bypassing communication during the re-computation phase.
Datasets
The authors evaluated their framework using:
- BookCorpus: Used to verify the statistical convergence and correctness of the implementation.
- The Pile: A massive, diverse text dataset used to benchmark training performance, iteration times, and hardware throughput.
Key Insights and Ideas
- The Sharding Penalty of Experts: Under ZeRO-1 data parallelism, optimizer states are sharded across data-parallel ranks. However, because expert parameters are already split across different experts, their effective degree of data parallelism is much lower. This means each GPU is responsible for a much larger chunk of expert optimizer states, leading to the severe memory spikes discovered during mixed-precision up-casting.
- Communication Filtering is Essential: Tensor parallelism's internal
all-reduceoperations inherently create duplicate data across GPUs. Recognizing that this duplication directly multiplies the volume of subsequent MoEall-to-allrouting steps allows DTD to achieve massive communication savings with minimal overhead.
Key Results
- Larger Model Support: DeepSpeed-TED successfully trains MoE models with base models that are 1.09× to 4.8× larger than what standard DeepSpeed-MoE can support on the same hardware configuration.
- Memory Mitigation: The tiled optimizer successfully flattened the optimizer memory spike. In a benchmark with a 2.7B base model, it reduced the peak memory overhead from 4.5 GB to just 1.5 GB, preventing out-of-memory errors.
- Throughput Speedups: Combined, DTD and CAC cut
all-to-allcommunication time by up to 64.12% andall-reducetime by 33%. This translated to an overall training speedup of 20.7% to 26% for a 40-billion-parameter MoE model evaluated on 128 V100 GPUs.
Limitations and Future Work
The primary limitation stems from tensor parallelism itself: splitting tensors across GPUs requires high-bandwidth, low-latency interconnects (like NVLink). As a result, scaling the tensor parallel degree beyond a single node (e.g., a degree of 8 or higher on Summit) causes hardware utilization to drop significantly due to slower inter-node links.
To scale past this barrier, the authors state that future work will focus on integrating pipeline parallelism as a fourth dimension, allowing massive base models to be partitioned across nodes without overwhelming the network.
Summary updated