Piper: Multidimensional Planner for DNN Parallelization

Jakub Tarnawski, Deepak Narayanan, Amar Phanishayee

Introduction

Training massive AI models like GPT-3 requires distributing the computation across hundreds or thousands of accelerators. Researchers typically rely on four primary scaling techniques:

  • Data Parallelism (DP): Replicating the model across GPUs and dividing the training data.
  • Pipeline Parallelism (PP): Splitting the model into sequential "stages" akin to an assembly line.
  • Tensor Parallelism (TP): Dividing individual mathematical operations (like matrix multiplications) across multiple GPUs.
  • Activation Recomputation (AR): Discarding intermediate activations to save memory and recalculating them during the backward pass.

The challenge lies in the complex interactions between these dimensions. A configuration that maximizes computational speed might exceed memory limits or introduce severe communication bottlenecks. Previous tools often optimized only a subset of these dimensions or relied on "equi-partitioning," which assumes every pipeline stage must be identical.

Piper is an automated optimization algorithm designed to find the absolute fastest, memory-feasible configuration for partitioning large Deep Neural Networks (DNNs) across accelerator clusters. It is the first multidimensional planner to optimally combine DP, PP, TP, and AR.

Methodology

To navigate the massive search space of possible configurations, Piper employs a novel two-level dynamic programming (DP) algorithm:

  1. The Global Level (Partitioning): Piper treats the model as a Directed Acyclic Graph (DAG) and uses DP on "downsets" of the computation graph to find the optimal way to slice the model into contiguous pipeline stages.
  2. The Local Level (The Knapsack Problem): For each potential stage, Piper must decide which "Tensor Model Parallelism Configuration" (TMPC) to use for each layer. Because balancing speed and memory for individual layers is NP-hard (similar to the Knapsack Problem), Piper uses a "bang-per-buck" heuristic to select configurations that minimize execution time while strictly adhering to memory limits.

A key innovation is Piper's use of pre-defined TMPCs. Instead of calculating how to split every mathematical operation from scratch, it leverages known-good "recipes" for common layers (e.g., transformer blocks). This abstraction makes the global optimization problem mathematically tractable, reducing computation time from years to mere minutes on a single CPU core.

Experimental Setup

The authors evaluated Piper using performance profiles rather than end-to-end training on standard datasets. The target model was a BERT-32 network with 5.9 billion parameters. Hardware profiles simulated clusters of NVIDIA A100 GPUs connected via high-speed NVLink/NVSwitch (300 GB/s) and standard inter-server networking (25 GB/s). Piper was compared against ablated versions of itself (e.g., "no TP", "no DP") and an "equi" baseline acting as a surrogate for state-of-the-art planners like PipeDream-2BW.

Key Insights and Results

Piper's multidimensional approach yields several critical insights into distributed training:

  • Heterogeneity is a Superpower: Unlike prior work that assumed uniform pipeline stages, Piper frequently discovers that "heterogeneous" stages—where different stages have varying numbers of layers or parallelism degrees—are significantly faster.
  • Strict Memory Budgeting: Piper treats memory as a hard constraint. It only deploys slower techniques like AR or TP when strictly necessary to fit the model into available RAM, thereby preserving throughput elsewhere.
  • The Necessity of Tensor Parallelism: Without TP, scaling hits a plateau where adding more GPUs provides no benefit because the data cannot be further divided. TP enables continued scaling even with small batch sizes.
Throughput comparison of Piper against baselines across various memory constraints and device counts.

As shown in the performance evaluations, Piper consistently achieves superior throughput compared to all baselines across various GPU counts (from 8 to 2048). Furthermore, in highly memory-constrained scenarios (e.g., 1GB or 2GB of RAM per device), Piper demonstrates remarkable robustness. It is often the only planner capable of finding a feasible configuration, whereas baselines fail to find any solution that fits in memory. The authors also validated Piper’s internal "time-per-sample" predictions against real-world measurements on an NVIDIA DGX A100 cluster, achieving a high Pearson correlation of 0.95.

Limitations and Future Work

While highly effective, Piper has a few limitations. Currently, it focuses on "non-flushing" pipeline schedules (like PipeDream) and does not support schedules with periodic flushes (like GPipe), though this could be integrated by expanding the DP state space. Additionally, Piper relies on a provided list of possible TMPCs rather than inventing new layer-splitting strategies from scratch. Finally, the current model assumes a "flat" network topology with uniform all-to-all communication costs; future iterations could be extended to accommodate hierarchical network topologies, such as differing speeds for intra-rack versus inter-rack communication.

Summary updated

BibTeX
@inproceedings{tarnawski2021piper,
  author = {Jakub Tarnawski and Deepak Narayanan and Amar Phanishayee},
  title = {{Piper: Multidimensional Planner for DNN Parallelization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
}
Figure