GPipe improves model-parallel training by splitting each batch into microbatches and overlapping their computation across subnetworks on different GPUs. It accumulates gradients for all microbatches before synchronously updating parameters, keeping accelerators busy instead of leaving most idle. section 4.4.2
A GPipe training workflow:
- Partition the network across GPUs. section 4.4.2
- Divide each training batch into smaller microbatches and pipeline their forward passes. section 4.4.2
- Run backward passes using the same parameters, accumulate every microbatch’s gradients, then apply one synchronized update. section 4.4.2
Four-stage pipeline
A four-subnetwork model places one subnetwork on each GPU. Four equal microbatches move through the stages, allowing different GPUs to compute simultaneously while gradients accumulate until the training step ends. section 4.4.2
Figure 4.8 (a) An example neural network with sequential layers is partitioned across four accelerators. Fk is the composite forward computation function of the kth cell. Bk is the backpropagation function, which depends on both Bk+1, from the upper layer, and Fk. (b) The naive model parallelism strategy leads to severe under utilization due to the sequential dependency of the network. (c) Pipeline parallelism divides the input minibatch into smaller microbatches, enabling different accelerators to work on different microbatches simultaneously. Gradients are applied synchronously at the end. (Source: figure 2, “GPipe: Easy Scaling with Micro-Batch Pipeline Parallelism,” Huang et al., 2019, arXiv:1811.06965)
Use the pipeline diagram to compare idle-heavy naive model parallelism with microbatch overlap and synchronous gradient application. section 4.4.2

