← All projects

Research / Distributed Optimization

First Theory for PipeDream

Randomized PipeDream captures PipeDream's stale-weight behavior in an analyzable block-SGD model, revealing how pipeline depth affects convergence.

Preprint2026
A fully occupied four-stage PipeDream 1F1B schedule highlighting one microbatch's forward and backward path and the interval of stage-1 weight stashing

Large models are often too big to train on one accelerator. PipeDream tackles this by splitting the model into sequential stages and keeping them busy with overlapping microbatches. The pipeline runs efficiently—but it creates a striking paradox: an update can be computed from a model that never existed as one coherent parameter vector. Each stage reuses the weights that a microbatch saw during its forward pass, but that microbatch reaches different stages at different moments. By the time backpropagation returns, its stage-local snapshots belong to several points in the training history.

This project asks an optimization question about that schedule: how do PipeDream’s stale weights affect convergence, and how does their impact scale with pipeline depth?

In joint work with Peter Richtárik, we introduced Randomized PipeDream (RPD), a mathematical model that keeps PipeDream’s stage-wise staleness while replacing the exact schedule with randomized block updates. That simplification makes the mechanism analyzable. In the resulting preprint, we give the first clean nonconvex convergence guarantee for a randomized PipeDream-style method and derive how delay grows under the deterministic schedule. The analysis also points to LocalSGD as an alternative: it avoids this particular stale-read mechanism, but pays for periodic synchronization and replica drift.

Why pipeline parallelism has bubbles

A large neural network is already a chain of computational blocks. Pipeline parallelism splits that chain into SS ordered stages, places each stage on a different accelerator, and sends activations forward and gradients backward through them. This solves a memory problem: no single device needs to hold the entire model.

With only one microbatch in flight, however, the computation follows a strict dependency chain. Stage 2 cannot begin until stage 1 produces an activation, and the backward pass cannot begin until the final stage produces the loss. In the idealized four-stage schedule below, only one GPU works at a time, leaving three quarters of the available device-time idle.

Four-stage pipeline timeline with one forward and one backward diagonal; only 8 of 32 GPU-time cells are active
A single microbatch uses 25% of the available GPU-time cells in this equal-cost four-stage model. This is scheduling intuition, not a hardware benchmark.

Real hardware also pays for communication, stage imbalance, kernel execution, and framework overhead. The 25% figure is therefore not a universal utilization formula; it isolates the bubble created by the forward/backward dependency chain.

PipeDream fills the bubbles—but creates stale weights

PipeDream fills much of the bubble by admitting new microbatches before older ones have finished. After startup, each stage alternates between one forward and one backward operation, a schedule known as 1F1B. Under the same equal-cost model, the steady region can be fully occupied. The schedule turns idle time into throughput.

It also changes which parameters are used to compute a gradient.

Suppose a microbatch performs its forward operation on stage 1. PipeDream saves that stage’s parameter version and reuses it when the microbatch eventually returns for the backward operation. This mechanism, called weight stashing, preserves forward/backward consistency within the stage.

But many other backward operations update the pipeline while the microbatch is in flight. The microbatch also visited each stage at a different time. Its gradient is therefore not naturally associated with one old global checkpoint; it is associated with a mixture of historical stage blocks.

To measure this precisely, let kk count individual backward block updates anywhere in the pipeline, rather than pipeline clock ticks. In a four-stage 1F1B simulation, the exact delays settle into a periodic pattern after warm-up:

Line chart of exact global-history delay for four PipeDream stages; the delays become periodic and stage 1 reaches 14 block updates
Exact delay in a four-stage simulated 1F1B schedule. The first stage can be 14 block updates behind, and the stage-dependent pattern becomes periodic after warm-up.

These delays are not random accidents. They are determined by the forward/backward geometry of the pipeline, unlike a generic asynchronous system in which any worker may return at any time.

How one gradient can mix several versions of the model

To describe that mixed model mathematically, start from the finite-sum objective

minwRdf(w),f(w)=1Mm=1Mfm(w),\min_{w\in\mathbb{R}^d} f(w), \qquad f(w)=\frac{1}{M}\sum_{m=1}^{M}f_m(w),

