Source-linked AI summary
GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism
Yanping Huang, Youlong Cheng, Ankur Bapna, Orhan Firat, Mia Xu Chen, Dehao Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V. Le, Yonghui Wu, Zhifeng Chen
TL;DR
Large models can exceed an accelerator’s memory, while model-parallel methods are often difficult to design and specific to particular tasks or architectures. GPipe partitions layer-sequence networks across accelerators and pipelines split mini-batches with synchronous updates. It demonstrates results on image classification and multilingual translation, including 84.4% top-1 validation accuracy for a 557-million-parameter AmoebaNet.
Problem
Scaling beyond one accelerator is constrained by memory and communication, while efficient model-parallel algorithms are difficult to design and often architecture- and task-specific.
Source: §1 · pp. 1–2Method
GPipe partitions layer-sequence networks across accelerators and pipelines micro-batches, accumulating their gradients for synchronous mini-batch updates.
Source: §1 · p. 2Results
Takeaways & Limitations
GPipe supports deep networks expressible as layer sequences and achieves almost linear speedup with the number of devices.
Source: §7 · p. 9Imbalanced layer memory or computation can cause load imbalance under imperfect partitioning, and better partitioning may improve on the heuristic.
Source: §2.3 · p. 4
Abstract
from arXiv · showhide
Scaling up deep neural network capacity has been known as an effective approach to improving model quality for several different machine learning tasks. In many cases, increasing model capacity beyond the memory limit of a single accelerator has required developing special algorithms or infrastructure. These solutions are often architecture-specific and do not transfer to other tasks. To address the need for efficient and task-independent model parallelism, we introduce GPipe, a pipeline parallelism library that allows scaling any network that can be expressed as a sequence of layers. By pipelining different sub-sequences of layers on separate accelerators, GPipe provides the flexibility of scaling a variety of different networks to gigantic sizes efficiently. Moreover, GPipe utilizes a novel batch-splitting pipelining algorithm, resulting in almost linear speedup when a model is partitioned across multiple accelerators. We demonstrate the advantages of GPipe by training large-scale neural networks on two different tasks with distinct network architectures: (i) Image Classification: We train a 557-million-parameter AmoebaNet model and attain a top-1 accuracy of 84.4% on ImageNet-2012, (ii) Multilingual Neural Machine Translation: We train a single 6-billion-parameter, 128-layer Transformer model on a corpus spanning over 100 languages and achieve better quality than all bilingual models.
1 Introduction
GPipe addresses the difficulty of scaling models beyond accelerator memory with flexible, task-independent model parallelism. It partitions layer-sequence networks across accelerators and pipelines micro-batches with synchronous updates.
1 Introduction
- Scaling models is constrained by accelerator memory and communication bandwidth, while efficient model-parallel algorithms are difficult to design and often task- and architecture-specific.The paper identifies demand for flexible infrastructure that scales networks across diverse tasks.Source: §1 · pp. 1–2
- GPipe partitions consecutive groups of layers across accelerators and pipelines micro-batches, accumulating gradients for synchronous updates at each mini-batch’s end.The library supports networks expressed as layer sequences and can be combined with data parallelism.Source: §1 · p. 2
- GPipe trains a 557-million-parameter AmoebaNet to 84.4% top-1 validation accuracy and a 128-layer, 6-billion-parameter Transformer that outperforms bilingual models on 100 language pairs.The multilingual model covers 103 languages, with 102 translated to English.Source: §1 · p. 2
2 The GPipe Library
GPipe represents networks as layer sequences, partitions them into cells on separate accelerators, and pipelines micro-batches while retaining synchronous mini-batch updates. Its design reduces activation memory and communication, though performance can suffer when partitions are imbalanced.
2 The GPipe Library
- GPipe partitions consecutive layers into cells placed on accelerators; its core design is applicable beyond the Lingvo implementation to other frameworks.An example shows four accelerators executing separate network partitions and overlapping micro-batches.Source: §2 · p. 2, Figure 2 · p. 3
2.1 Interface
- A layer is specified by its forward function and parameters, and consecutive layers form composite cells with corresponding forward and back-propagation functions.An optional cost estimator can be specified for layers.Source: §2.1 · p. 3
- Users specify the number of partitions, number of micro-batches, and layer sequence; GPipe forms cells and estimates their costs to balance partition computation.Communication primitives are inserted at partition boundaries.Source: §2.1 · p. 3, §2.2 · p. 3
2.2 Algorithm
- Each mini-batch is split into equal micro-batches, whose gradients are computed using the same parameters and accumulated before synchronous parameter updates.With batch normalization, statistics are computed per micro-batch and, if needed, across replicas; moving averages cover the full mini-batch for evaluation.Source: §2.2 · p. 3
2.3 Performance Optimization
- GPipe reduces peak activation memory by retaining partition-boundary activations and recomputing each cell’s forward function during backpropagation, versus O(N × L) without re-materialization and partitioning.The stated reduced-memory expression is truncated in the supplied passage; the comparison baseline is O(N × L).Source: §2.3 · p. 4
- When M ≥ 4 × K, bubble overhead is negligible in the reported experiments; communication passes only activation tensors at partition boundaries.Early scheduling of backward recomputation can also reduce waiting for gradients from earlier layers.Source: §2.3 · p. 4
- Imbalanced layer memory or computation can produce load imbalance under imperfect partitioning, and better partitioning may improve on the heuristic.The illustrated pipeline assumes evenly balanced partitions.Source: §2.3 · p. 4
3 Performance Analyses
GPipe scales AmoebaNet and Transformer models beyond single-accelerator limits, while throughput depends on micro-batch count and how evenly work is distributed across layers. Boundary-only activation transfers also support speedups over PCI-E without high-speed interconnects.
3 Performance Analyses
- The performance evaluation studied scalability, efficiency, and communication cost on AmoebaNet convolutional and Transformer sequence-to-sequence models.These were two substantially different model architectures.Source: §3 · p. 4
- 1.8 billion parameters on 8 accelerators let AmoebaNet reach 25× the model size possible without GPipe, though uneven layer sizes prevented perfectly linear scaling.On one accelerator, re-materialization and batch splitting reduced intermediate activation memory from 6.26GB to 3.46GB, enabling a 318M-parameter model.Source: §3 · pp. 4–5
- 83.9B parameters with 128 partitions scaled Transformer size to 298× the single-accelerator limit, with linear scaling attributed to equal layer sizes and input sizes.Re-materialization alone allowed a 2.7× larger Transformer on one accelerator.Source: §3 · p. 5
- When micro-batches were at least 4× the partitions, bubble overhead was almost negligible; Transformer achieved 3.5× speedup across four times more accelerators.Transformer throughput scaled almost linearly, whereas AmoebaNet achieved sub-linear speedup because its computation was imbalanced; with one micro-batch, only one device computed at a time.Source: §3 · p. 5, Table 2 · p. 5
- 2.7× speedup for AmoebaNet-D (18, 128) and 3.3× for a 24-layer Transformer were observed when increasing partitions from 2 to 8 on GPUs without NVLinks.The experiments used a single host with P100 GPUs, PCI-E transfers, and 32 micro-batches; activation transfers at partition boundaries kept communication bandwidth from becoming a bottleneck.Source: §3 · p. 5
4 Image Classification
GPipe scales AmoebaNet for ImageNet classification, and the resulting ImageNet-pretrained model transfers competitively across target datasets. Reported comparisons include both scratch-trained baselines and models using private pretraining data.
4 Image Classification
- 84.4% top-1 and 97% top-5 single-crop validation accuracy were achieved by a 557-million-parameter AmoebaNet-B (18, 512) on ImageNet 2012.The model used 480 × 480 input images and four partitions.Source: §4 · p. 5
- Fine-tuned ImageNet-pretrained AmoebaNet results were competitive across target datasets, including 1% CIFAR-10 error and 8.7% CIFAR-100 error.The final softmax layer was replaced for each target dataset, and results averaged single-crop test accuracy over five fine-tuning runs; cited baselines were trained from scratch, while some comparison models used private pretraining data.Source: §4 · pp. 5–6, Table 4 · p. 6
5 Massive Massively Multilingual Machine Translation
Scaling multilingual Transformer capacity improves translation quality across languages, with especially large gains for low-resource languages. The section also compares model depth and width, explores very large training batches, and reports optimization challenges in deep models.
Experimental setup
- The evaluation used a single Transformer trained jointly across language pairs, on a corpus of 25 billion examples spanning 102 languages and English.The corpus ranged from 10^4 to 10^9 examples per language; models were scaled in depth and width.Source: §5 · p. 6
Capacity and translation quality
- Scaling multilingual Transformers from 400M to 6B parameters improved translation quality across languages, with particularly large low-resource gains over bilingual baselines.The authors report that gains from 1.3B to 6B were especially evident for high-resource languages, while returns diminished across the larger models.Source: Figure 3 · p. 7, §5 · p. 7
Depth-Width Trade-off
- At 1.3B parameters, deep and wide models performed similarly on high-resource languages, but the deeper model led by large margins on low-resource languages.The authors suggest that greater depth might improve generalization and potentially increase transfer to low-resource tasks.Source: §5 · p. 7
Trainability Challenges with Deep Models
- Deep-model training produced peaky predictions and non-finite or large gradients after a few thousand steps; layer-scaled initialization and logit clipping mitigated instability.The instability was associated with sharp activations and dataset noise.Source: §5 · p. 7
Large Batches
- Raising batch size from 260K to 4M tokens significantly improved validation loss and BLEU for German-English, with similar trends reported for other language pairs.The authors describe 4M tokens per batch as, to their knowledge, the largest batch used for NMT training in the literature at that time.Source: §5 · pp. 7–8
6 Design Features and Trade-Offs
Model-parallel approaches trade off flexibility, communication, and hardware utilization. GPipe uses synchronous micro-batch pipeline parallelism to reduce pipeline bubbles and communication, while retaining constraints around layer memory and layers that compute across a batch.
SPMD
- SPMD splits computations across devices, but frequent AllReduce-like communication limits its applicability to high-speed interconnects and specific operation or architecture types.The passage notes that scaling convolution channels is inefficient under this approach, while spatial splitting requires handling halo regions.Source: §6 · p. 8
PipeDream
- PipeDream intersperses forward and backward passes to improve utilization, but weight staleness leads it to maintain multiple versioned parameter copies on each accelerator.The passage says this requirement prevents users from scaling to bigger models.Source: §6 · p. 8
GPipe
- GPipe pipelines micro-batches and applies one synchronous gradient update per mini-batch; with re-materialization, this reduces bubble overhead without asynchronous updates.Communication occurs at partition boundaries for each micro-batch, and the authors describe its overhead as marginal.Source: §6 · p. 8
GPipe limitations
- GPipe assumes each layer fits in one accelerator's memory, and micro-batch splitting complicates support for layers that compute across the batch.One proposed workaround for the memory constraint is to split a matrix multiplication into smaller operations spread sequentially across layers; BatchNorm also requires special handling of training and evaluation statistics.Source: §6 · pp. 8–9
7 Conclusion
GPipe combines batch-splitting pipeline parallelism with synchronous gradient updates to train large convolutional and transformer-based models. The authors highlight its efficiency, flexibility, and reliability, alongside empirical results on image classification and multilingual machine translation.
- GPipe achieves strong empirical results on image classification and multilingual machine translation using large-scale convolutional and transformer-based models.Source: §7 · p. 9
- Its batch-splitting pipelining algorithm achieves almost linear speedup with the number of devices.The algorithm uses synchronous gradient updates for high hardware utilization and training stability.Source: §7 · p. 9
- GPipe supports any deep network representable as a sequence of layers and guarantees consistent training regardless of the number of partitions through synchronous gradient descent.Source: §7 · p. 9