A Hybrid Tensor-Expert-Data Parallelism Approach to Optimize Mixture-of-Experts Training

Siddharth Singh, Olatunji Ruwase, Ammar Ahmad Awan, Samyam Rajbhandari, Yuxiong He, Abhinav Bhatele

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:

  1. Memory Spikes: A massive surge in memory usage occurs during the mixed-precision optimizer step.
  2. 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.

TED organizes GPUs into distinct 2D and 3D virtual topologies to handle non-expert and expert blocks differently.

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-all routing step results in sending identical tokens multiple times. DTD filters out these redundant tokens before communication and uses an all-gather operation 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-all and all-reduce collectives 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-reduce operations inherently create duplicate data across GPUs. Recognizing that this duplication directly multiplies the volume of subsequent MoE all-to-all routing 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.
The tiled optimizer significantly reduces the peak memory watermark during the optimizer step.
  • Throughput Speedups: Combined, DTD and CAC cut all-to-all communication time by up to 64.12% and all-reduce time 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.
DTD and CAC optimizations dramatically reduce the time spent in collective communication.

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

BibTeX
@inproceedings{singh2023hybrid,
  author = {Siddharth Singh and Olatunji Ruwase and Ammar Ahmad Awan and Samyam Rajbhandari and Yuxiong He and Abhinav Bhatele},
  title = {{A Hybrid Tensor-Expert-Data Parallelism Approach to Optimize Mixture-of-Experts Training}},
  booktitle = {ICS},
  year = {2023},
  doi = {10.1145/3577193.3593704},
}
Figure