Interlocking Backpropagation: Improving depthwise model-parallelism

Aidan N. Gomez, Oscar Key, Stephen Gou, Nick Frosst, Jeff Dean, Yarin GalarXiv 2020

TL;DR

Training massive neural networks requires distributing computation across many accelerators, but existing methods either waste resources (global training) or sacrifice accuracy (local training). This paper introduces "interlocking backpropagation" (N-WISE), a novel approach that strikes a balance, significantly reducing training time while recovering most of the accuracy lost in local training.

What Problem Does This Paper Address?

The ever-increasing size of state-of-the-art neural networks, particularly in areas like natural language processing and computer vision, presents a significant challenge for training. These models often exceed the memory capacity of a single accelerator, necessitating distributed training strategies. Model parallelism, where different parts of the model are placed on different accelerators, is a common solution. However, traditional "end-to-end" model parallelism suffers from poor resource utilization because accelerators must wait for data to flow through the entire model, leading to idle time. On the other end of the spectrum, "local learning" allows each accelerator to train its part of the model independently, maximizing efficiency but often resulting in a substantial drop in model performance. This paper addresses the gap between these two extremes, aiming to achieve both computational efficiency and high model accuracy.

Methods

The core contribution of this paper is the introduction of "interlocking backpropagation," a family of strategies referred to as N-WISE training. This approach augments each module (a segment of the neural network on an accelerator) with an auxiliary classification head and a local loss function. During training, gradients from these local losses are allowed to propagate through a limited number of subsequent modules (defined by the parameter N) before stopping.

  • 1-WISE: This is equivalent to local learning, where gradients only flow within a single module, with no communication between modules.
  • N-WISE: Gradients from the auxiliary loss of module k are propagated through modules k to k + N - 1. This allows for a controlled flow of information and gradients between modules.
  • END-TO-END: This represents global learning, where gradients from the final loss function propagate through all modules.

By varying N, the authors can interpolate between the extreme efficiency of local learning (N=1) and the high accuracy of global learning (N=A, where A is the number of accelerators). The paper also explores combining interlocking backpropagation with micro-batching (similar to GPipe) for further speedups.

Datasets

The paper uses the following datasets for training and evaluation:

  • CIFAR-10: Used for training small convolutional networks and ResNet models.
  • CIFAR-100: Used for training small convolutional networks and ResNet models.
  • ImageNet: Used for training ResNet models.
  • One Billion Word Benchmark for Language Modelling: Used for training Transformer language models.

No new benchmarks were introduced; existing standard datasets were utilized.

Key Insights and Ideas

  • The "sweet spot" between local and global: The paper convincingly demonstrates that a middle ground exists between purely local and purely global training, offering a compelling trade-off between speed and accuracy.
  • Interlocking gradients enable better representation learning: By allowing gradients to flow through a limited number of modules, N-WISE training helps upstream modules learn representations that are more useful for downstream modules, mitigating the information loss seen in pure local training.
  • N-WISE is a flexible hyperparameter: The N parameter provides a tunable knob to balance computational efficiency and model performance, allowing practitioners to tailor the training strategy to their specific needs and resources.
  • Micro-batching and N-WISE are complementary: Combining interlocking backpropagation with micro-batching can yield even greater reductions in training time, suggesting a synergistic relationship.
  • Fixed-time perspective is crucial: When comparing training strategies, considering the total elapsed training time (rather than just the number of steps) reveals the significant advantages of faster methods like N-WISE.

Key Results

  • Significant Speedups: 2-WISE interlocking backpropagation achieved less than half the training step time of standard END-TO-END training for Transformer models with 4 modules.
  • Accuracy Recovery: N-WISE strategies consistently outperformed local learning (1-WISE) in terms of task performance. For example, on CIFAR-10 and CIFAR-100 with ResNets, 3-WISE and 4-WISE achieved comparable accuracy to END-TO-END training, within standard deviation.
  • Outperforming End-to-End in some cases: Surprisingly, 2-WISE training on ResNets for CIFAR-10 and CIFAR-100 outperformed END-TO-END training in terms of accuracy. This is attributed to the benefits of auxiliary losses, similar to findings in Inception Nets.
  • Transformer Performance: While N-WISE did not outperform baselines in language modeling tasks with Transformers, it still offered substantial improvements over local training and significantly reduced training time compared to END-TO-END.
  • Optimal N varies: The optimal value of N was found to depend on the model architecture and the number of accelerators, with smaller N values generally favoring speed and larger N values favoring accuracy.

Limitations and Future Work

  • Auxiliary Network Approximation Errors: For models with many modules, the approximation errors from auxiliary networks can lead to a performance gap between N-WISE and END-TO-END training.
  • Language Model Performance Gap: While N-WISE significantly reduces training time for Transformers, it did not consistently match the accuracy of END-TO-END training in these experiments.
  • Forward vs. Backward Pass Time: The timing model assumes forward and backward passes have equal duration, which is not always true. This could lead to an underestimation of END-TO-END learning speed.
  • Future Work: The authors suggest exploring the combination of interlocking backpropagation with other forms of model parallelism, such as tensor parallelism and pipeline parallelism, to further optimize training for large-scale models. They also highlight the need for automated frameworks to manage these complex parallelization strategies. The paper also mentions the potential of ensembling auxiliary network predictions, although their experiments showed this did not yield significant improvements.

Summary updated

BibTeX
@misc{gomez2020interlocking,
  author = {Aidan N. Gomez and Oscar Key and Stephen Gou and Nick Frosst and Jeff Dean and Yarin Gal},
  title = {{Interlocking Backpropagation: Improving depthwise model-parallelism}},
  year = {2020},
  eprint = {2010.04116},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.04116},
}
Figure