When training massive deep learning models that exceed the memory capacity of a single accelerator, pipeline parallelism offers a clean solution: partition the model's layers sequentially across a cluster of devices and stream data through them in micro-batches. However, a naive execution strategy quickly runs into a fundamental hardware bottleneck: pipeline memory imbalance.
While the cluster might have more than enough aggregate memory to hold the model, individual devices—particularly those at the beginning of the pipeline—frequently run out of memory (OOM). Understanding why this imbalance occurs, and how recent architectures resolve it, is key to scaling modern foundation models.
The Root Cause: Activation Lifespan Skew
To understand why memory accumulates unevenly, we must look at the "lifespan" of an activation tensor. As explained by Zhao et al., during the forward pass, each layer generates intermediate activations that must be saved because they are required later to calculate gradients during the backward pass.
Qi et al. formalize this lifespan as the temporal interval between the start of a micro-batch's forward pass and the completion of its corresponding backward pass.
Linear Pipeline Schedule:
Device 1 (Stage 1): [Forward MB1] ------------------------------------------> [Backward MB1] (Long Lifespan)
Device 2 (Stage 2): [Forward MB1] --------------------------> [Backward MB1]
Device 3 (Stage 3): [Forward MB1] ------------> [Backward MB1]
Device 4 (Stage 4): [Forward MB1][Backward MB1] (Short Lifespan)
In a standard linear pipeline, a micro-batch enters Device 1, moves forward through the chain to the final device, computes the loss, and then the backward gradients propagate all the way back to Device 1. As a result, Device 1 must hold onto the activations of the first micro-batch for nearly the entire duration of the pipeline round-trip.
To keep the hardware fully utilized and avoid idle time ("bubbles"), the system must continuously feed new micro-batches into the early stages. This creates a steep "memory ramp" where the initial devices are forced to store activations for numerous concurrent micro-batches simultaneously, while later devices remain largely underutilized (Kim et al.; Zhang et al.). The peak memory of the most burdened device limits the maximum batch size or model size the entire cluster can support.
Rescheduling the Micro-Batch Sequence
The most direct way to flatten this memory ramp is to alter the sequence of forward and backward operations so that activations are consumed and discarded more quickly.
An early foundational approach is the 1F1B (One Forward, One Backward) schedule, highlighted in frameworks like PipeDream-2BW (Narayanan et al.). Instead of running all forward passes for a steady state before starting backward passes, 1F1B alternates between a single forward and a single backward pass for different micro-batches, putting a strict upper bound on the number of active un-allocated activations stored at any one time.
To smooth out memory peaks even further, Fournier et al. introduce a strategy that staggers the start times of data micro-batches with a uniform delay. By ensuring that different workers are at entirely different phases of execution at any given moment, the system prevents simultaneous peaks in activation memory, reducing the aggregate peak footprint by nearly half.
Staggered Execution:
Worker 1: [Peak Memory Phase] ------------> [Low Memory Phase]
Worker 2: [Low Memory Phase] ------------> [Peak Memory Phase]
(Aggregate memory remains flat rather than spiking simultaneously)
Alternatively, Zhang et al. propose a First-In-Last-Out (FILO) micro-batch schedule. By structuring the schedule so that the backward passes occur in the exact reverse order of the forward passes, the schedule ensures that every pipeline stage stores a comparable number of activations over time. This effectively eliminates the memory ramp-up effect seen in traditional schedules. Qi et al. similarly demonstrate that non-linear scheduling patterns can distribute active micro-batches more uniformly across the hardware cluster to balance peak memory usage.
Symmetric Stage Mapping
Instead of changing the time at which micro-batches execute, another powerful intuition is to change where the model layers are physically mapped. If early pipeline stages have long activation lifespans and late pipeline stages have short activation lifespans, we can pair them together on the same physical device to balance the load.
Symmetric Folding:
Physical Device 1: [ Stage 1 (Long Lifespan) ] + [ Stage 8 (Short Lifespan) ]
Physical Device 2: [ Stage 2 (Medium-Long) ] + [ Stage 7 (Medium-Short) ]
Qi et al. implement this via a technique called symmetric stage mapping. By partitioning a model into more virtual stages than available physical devices and folding the pipeline layout, both early and late stages reside on the same hardware unit. The long activation storage requirements of the early stages are naturally offset by the short storage requirements of the later ones.
This concept of geometric balancing is echoed by Cheng et al., who show that symmetrically swapping computation blocks across devices distributes activation memory more evenly than traditional linear pipelines, preventing edge devices from becoming premature bottlenecks.
Bidirectional Pipelines and Memory Pooling
A third paradigm shifts the focus toward structural symmetry and dynamic resource sharing across the cluster.
Li et al. introduce Chimera, a framework that deploys bidirectional pipelines. By running two identical pipeline loops in opposite directions simultaneously across the same hardware cluster, the memory ramp of one pipeline is perfectly mirrored and cancelled out by the memory ramp of the other. (This concept of bidirectional processing to achieve balanced memory distribution across pipeline stages also shares structural roots with hardware routing architectures, such as the SRAM-based IP lookup pipelines designed by Jiang et al.).
Bidirectional Pipeline (Chimera):
Pipeline A: [Stage 1 (Max Mem)] -> [Stage 2] -> [Stage 3] -> [Stage 4 (Min Mem)]
Pipeline B: [Stage 4 (Min Mem)] <- [Stage 3] <- [Stage 2] <- [Stage 1 (Max Mem)]
Total Mem: [ Balanced ] [Balanced] [Balanced] [ Balanced ]
When scheduling and mapping modifications are still not enough to prevent a memory crash, systems can treat the cluster's memory as a collective resource. Kim et al. develop BPipe, a system that actively transfers intermediate activations away from memory-constrained early GPUs to underutilized later GPUs via high-speed interconnects. This cross-device activation offloading treats the aggregate memory of the cluster as a shared pool, allowing bottlenecked stages to "borrow" memory from idle neighbors and support larger batch sizes.
Asymmetric and Adaptive Partitioning
Finally, some approaches accept that memory demands are inherently unequal and argue that our optimization strategies must be equally asymmetric.
Traditional pipeline partitioning algorithms often divide model layers based strictly on balancing computation time, which frequently leads to severe memory imbalances (Wang et al.). To resolve this, Wang et al. propose a bi-objective optimization strategy that iteratively adjusts pipeline boundaries, intentionally creating asymmetric execution blocks to ensure that no single stage exceeds its physical memory limit.
This philosophy extends to memory-saving techniques like activation recomputation (where activations are discarded and re-calculated on the fly during the backward pass). Rather than applying recomputation uniformly across all layers, Lai demonstrates that applying non-uniform activation recomputation based on local memory availability eliminates unnecessary computational overhead in stages that have plenty of idle memory to store activations natively.
Similarly, in the context of local learning frameworks, Ren et al. show that deliberately redistributing computational load and channel counts across network stages optimizes the memory footprint, ensuring that early layers do not consume a disproportionate share of the system's resources.
Key Foundational Work
Multi-terabit ip lookup using parallel bidirectional pipelines (2008) — contributed 2 concept elements to this direction.
LoCo: Local Contrastive Representation Learning (2020) — contributed 1 concept elements to this direction.