TL;DR
This paper introduces DeepSpeed-TED, a novel 3D hybrid parallelism approach combining data, tensor, and expert parallelism to train significantly larger Mixture-of-Experts (MoE) models than previously possible. They also present memory and communication optimizations that reduce training time and enable the training of MoE models with 4-8x larger base models.
What Problem Does This Paper Address?
Modern AI models, like GPT-3, are growing to hundreds of billions of parameters, making training prohibitively expensive. Mixture-of-Experts (MoE) architectures offer a way to increase model capacity without a proportional increase in computational cost by using sparsely activated "expert" sub-networks. However, existing distributed training frameworks struggle to efficiently train MoE models with very large base models (the core neural network architecture before MoE layers are added). This limitation hinders the development of higher-quality MoE models, as research suggests that both the number of experts and the size of the base model need to increase for better performance. The authors aim to bridge this gap by developing a more scalable and efficient training framework for large MoE models.
Methods
The core contribution is DeepSpeed-TED, a three-dimensional hybrid parallelism approach. It combines:
- Data Parallelism (ZeRO): Shards optimizer states across GPUs to reduce memory per GPU.
- Expert Parallelism (DeepSpeed-MoE): Distributes different "expert" sub-networks across GPUs.
- Tensor Parallelism (Megatron-LM): Partitions individual layers (like self-attention and feed-forward networks) across GPUs.
This is a novel combination, as prior work typically used only two of these dimensions. To address the challenges of this combined approach, they introduce:
- Tiled Optimizer: A memory optimization that processes optimizer states in smaller "tiles" to reduce peak memory usage during the optimizer step, which is a critical bottleneck for large MoE models.
- Communication Optimizations:
- Duplicate Token Dropping (DTD): Reduces redundant data transfer during the all-to-all communication step in expert parallelism by having GPUs within a tensor parallel group "drop" certain activations before the communication. An all-gather step then reassembles the necessary data.
- Communication-aware Activation Checkpointing (CAC): Optimizes activation checkpointing (a memory-saving technique) by reusing communication results from the first forward pass during the re-materialization forward pass, reducing communication overhead.
Datasets
The paper mentions using The Pile dataset for generating input tokens for training and the BookCorpus dataset for validation experiments.
Key Insights and Ideas
- The synergy of 3D parallelism is crucial: Simply combining existing parallelism techniques isn't enough; specific optimizations are needed to overcome new bottlenecks.
- Optimizer memory spike is a major MoE challenge: The optimizer step, particularly with mixed precision, creates a significant memory overhead that grows with model size and expert count, necessitating specialized solutions like tiling.
- Redundant communication is a hidden cost: Naively combining tensor and expert parallelism leads to substantial data duplication in communication primitives (like all-to-all), which DTD effectively addresses.
- Communication optimizations are more impactful for larger models: The benefits of DTD and CAC become more pronounced as base model sizes increase, requiring higher degrees of tensor parallelism.
Key Results
- DeepSpeed-TED enables training MoE models with 4-8x larger base models compared to DeepSpeed-MoE.
- Achieved a 26% speedup in training a 40 billion parameter MoE model (6.7 billion base model with 16 experts) on 128 V100 GPUs, compared to a baseline without their communication optimizations.
- The tiled optimizer significantly reduces peak memory consumption, allowing training of models that would otherwise run out of memory. For example, it enabled training a 6.7B parameter MoE with 16 experts on 32 GPUs, which was impossible without tiling.
- Communication optimizations (DTD + CAC) reduced all-to-all and all-reduce communication times by 64.12% and 33% respectively, leading to a ~20.7% speedup.
- The framework demonstrated strong scaling, with performance improving as more GPUs were added, especially for larger models.
Limitations and Future Work
- Tensor parallelism across nodes: The paper notes that tensor parallelism is inefficient when spanning multiple nodes. They limit the tensor parallel degree to the number of GPUs within a node (e.g., 6 for Summit nodes).
- Maximum expert count: They limit the number of experts to 128, citing prior work that shows diminishing returns beyond this point.
- Future Work: The authors plan to integrate pipeline parallelism as another dimension to further scale models that cannot fit on a single node.
Summary updated