What this method splits, and what it must communicate
The two questions first.
What PP splits: the layer. PP, or Pipeline Parallelism, gives each machine a bundle of consecutive layers of the model. Machine 0 takes layers 0 to 11, machine 1 layers 12 to 23, and so on. Each machine therefore holds only the weights, gradients and optimizer states of its own layers: model memory is divided by the number of stages.
What it must communicate: one boundary activation, from one machine to its neighbour. When machine 0 finishes layer 11, it sends the result (the array of numbers coming out of that layer) to machine 1, which picks up at layer 12. On the backward pass the gradient travels the other way, boundary by boundary.
Two remarkable properties of that exchange, and they are what makes PP worth having:
- It is tiny. What travels is neither weights nor weight gradients, but the trace of one batch at a single point in the network: batch size times sequence length times hidden dimension. Nothing to do with the size of the model.
- It is point-to-point. One machine talks to one neighbour, not to all of them. This is not a collective operation like the all-reduce of data parallelism or tensor parallelism; it is a plain send.
That is why PP is the split you let cross the slow network between machines, where tensor parallelism cannot go.
PP pays for that frugality another way. The stages are in series: machine 1 can do nothing until machine 0 has handed it something. Naively, one stage works at a time and all the others wait. That idle time is called the bubble, and it is the central subject of this page.
The problem, as an assembly line
Eight workstations in series assembling a product. You send one part down the line: station 1 works for ten seconds, hands the part to station 2, and while station 2 works, stations 3 to 8 do nothing. Seven stations out of eight are idle at any instant.
That is exactly what happens if you naively spread a model across eight machines: while machine 0 processes the batch, the other seven sleep; then it is machine 0's turn to sleep. The expensive machine is busy one eighth of the time.
PP's remedy is the industrial one: send not a single part but a stream. You cut the batch into 4, 8, 16 micro-batches and feed them into the line one behind the other. While machine 0 processes micro-batch 2, machine 1 processes micro-batch 1 and machine 2 micro-batch 0. Everyone works at once, on different parts.
How the layers are handed out
For a model of layers on stages, each stage takes about consecutive layers. A 96-layer model on 8 machines:
- machine 0: layers 0 to 11
- machine 1: layers 12 to 23
- ...
- machine 7: layers 84 to 95

The bubble, worked out
The word "bubble" explains nothing on its own. Let us do the arithmetic.
Let be the number of stages, the number of micro-batches, and the time one stage needs to process one micro-batch. The pipeline advances in slots of duration .
How many slots does it take in total? The last stage cannot start its first micro-batch until that micro-batch has passed through the preceding stages: it starts at slot . From then on it runs through the micro-batches without interruption. So the pipeline finishes at slot:
where is the fill-up (the slots during which the last stage has received nothing yet) and is the steady state.
How many slots would it ideally take? If all stages worked from the first instant to the last, it would take , not one more.
The bubble is the difference, as a fraction of the total:
In one sentence: you lose the slots spent filling and draining the pipeline, that is slots, out of a total of .
The arithmetic in plain numbers, on four machines
Four stages, and a batch that takes 10 seconds of computation per stage. With no splitting, so :
- Total time: seconds.
- Each machine works 10 seconds out of 40. Three quarters of the time lost: .
Now cut the same batch into 8 micro-batches. Each micro-batch is eight times smaller, so each stage now spends only seconds on it:
- Total time: seconds.
- Ideal time: seconds.
- Loss: , which is indeed .
The same work goes from 40 seconds to 13.75 just by splitting the batch. And nothing about the computation itself has changed: what was removed is idle time, not work.
| stages | micro-batches | Fraction lost |
|---|---|---|
| 4 | 1 | 75% |
| 4 | 8 | 27% |
| 8 | 8 | 47% |
| 8 | 32 | 18% |
| 8 | 128 | 5% |
Since the bubble is , it depends only on the ratio between the number of micro-batches and the number of stages. So you aim for well above , at least four times, in practice. What the formula also says, and what people forget: adding stages makes the bubble worse at a fixed number of micro-batches. PP does not scale indefinitely.
Splitting the batch into micro-batches does not change the effective batch over which the weights get updated: the gradients of the micro-batches are accumulated and the correction is applied once. The mechanism is the same as gradient accumulation, and it therefore leaves the learning dynamics untouched. That is what makes this remedy free from the model-quality point of view.
The two schedules, and what separates them
The number of slots is the same in both cases. What changes is memory, because the order in which you interleave forward and backward passes decides how long activations must be kept.
GPipe: all the forward passes, then all the backward passes
This is the most intuitive schedule, and the first published: run the forward passes, then the backward passes.
GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism (Huang et al., 2018)Advantage: simple to write and to understand. It is the paper that established batch splitting as the remedy for the bubble, and it reports "almost linear" speedup as accelerators are added. The authors apply it, among other things, to a 6-billion-parameter, 128-layer transformer trained on more than a hundred languages.
Drawback, and it is structural: a backward pass needs the activations produced by its own forward pass. If you run all the forward passes first, you have to keep the activations of all micro-batches in memory at once. Activation memory therefore grows in proportion to , that is, in proportion to the very lever you are using to reduce the bubble.
Raising reduces the bubble and raises activation memory, in the same proportion. You end up choosing between machines that wait and machines that run out of memory. It is exactly that deadlock the next schedule breaks.
1F1B: alternate, so memory frees up early
1F1B stands for one forward, one backward. Instead of separating the two phases, each stage alternates: a forward pass on a recent micro-batch, then immediately a backward pass on an older one, and so on.
The effect is that micro-batch 1's backward pass arrives very early (as soon as the pipeline is full) and frees its activations right away. In steady state, a stage holds the activations of only about micro-batches at a time, instead of .
With and : times less activation memory, for exactly the same bubble, since the number of slots is unchanged. That is a gain with no counterpart, which is why 1F1B is the default today.
The alternation was introduced by PipeDream. One caveat, though: in its original form PipeDream lets each stage move ahead without waiting for the others, which requires keeping several versions of the weights. The variant used in today's reference frameworks is synchronous (it stops the whole pipeline at each step to apply a single update, as the black bar in the diagram below shows) and it is therefore mathematically identical to training on a single machine.
PipeDream: Fast and Efficient Pipeline Parallel DNN Training (Harlap et al., 2018)
On that diagram, the black bar is the pipeline flush: the moment every stage stops so the weight update can be applied. It is the visual translation of the drain slots counted above.
Interleaved 1F1B: shrinking the bubble from another angle
The formula says the bubble shrinks if grows. It also shrinks if you increase the number of passes through the pipeline without adding machines.
The idea: instead of giving a machine one bundle of consecutive layers, give it several non-consecutive bundles. With 4 machines and 8 bundles, machine 0 holds bundles 0 and 4, machine 1 bundles 1 and 5, and so on. A micro-batch then makes two laps of the four machines. The pipeline has 8 logical stages on 4 physical machines, and since each stage is half as long, the fill-up slots are half as long too.
The price is the number of exchanges: each micro-batch crosses the network twice as often.