and split the model into the same SS blocks used by the pipeline:

w=(w(1),,w(S)),w(s)Rds,s=1Sds=d.w=\left(w^{(1)},\ldots,w^{(S)}\right), \qquad w^{(s)}\in\mathbb{R}^{d_s}, \qquad \sum_{s=1}^{S}d_s=d.

Let wkw_k be the current model after kk block updates. For each stage ss, the index jk(s)j_k^{(s)} records the earlier global iteration from which the stale read takes that stage’s parameters. The gradient is evaluated at

zk=(wjk(1)(1),,wjk(S)(S)).z_k= \left( w_{j_k^{(1)}}^{(1)}, \ldots, w_{j_k^{(S)}}^{(S)} \right).

The essential point is that zkz_k need not equal any past full iterate wtw_t. It can take stage 1 from one moment, stage 2 from another, and so on. We assume only that every block is at most δ\delta global block updates old:

0kjk(s)δfor every stage s.0\le k-j_k^{(s)}\le\delta \qquad\text{for every stage }s.

This mixed model assembled from different moments in history is the part of PipeDream that RPD preserves.

Randomized PipeDream keeps the staleness, not the schedule

Exact PipeDream ties together which stage runs, which microbatch it handles, and which historical weights it sees. That makes the deterministic 1F1B timeline difficult to analyze. RPD keeps the mixed stale model but replaces this coupled schedule with a simpler randomized update.

At update kk, RPD first selects a bounded delay vector and forms zkz_k. Given that stale model, it samples a stage sks_k and mini-batch mkm_k uniformly, then updates only the selected block:

wk+1(sk)=wk(sk)γw(sk)fmk(zk),w_{k+1}^{(s_k)} = w_k^{(s_k)} -\gamma\nabla_{w^{(s_k)}}f_{m_k}(z_k),

while every other block remains unchanged.

The delays themselves do not need to be uniformly random; they may depend on the history. What matters is that they are fixed before the current stage/mini-batch draw, bounded by δ\delta, and followed by a conditionally uniform stage/mini-batch sample.

RPD is a lens for analysis, not a scheduler intended to run on hardware. Deterministic PipeDream does not sample its stages and microbatches uniformly. The connection back to the real system comes from deriving the delay scale produced by its actual scheduling rule.

What we can prove about RPD

Suppose ff is lower bounded and LL-smooth, the component block gradients along the stale trajectory are bounded by GG, the delay is at most δ\delta, and 0<γ1/L0<\gamma\le 1/L. If Δ0=f(w0)f\Delta_0=f(w_0)-f_\star, then after KK block updates RPD satisfies

1Kk=0K1E ⁣[f(wk)2]2SΔ0γK+γSLG2+γ2L2δ2G2.\frac{1}{K}\sum_{k=0}^{K-1} \mathbb{E}\!\left[\lVert\nabla f(w_k)\rVert^2\right] \le \frac{2S\Delta_0}{\gamma K} +\gamma SLG^2 +\gamma^2L^2\delta^2G^2.

Each term tells a different part of the story:

  • 2SΔ0/(γK)2S\Delta_0/(\gamma K) is the optimization term; it shrinks with the update budget.
  • γSLG2\gamma SLG^2 is the stochastic single-block update term.
  • γ2L2δ2G2\gamma^2L^2\delta^2G^2 is the stale-read term. Its quadratic dependence on δ\delta determines how pipeline depth enters the result.
Randomized PipeDream convergence bound separated into optimization, stochastic, and stale-read terms
The RPD bound isolates the stale-read penalty in blue. The distinction is essential: this is a theorem for the randomized abstraction, not the exact deterministic schedule.

Two observations do most of the work in the proof. First, uniform stage/mini-batch sampling makes the selected block update an unbiased full-gradient direction at zkz_k, up to the factor 1/S1/S. Second, at most δ\delta intervening updates of length at most γG\gamma G imply

wkzkγδG.\lVert w_k-z_k\rVert\le\gamma\delta G.

