DAPPLE: a pipelined data parallel approach for training large models

Shiqing Fan, Yi Rong, Chen Meng, Zongyan Cao, Siyu Wang, Zhen Zheng, Chuan Wu, Guoping Long, Jun Yang, Lixue Xia, Lansong Diao, Xiaoyong Liu, Wei Lin

TL;DR

Training massive deep learning models strains current hardware. DAPPLE introduces a novel framework that intelligently combines data and pipeline parallelism, optimizing how models are split and executed across GPUs. This leads to significant speedups and reduced memory usage compared to existing methods, making it easier to train larger and more complex models.

What Problem Does This Paper Address?

The ever-increasing size of deep learning models, particularly in areas like Natural Language Processing (NLP) and large-scale recommendation systems, presents a significant challenge for training. These models can have billions of parameters, requiring tens or even hundreds of gigabytes of memory per device. While synchronous data parallelism (DP) is a common approach, it struggles with scalability and becomes infeasible when a model's parameters exceed a single device's memory. Pipeline parallelism (PP) offers a solution by splitting model layers across devices, but existing PP methods face issues with:

  • Memory Consumption: Synchronous PP can require substantial memory to store intermediate activations for multiple micro-batches, sometimes necessitating costly re-computation.
  • Efficiency: Determining the optimal way to partition a model and assign its stages to devices, especially considering complex hardware interconnects, is a difficult problem.
  • Convergence: Asynchronous PP, while potentially offering higher throughput, can raise concerns about model convergence in practical industry applications.

DAPPLE aims to address these challenges by providing a synchronous, hybrid data and pipeline parallelism framework that optimizes both training efficiency and memory usage.

Methods

DAPPLE introduces two core components:

  1. DAPPLE Planner: This is a novel parallelization strategy planner that automatically determines the optimal hybrid strategy of data and pipeline parallelism. It tackles the complex problems of:
  2. Stage Partitioning: Deciding how to divide the model's layers into stages.
  3. Stage Replication: Determining if and how to replicate stages across multiple devices for data parallelism.
  4. Device Placement: Assigning these stages and their replicas to specific devices, taking into account hardware topology (e.g., NVLink vs. Ethernet). The planner uses a dynamic programming approach to minimize the overall training iteration time, considering factors like computation, communication, and memory constraints. It also explores "uneven" stage partitions, which can sometimes yield better performance than perfectly balanced ones.

  5. DAPPLE Runtime Scheduler: This component focuses on efficient execution. It implements an "early backward scheduling" algorithm designed to reduce peak memory consumption. Instead of processing all forward passes before any backward passes, DAPPLE interleaves forward and backward computations for micro-batches. This allows memory used by forward activations to be freed earlier, reducing the need for re-computation and its associated performance penalty. The runtime also handles cross-stage communication, including specialized split-concat operations for replicated stages.

Datasets

The paper evaluates DAPPLE on several representative deep learning models across different tasks:

  • Image Classification: VGG-19, AmoebaNet-36
  • Machine Translation: GNMT-16
  • Language Modeling: BERT-48, XLNet-36
  • General Purpose: ResNet-50

The datasets used for training and evaluation are not explicitly detailed beyond the model names and tasks, but they are implied to be standard benchmarks for these models (e.g., ImageNet for image classification, WMT16 for machine translation, SQuAD2.0 for language understanding).

Key Insights and Ideas

  • Hybrid Parallelism is Key: For many large models and hardware configurations, a pure data or pipeline parallelism approach is suboptimal. DAPPLE's strength lies in its ability to find the best combination of both.
  • Topology-Aware Planning Matters: The way devices are interconnected (e.g., fast NVLink within a server vs. slower Ethernet between servers) significantly impacts performance. DAPPLE's planner explicitly considers this to optimize communication.
  • Early Backward Scheduling Reduces Memory Without Sacrificing Throughput: By interleaving forward and backward passes, DAPPLE effectively reclaims memory earlier, enabling larger micro-batches or models without the typical performance hit of re-computation.
  • Uneven Stage Partitioning Can Be Beneficial: Contrary to the intuition that perfectly balanced stages are always best, DAPPLE found that slightly uneven partitions can sometimes lead to better overall performance by minimizing bubbles or optimizing for specific model architectures.
  • Synchronous Training is Viable for Large Models: DAPPLE demonstrates that synchronous training, which is generally preferred for convergence guarantees, can be made efficient and memory-friendly for large models.

Key Results

  • DAPPLE Planner: Outperforms PipeDream's planner by up to 3.23x speedup under synchronous training scenarios.
  • DAPPLE Runtime: Outperforms GPipe by 1.6x speedup in training throughput and saves 12% of memory consumption at the same time.
  • Memory Savings: DAPPLE's early backward scheduling can save approximately 20% of device memory compared to GPipe, even when GPipe uses re-computation.
  • Scalability: DAPPLE demonstrates good scalability across different hardware configurations (hierarchical and flat interconnects) and model sizes. For instance, it can train BERT models up to 5.5 billion parameters on 8 V100 GPUs.

Limitations and Future Work

  • Limitations:
    • The paper notes that its pipeline latency objective is an approximation and doesn't model all internal bubbles within stages.
  • While DAPPLE handles various hardware topologies, the performance gains are most pronounced with hierarchical interconnects.
  • The paper mentions that for some models, DP with overlap still performs well, suggesting that the optimal strategy is highly dependent on the model and hardware.
  • Future Work:
    • The paper implicitly suggests further exploration of optimal scheduling policies (PA vs. PB) for different ACR (Activation Communication Ratio) scenarios.
  • The framework could potentially be extended to handle more complex model architectures or dynamic workloads.
  • Further investigation into the trade-offs between re-computation and memory savings in conjunction with DAPPLE's scheduling could be explored.

Summary updated

BibTeX
@inproceedings{fan2021dapple,
  author = {Shiqing Fan and Yi Rong and Chen Meng and Zongyan Cao and Siyu Wang and Zhen Zheng and Chuan Wu and Guoping Long and Jun Yang and Lixue Xia and Lansong Diao and Xiaoyong Liu and Wei Lin},
  title = {{DAPPLE: a pipelined data parallel approach for training large models}},
  booktitle = {PPoPP},
  year = {2021},
  doi = {10.1145/3437801.3441593},
}
Figure