The Megatron-LM authors report that their interleaved schedule improves throughput by more than 10% at comparable memory footprint. The same paper reports training a one-trillion-parameter model at 502 petaFLOP per second on 3,072 A100 cards, i.e. 52% of theoretical peak per card.
Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM (Narayanan et al., 2021)Going further: removing the bubble
A zero bubble was long thought impossible under synchronous training. A 2024 result achieves it by splitting the backward pass into two distinct operations, the one that computes the gradient of the input, needed to keep travelling back down the chain, and the one that computes the gradient of the weights, which can wait. The second then serves as filler for the empty slots.
The authors report throughput up to 23% higher than 1F1B at comparable memory, and up to 31% higher when the memory constraint is relaxed.
Zero Bubble Pipeline Parallelism (Qi et al., 2024)What PP costs in memory, and what it saves
Three effects, not to be confused.
| Item | Effect of PP |
|---|---|
| Weights, gradients, optimizer states | divided by : each stage holds only its own layers |
| Activations to keep | unchanged per layer, but multiplied by the number of micro-batches in flight, the point 1F1B fixes |
| Boundary activations to transmit | negligible: one tensor per boundary per micro-batch |
The first effect is PP's whole reason for existing. The accounting of the three fixed items, 12 bytes per parameter, i.e. 84 GB for a 7-billion model before the first activation, is established in ZeRO; PP divides that figure by the number of stages, just as FSDP divides it by the number of cards, but through a different mechanism.
For the second effect, PP composes naturally with activation recomputation: keep only the boundary activations and recompute the rest during the backward pass.
Composing with the other splits
PP is never used on its own. Its place in the hierarchy follows directly from the nature of its exchange, small and point-to-point.
- Tensor parallelism, inside one machine: the eight NVLink-connected cards share every matrix. Its all-reduce is in the middle of the computation, so it demands the fastest link.
- PP, between machines: stages hand each other a boundary activation over the network. It is the only split that tolerates that slower hop.
- Data parallelism, on top: the complete pipeline is replicated to process several batches.
An illustrative configuration for 512 cards across 64 machines of 8:
- TP degree = 8, inside each machine;
- PP degree = 8, across 8 machines in series;
- DP degree = 8, i.e. 8 replicas of the complete pipeline;
- total: .
Compare the two exchanges. PP sends one activation tensor to one machine, once per boundary per micro-batch, and it can do so while the machine is already computing something else. Tensor parallelism does an all-reduce across all the cards in the group, four times per layer, and it has to be waited on.
You do have to compare the links in the same unit, which is the classic error: network links are advertised in gigabits per second, internal buses in gigabytes per second, and a byte is eight bits. NVLink 4 is advertised at 900 GB/s, InfiniBand NDR at 400 Gbit/s, i.e. 50 GB/s: a ratio of roughly 18, not 2. The details are in Scaling infrastructure.
The full three-dimensional grid is described in Megatron-LM.
When to use PP
PP becomes necessary when the model does not fit on the cards of one single machine, even with tensor parallelism at its maximum degree. Below that, FSDP or ZeRO are enough and are far simpler to configure, because they have no bubble at all.
So the decision criterion is simple: PP is what you add in order to cross the machine boundary without sending an exchange that could not survive it over the slow network.
Summary
Pipeline parallelism splits the layers: each machine takes a consecutive bundle and holds only its own weights. What it communicates is the smallest thing imaginable (one boundary activation, from one machine to its neighbour, point-to-point) and that is why it is the split that crosses the network between machines.
Its own defect is the bubble, and it can be computed: , because it takes slots to fill the pipeline before the last stage starts. With 4 stages and an unsplit batch you lose three quarters of the time; splitting that same batch into 8 micro-batches brings the loss to 27% and the step from 40 seconds to 13.75. So the remedy is to multiply micro-batches, and the 1F1B schedule is what lets you do it without activation memory following along, by freeing each micro-batch as soon as its backward pass is done.
1. Eight machines in series share a model's layers. With no further precaution, what problem appears, and what is the remedy?
2. With 4 stages and an unsplit batch, what fraction of the time is lost, and why?
3. Does splitting the batch into 16 micro-batches change how the model learns?
4. What does the 1F1B schedule improve over GPipe?
5. Why is pipeline parallelism the split you send across the slow network between machines?