Smoothness turns that parameter discrepancy into a gradient discrepancy; squaring it produces the characteristic δ2\delta^2 term.

With the tuned step size

γ=min ⁣{1L,2Δ0LG2K},\gamma= \min\!\left\{ \frac{1}{L}, \sqrt{\frac{2\Delta_0}{LG^2K}} \right\},

the rate becomes

O ⁣(SK+δ2K).\mathcal{O}\!\left( \frac{S}{\sqrt{K}} +\frac{\delta^2}{K} \right).

A small average squared gradient norm means that the iterates are close to first-order stationarity on average. It does not imply that RPD reaches a global optimum of a nonconvex objective.

PipeDream’s delay grows quadratically with pipeline depth

We can now ask what value of δ\delta corresponds to deterministic PipeDream. In steady-state 1F1B, take a stage-1 forward event and the matching stage-1 backward event. A microbatch must traverse the remaining stages and return, spanning roughly 2S12S-1 pipeline slots. Every backward block update during that round trip advances the global history, so the delay grows with the area of the intervening schedule:

Steady-state PipeDream schedule with an S by 2S minus 1 highlighted region used to count the worst stage delay
The worst stage spans a region of height SS and width 2S12S-1; about half of its cells contain backward updates, each of which advances the global history.

Using the paper’s convention for ordering updates within each pipeline slot, the steady-state delay is

δPD=S2S2+O(1).\delta_{\mathrm{PD}} = S^2-\frac{S}{2}+\mathcal{O}(1).

For even SS, the expression is exact:

δPD=S2S2.\delta_{\mathrm{PD}}=S^2-\frac{S}{2}.

So four stages give a worst delay of 1414 block updates, matching the earlier trace, while eight stages give 6060.

Substituting δPD=Θ(S2)\delta_{\mathrm{PD}}=\Theta(S^2) into the RPD theorem makes the raw stale-read contribution scale as Θ(γ2S4)\Theta(\gamma^2S^4). With the tuned step size, the RPD proxy for PipeDream has the form

O ⁣(SK+S4K).\mathcal{O}\!\left( \frac{S}{\sqrt{K}} +\frac{S^4}{K} \right).

The theory exposes a tension: deeper pipelines create more parallel work, but their gradients can be built from increasingly old stage weights.

Does RPD behave like PipeDream?

The abstraction is only useful if it retains something important about the original method. As a sanity check, we compare a deterministic PipeDream simulation with RPD on a controlled random quadratic objective.

Log-scale convergence curves for deterministic PipeDream and Randomized PipeDream at eight stages; RPD with delay 60 follows the PipeDream trajectory
On this simple quadratic with S=8S=8, RPD at the predicted delay δ=60\delta=60 closely tracks the deterministic PD simulation. Much larger delays slow RPD substantially.

This experiment does not show that RPD reproduces every PipeDream trajectory. It supports the narrower claim that the abstraction captures an important stale-weight effect in this controlled setting.

Our proposed alternative: stage-distributed LocalSGD

The scaling law led us to propose a different way to keep the pipeline busy: apply LocalSGD across several complete model trajectories. Instead of letting one trajectory accumulate cross-stage staleness, the system maintains RR replicas. Each replica performs HH local SGD steps, after which the corresponding stage blocks are averaged:

wˉq(s)=1Rr=1Rwq,r(s),wq,r(s)wˉq(s).\bar{w}_q^{(s)} = \frac{1}{R}\sum_{r=1}^{R}w_{q,r}^{(s)}, \qquad w_{q,r}^{(s)}\leftarrow\bar{w}_q^{(s)}.

The replicas are partitioned across the same SS pipeline stages and interleaved through the schedule. More trajectories provide independent work that can occupy otherwise empty slots:

Four LocalSGD schedules showing one through four trajectories packed into a four-stage pipeline; utilization rises but synchronization bubbles remain
At H=1H=1, interleaving more trajectories makes the schedule denser, but the averaging boundary still creates a synchronization bubble.

