Pipeline bubble

On this page 7

A pipeline bubble is the idle time on accelerators in pipeline-parallel model training or inference, during which a pipeline stage has no work because it is waiting for activations or gradients from a neighboring stage. In AI infrastructure, the bubble is one of the main reasons why large distributed training jobs reach less than their theoretical throughput, and its size is a central input when engineers choose a parallelism layout.

The term comes from processor design, where a bubble is an empty slot in an instruction pipeline. In pipeline parallelism, the layers of a model are split across devices, so each device must wait for the previous one at the start of every step and for the next one at the end. Those fill and drain phases create the bubble.

Why pipeline parallelism creates bubbles

A pipeline bubble appears because stages depend on each other sequentially. Stage 2 cannot start its forward pass on a batch until stage 1 has finished, and stage 1 cannot run the backward pass until gradients flow back from the last stage. With a single large batch, only one device works at any moment, so a four-stage pipeline would leave about 75 percent of compute idle.

The standard remedy is to split each global batch into micro-batches. While stage 2 processes micro-batch 1, stage 1 can already process micro-batch 2. Idle time then remains only at the ramp-up at the start and the ramp-down at the end of each optimizer step, plus any waiting caused by uneven stages or slow communication.

The following table names the components that determine how large the bubble becomes in a real job.

FactorSymbol or measureEffect on the bubble
Number of stagespMore stages lengthen fill and drain
Micro-batches per stepmMore micro-batches amortize the bubble
Virtual stages per devicevInterleaving shortens each fill segment
Stage imbalanceSlowest stage timeThe slowest stage sets the pace for all
Point-to-point latencyTransfer time between stagesUnhidden transfers add idle gaps
Factors that determine bubble size

How the bubble fraction is calculated

For the classic GPipe schedule with equal stage times, the bubble fraction is approximately (p – 1) / (m + p – 1), the share of total step time spent idle. Equivalently, the bubble overhead relative to useful compute is (p – 1) / m. The formula shows the core trade-off: the bubble shrinks only when the number of micro-batches is much larger than the number of stages.

The table below shows the idle share for several typical configurations under that simple model, assuming perfectly balanced stages and fully overlapped communication.

Stages (p)Micro-batches (m)Idle share of step time
44About 43 percent
416About 16 percent
832About 18 percent
864About 10 percent
16128About 10 percent
Approximate bubble share for a GPipe-style schedule

Raising m is not free. More micro-batches mean a larger global batch size, which can hurt convergence, or smaller micro-batches, which use the accelerator less efficiently. In practice, teams aim for m at least four times p and accept a bubble in the range of 5 to 15 percent.

Schedules that reduce the bubble

Pipeline schedules differ mainly in how they order forward and backward passes, which changes bubble size, activation memory or both. Choosing a schedule is therefore a decision about which resource is scarcest.

ScheduleBubble behaviorMain trade-off
GPipeBubble of (p – 1) / m relative to computeStores activations for all micro-batches
1F1BSame bubble as GPipeActivation memory capped near p micro-batches
Interleaved 1F1BBubble reduced by the factor vMore point-to-point communication
Zero-bubble schedulesNear zero by splitting backward workComplex scheduling and optimizer handling
Bidirectional schedulesFills gaps by feeding both pipeline endsDuplicate parameters or higher memory
Common pipeline schedules compared

Zero-bubble scheduling splits the backward pass into the gradient with respect to inputs and the gradient with respect to weights. The weight-gradient work has no downstream dependency, so the scheduler can move it into slots that would otherwise be idle. Bidirectional designs such as the one described for DeepSeek-V3 also overlap communication with computation to hide transfer time.

Pipeline bubbles in the wider parallelism layout

Pipeline parallelism is rarely used alone. In 3D parallelism, it is combined with tensor parallelism inside a node and data parallelism across replicas. The bubble pushes engineers to keep the number of pipeline stages small and to use tensor parallelism or FSDP where the interconnect allows, because those methods have no fill-and-drain cost, although they communicate more.

  • Uneven layer splits create bubbles even with perfect schedules, so embedding and output layers are often placed carefully.
  • Activation recomputation lowers memory, which allows more micro-batches and thus a smaller bubble.
  • Slow inter-node links turn transfers into visible gaps unless they overlap with compute.
  • Inference pipelines also show bubbles, especially at low request concurrency during decoding.

Measuring and diagnosing bubble overhead

Bubble overhead shows up as a gap between achieved and theoretical throughput, often expressed through model FLOPs utilization. Profiling timelines from tools such as PyTorch Profiler or Nsight Systems reveal idle intervals per rank. A common mistake is to blame the bubble for every slowdown, when stragglers, data loading or collective communication may be the real cause.

Diagnosis starts by comparing measured idle time per stage with the theoretical bubble for the chosen schedule. Idle time well above the formula points to imbalance or communication; idle time concentrated on one rank points to a straggler device or an overloaded stage.

A non-technical view

Picture an assembly line with four workers in a row. Each worker does one step and passes the item on. At the start of the shift, the last worker waits until the first items arrive. At the end, the first worker has nothing left to do. Those waiting periods are the bubble.

Large AI models are trained the same way across many chips. Engineers cut the work into many small batches so that every worker stays busy most of the time. Clever ordering of tasks can make the waiting almost disappear.

A concrete example

A research team trains a 70-billion-parameter language model on 256 GPUs. It uses tensor parallelism of 8 within each node, pipeline parallelism of 8 stages across nodes, and data parallelism of 4. With 16 micro-batches per step and a plain 1F1B schedule, profiling shows that about 30 percent of each step is idle, close to the theoretical value of 7 divided by 23.

The team switches to an interleaved schedule with two virtual stages per GPU and raises the micro-batch count to 32 by enabling activation recomputation. The measured idle share falls to roughly 10 percent, and throughput per GPU rises by about a quarter. The cost is a modest increase in inter-node traffic, which the network handles without becoming the new bottleneck.