Fine-tuning giant neural networks on commodity hardware with automatic pipeline model parallelism

Saar Eliad, Ido Hakimi, Alon De Jagger, Mark Silberstein, Assaf Schuster

TL;DR

This paper introduces FTPipe, a novel system that enables fine-tuning of massive neural networks on commodity hardware by automatically creating a pipeline-parallel execution strategy. FTPipe's key innovation, "Mixed-pipe," relaxes traditional layer-based partitioning to better balance computational load across GPUs, leading to significant speedups without sacrificing accuracy.

What Problem Does This Paper Address?

The increasing size of state-of-the-art neural networks, particularly in Natural Language Processing (NLP), presents a significant challenge for researchers and engineers. While pre-trained giant models offer immense power, their sheer size often exceeds the memory capacity of a single commodity GPU, making fine-tuning (adapting these models to specific tasks) difficult or impossible without access to expensive supercomputing clusters. Existing solutions like data parallelism or traditional pipeline parallelism struggle with memory constraints and communication overheads on commodity hardware, leading to either slow training or an inability to fit the models at all.

Methods

FTPipe tackles this problem with a two-pronged approach:

  • Automatic Pipeline Generation: FTPipe automatically transforms a sequential PyTorch model into a multi-GPU pipeline-parallel version. This involves tracing the model's computational graph, profiling each component's memory and execution time, and then partitioning and assigning these components to GPUs.
  • Mixed-pipe Partitioning: This is FTPipe's core innovation. Unlike traditional "Seq-pipe" methods that partition models strictly by layers, Mixed-pipe allows for more flexible partitioning. It can group arbitrary computational blocks (not necessarily contiguous layers) onto the same GPU. This flexibility is crucial for balancing the computational load across GPUs, especially for complex architectures like encoder-decoders where different parts of the model have varying computational demands. This approach prioritizes load balancing over strict adherence to the original network topology.
  • Asynchronous Training: FTPipe leverages asynchronous training, allowing subsequent mini-batches to start processing before previous ones have fully completed. While this can introduce "staleness" (using slightly outdated model weights), the authors argue that for large, pre-trained models, this staleness has a negligible impact on final accuracy, especially when combined with techniques like careful checkpointing and recomputation to manage memory.

Datasets

The paper evaluates FTPipe on a variety of tasks and datasets commonly used for fine-tuning large NLP models:

  • Natural Language Inference (NLI): RTE
  • Word Sense Disambiguation (WSD): WiC
  • Question Answering (QA): SQuAD, MultiRC, BoolQ
  • Language Modeling (LM): WikiText2

Key Insights and Ideas

  • Load Balancing is Key for Commodity GPUs: The paper strongly emphasizes that for commodity hardware, balancing the computational load across GPUs is often more critical than minimizing inter-GPU communication. Mixed-pipe's ability to break traditional layer-based partitioning is the enabler for this.
  • Staleness is Manageable for Fine-Tuning: Contrary to initial intuition, the authors demonstrate that the staleness introduced by asynchronous training in large, pre-trained models does not significantly degrade performance. This is attributed to factors like starting with pre-trained weights, lower learning rates, and smoother loss landscapes in large models.
  • Flexibility Trumps Topology: Relaxing the strict layer-by-layer partitioning constraint (Seq-pipe) to allow for more arbitrary grouping of operations (Mixed-pipe) leads to better memory utilization and computational load balancing, ultimately resulting in faster training.
  • Automatic Partitioning is Essential: The complexity of partitioning giant models makes manual or exhaustive approaches infeasible. FTPipe's automatic generation of optimized pipeline configurations is a critical practical contribution.

Key Results

  • Significant Speedups: FTPipe achieves up to 3x speedup compared to GPipe (a synchronous Seq-pipe baseline) in fine-tuning giant models like T5-3B.
  • State-of-the-Art Accuracy: Despite using asynchronous training and a more flexible partitioning scheme, FTPipe consistently achieves accuracy comparable to or better than the baselines.
  • Enabling Previously Impossible Tasks: FTPipe allows fine-tuning of models like T5-3B and T5-11B on commodity GPUs (8x RTX2080-Ti with 11GB memory), which were previously untrainable on such hardware.
  • Mixed-pipe Benefits: The Mixed-pipe partitioning scheme alone provides speedups of up to 1.2x over Seq-pipe for synchronous pipelines and significantly more for asynchronous ones.

Limitations and Future Work

  • Scalability Beyond Single Machine: The current work focuses on a single machine with multiple GPUs. The authors suggest future work to scale FTPipe beyond single-machine boundaries.
  • Incorporating Data Parallelism: Exploring how to integrate data-parallel components with FTPipe could further enhance efficiency.
  • Broader Applicability: While the paper focuses on NLP, the authors believe the principles of Mixed-pipe could be valuable for training other types of large neural networks.
  • Non-NLP Applications: The paper suggests extending FTPipe's value to non-NLP communities.

Summary updated

BibTeX
@inproceedings{eliad2021fine,
  author = {Saar Eliad and Ido Hakimi and Alon De Jagger and Mark Silberstein and Assaf Schuster},
  title = {{Fine-tuning giant neural networks on commodity hardware with automatic pipeline model parallelism}},
  booktitle = {USENIX ATC},
  year = {2021},
}
Figure