The synchronization period HH controls the trade-off:

  • With small HH, replicas stay close, but frequent averaging creates more fill-and-drain bubbles.
  • With large HH, synchronization happens less often and utilization improves, but replicas drift farther apart before averaging.

This removes PipeDream-style cross-stage staleness, but not every source of delay or error. It also requires memory for RR logical model copies. The experiments use R=SR=S to keep the pipeline highly utilized, and their optimization/time comparisons do not count this extra memory as a separate resource cost.

Compare failure modes, not universal winners

To compare the theories under a common block-update budget, let TT be the number of logical local steps per replica. Since each step updates all SS blocks for each of RR replicas,

K=RST.K=RST.

With R=SR=S, the tuned LocalSGD guarantee becomes

O ⁣(SK+S3H2K).\mathcal{O}\!\left( \sqrt{\frac{S}{K}} +\frac{S^3H^2}{K} \right).

The two theories expose different weaknesses:

ModelMain systems benefitMain optimization penaltyAdditional systems cost
RPD proxy for PDKeeps the 1F1B pipeline busyCross-stage stale reads; S4/KS^4/K termStartup/drain and weight stashing
Stage-distributed LocalSGDIndependent trajectories fill idle slotsReplica drift; S3H2/KS^3H^2/K termSynchronization bubbles and RR logical model copies

The guarantees also measure different quantities. RPD averages gradient norms along one stale block-update trajectory, while LocalSGD evaluates the averaged model wˉq\bar{w}_q. A shared block-update budget makes the comparison informative, but these are not identical guarantees and neither proves that one schedule always wins.

The experiments confirm that neither method wins everywhere:

Two simulated-time convergence plots at 16 stages: tuned LocalSGD reaches a lower logistic-regression objective, while tuned PipeDream reaches a lower quadratic objective
At S=16S=16 in these best-tuned synthetic runs, LocalSGD reaches the lower logistic-regression objective, while PipeDream is stronger on the tridiagonal quadratic.

The paper also reports an 11.1M-parameter NanoChat-style Tiny Shakespeare experiment in which tuned PipeDream reaches the lower training loss. That result applies to this training setup; it is not a claim about downstream quality or generalization. Across the experiments, the outcome depends on the objective, gradient noise, stage count, memory budget, and synchronization period.

What the theory reveals

RPD is not meant to replace PipeDream’s scheduler. It gives us a way to analyze the optimization behavior that the scheduler creates:

  • RPD captures the unusual model behind a PipeDream gradient: its stage blocks may come from different moments in history.
  • The theorem makes delay explicit: the stale-read term depends on δ2\delta^2.
  • The real scheduler supplies the scale: steady-state PipeDream has δPD=Θ(S2)\delta_{\mathrm{PD}}=\Theta(S^2) in global block-update history.
  • The framework extends to other PipeDream-style methods: for any variant with bounded block-wise stale weights, derive the delay bound δ\delta induced by its schedule and substitute it into the RPD rate O(S/K+δ2/K)\mathcal{O}(S/\sqrt{K}+\delta^2/K). Under the same assumptions, this converts the method’s scheduling geometry into a convergence-rate bound.
  • LocalSGD offers a different bargain: it removes this stale-version mechanism but introduces synchronization and replica drift.

The practical question is therefore not, “Which method always wins?” It is:

Which cost can this training problem afford—idle time, stale weights, or replica drift?

That is the trade-off exposed by the theory and experiments.

For the complete theory and experimental details, read the paper and explore the open-source repository.

Citation

@article{ilin2026demystifying,
  title={Demystifying Pipeline Parallelism: First Theory for PipeDream},
  author={Ilin, Ivan and Richt{\'a}rik, Peter},
  journal={arXiv preprint arXiv:2606.03498},
  year={2026}
}

Related work

Publications

2026
PreprintarXiv

Demystifying Pipeline Parallelism: First Theory for PipeDream

Analyzes PipeDream, a way to train models by splitting their layers across multiple devices. It proves when this pipeline approach converges and shows how outdated updates worsen as more stages are added, clarifying when pipeline parallelism will scale well.

Ivan Ilin, Peter Richtárik