Layer-Parallel Training for Transformers
Shuai Jiang, Marc Salvado, Eric C. Cyr, Alena Kopaničáková, Rolf Krause, Jacob B. Schroder
TL;DR
The paper tackles the bottleneck of training very deep transformer models by introducing layer-parallel training via a neural ODE formulation and multigrid-in-time (MGRIT). By reinterpreting forward and backward passes as time stepping over layers and applying a coarsening factor $c_f$, the method exposes parallelism across the layer dimension while remaining compatible with data and model parallelism. A key contribution is an adaptive scheme that monitors gradient inexactness with a convergence factor and switches to serial gradients when needed to preserve convergence, enabling both speedups and accuracy on BERT, GPT-2, ViT, and MT pretraining tasks. The results show substantial parallel speedups with near-serial accuracy in many cases, and a practical switching mechanism to maintain reliable training dynamics, paving the way for scalable training of very deep foundation models.
Abstract
We present a new training methodology for transformers using a multilevel, layer-parallel approach. Through a neural ODE formulation of transformers, our application of a multilevel parallel-in-time algorithm for the forward and backpropagation phases of training achieves parallel acceleration over the layer dimension. This dramatically enhances parallel scalability as the network depth increases, which is particularly useful for increasingly large foundational models. However, achieving this introduces errors that cause systematic bias in the gradients, which in turn reduces convergence when closer to the minima. We develop an algorithm to detect this critical transition and either switch to serial training or systematically increase the accuracy of layer-parallel training. Results, including BERT, GPT2, ViT, and machine translation architectures, demonstrate parallel-acceleration as well as accuracy commensurate with serial pre-training while fine-tuning is unaffected.
