[Paper Review] PipeTransformer: Automated Elastic Pipelining for Distributed Training of Transformers
PipeTransformer proposes an automated, elastic pipelining framework for distributed training of Transformer models that dynamically freezes layers during training, packs active layers into fewer GPUs, and increases data-parallel width by spawning additional pipeline replicas. It achieves up to 2.83× speedup over state-of-the-art baselines without accuracy loss on ViT and BERT models.
The size of Transformer models is growing at an unprecedented pace. It has only taken less than one year to reach trillion-level parameters after the release of GPT-3 (175B). Training such models requires both substantial engineering efforts and enormous computing resources, which are luxuries most research teams cannot afford. In this paper, we propose PipeTransformer, which leverages automated and elastic pipelining and data parallelism for efficient distributed training of Transformer models. PipeTransformer automatically adjusts the pipelining and data parallelism by identifying and freezing some layers during the training, and instead allocates resources for training of the remaining active layers. More specifically, PipeTransformer dynamically excludes converged layers from the pipeline, packs active layers into fewer GPUs, and forks more replicas to increase data-parallel width. We evaluate PipeTransformer using Vision Transformer (ViT) on ImageNet and BERT on GLUE and SQuAD datasets. Our results show that PipeTransformer attains a 2.4 fold speedup compared to the state-of-the-art baseline. We also provide various performance analyses for a more comprehensive understanding of our algorithmic and system-wise design. We also develop open-sourced flexible APIs for PipeTransformer, which offer a clean separation among the freeze algorithm, model definitions, and training accelerations, hence allowing it to be applied to other algorithms that require similar freezing strategies.
Motivation & Objective
- To address the high computational and engineering cost of training large-scale Transformer models.
- To reduce training time and resource usage by exploiting the observation that layers in deep networks converge bottom-up.
- To design a system that dynamically adapts pipeline configuration and data-parallel replication based on frozen layers.
- To overcome challenges in on-the-fly freezing, dynamic pipelining, collective communication in changing process groups, and cross-replica activation caching.
Proposed method
- Introduces an adaptive freeze algorithm that uses a tunable threshold α to identify and freeze layers based on activation stability during training.
- Employs AutoPipe to repartition the model by packing active layers into fewer GPUs, minimizing communication and pipeline bubbles.
- Uses AutoDP to dynamically spawn new pipeline replicas on freed-up GPUs, maintaining hierarchical communication groups for efficient collective operations.
- Implements AutoCache to share cached activations across existing and new pipeline replicas, with a profiler determining optimal activation caching start time.
- Combines these components into a holistic system that automatically adjusts model partitioning and replication based on real-time layer freezing.
- Leverages PyTorch’s pipeline and data-parallel APIs to ensure compatibility and efficient execution.
Experimental results
Research questions
- RQ1Can dynamic layer freezing during training be effectively exploited to accelerate distributed training of Transformers?
- RQ2How can pipelining and data parallelism be jointly optimized in response to layer freezing?
- RQ3What are the performance trade-offs of varying the freeze threshold α and micro-batch chunking in elastic pipelining?
- RQ4How can collective communications be efficiently managed in a system with dynamically changing numbers of pipeline replicas?
- RQ5What is the optimal timing for enabling activation caching in a dynamic training setup?
Key findings
- PipeTransformer achieves up to 2.83× speedup over state-of-the-art baselines on ViT (ImageNet) and BERT (SQuAD/GLUE) without accuracy degradation.
- A larger freeze threshold α (e.g., α = 1/5) yields greater speedups but causes minor accuracy loss, indicating a tunable trade-off between speed and performance.
- Optimal micro-batch count M varies significantly with pipeline length K, highlighting the need for prior profiling to avoid performance degradation.
- Caching activations only becomes beneficial after a sufficient number of layers are frozen—AutoCache starts caching at 3 frozen layers for ViT and 5 for BERT.
- Communication cost accounts for 5.9% of total training time on ImageNet and 8.8% on SQuAD, indicating that reducing model size further improves efficiency.
- The multiplicative effect of reduced pipeline bubbles and increased data-parallel width leads to significant, non-additive speedups.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.