TAI BUI
Back to curriculum
LearnPython

DualPipe Parallelism

DeepSeek-V3 trained on 2,048 H800 GPUs with MoE experts scattered across nodes, and the cross-node expert all-to-all cost about 1 GPU-hour of communication for every 1 GPU-hour of compute. DualPipe (DeepSeek, Dec 2024) is a bidirectional pipeline that overlaps forward and backward computation with the all-to-all traffic they trigger. Bubbles shrink and throughput climbs. The price is two copies of the model parameters (the "dual"), which is cheap when Expert Parallelism already spreads the experts across ranks. This is a Learn-type walkthrough of what DualPipe does, and of why Sea AI Lab's DualPipeV drops the 2x parameter cost in exchange for a slightly larger bubble.

TIME: ~60 minutesPREREQUISITES: Phase 10 · 05 (distributed training, FSDP, DeepSpeed), Phase 10 · 14 (open-model architectures and MoE)

Learning Objectives

  • Name the four components of a DualPipe forward-backward chunk and why each one gets its own overlap window.
  • Explain the pipeline bubble problem at scale, and what "bubble-free" means in practice versus in marketing.
  • Trace a DualPipe schedule by hand for 4 PP ranks and 8 micro-batches and confirm the forward and reverse streams fill each other's idle slots.
  • State the tradeoff DualPipeV (Sea AI Lab, 2025) makes: drops the 2x parameter replication at the cost of a slightly larger bubble when Expert Parallelism is inactive.

The Problem

Training a 671B MoE model on 2k H800 GPUs runs into three bottlenecks at once:

  1. Memory pressure. Each GPU holds a slice of the model, and activation memory at sequence 8k across 61 layers on 128 heads is enormous.
  2. Pipeline bubbles. Traditional pipeline parallelism (GPipe, 1F1B) leaves GPUs idle while they wait for their stage's input or gradient. At 8 stages, roughly 12% of GPU time can be bubble even with 1F1B scheduling.
  3. Cross-node all-to-all. MoE with expert parallelism scatters experts across nodes. A forward pass triggers one all-to-all to dispatch tokens to their experts and another to combine the results. At 2k GPUs this easily reaches a 1:1 compute-to-comm ratio.

Each one has its own fix: gradient checkpointing for memory, Zero Bubble (Sea AI Lab, 2023) for pipeline bubbles, expert-parallel comm kernels for all-to-all. DualPipe's contribution is making them work together. It overlaps compute and comm inside a single forward-backward chunk, injects micro-batches from both ends of the pipeline at once, and uses the resulting schedule to hide the all-to-all inside compute windows.

The reported result is a near-elimination of pipeline bubbles, with over 95% GPU utilization in DeepSeek-V3's 14.8T-token training run.

Warm-up0/3
1. In Phase 10 · 05, what does FSDP shard across data-parallel ranks?Warm-up
A full training state divided evenly into four shards, one arrow into each of four rank boxes labelled rank 0 through rank 3, each holding a one-quarter shard of an unnamed whole. A question asks what exactly FSDP shards across these ranks.
The four-way even split is the stem's own setup; which parts of the state are shared is the question.
2. In an MoE layer with experts spread across GPUs (Phase 10 · 14), why does each forward pass need an all-to-all?Warm-up
A token sitting on GPU 0, its assigned expert living on GPU 2, with a dashed unlabeled line between them. A question asks why the forward pass needs an all-to-all to connect them.
The token's home GPU and its expert's GPU are the stem's own setup; why that requires all-to-all is the question.
3. A training step spends time waiting on a network transfer while the GPU's math units sit idle. What general technique hides that wait?Warm-up
A single step drawn as two sequential bars: a network transfer from 0 to 10 milliseconds, then GPU math from 10 to 16 milliseconds, one strictly after the other. A question asks what general technique removes the GPU's idle time here.
The serial transfer-then-compute timing is the setup; the fix is the question.

The Concept

Pipeline parallelism refresher

Split an N-layer model across P devices. Device i holds layers i * N/P .. (i+1) * N/P - 1. A micro-batch flows forward through devices 0 to P-1, then backward from P-1 to 0. Each device can only start its forward stage when the prior device sends its output and can only start backward when the downstream device sends the upstream gradient.

GPipe (Huang et al., 2019) schedules one micro-batch at a time, which wastes most GPU time. 1F1B (Narayanan et al., 2021) interleaves forward and backward passes for multiple micro-batches. Zero Bubble (Qi et al., 2023) splits the backward pass into two parts, backward-for-input (B) and backward-for-weights (W), and schedules them to fill the bubble. After Zero Bubble the pipeline is almost tight.

DualPipe adds two ideas on top of that.

Idea 1: chunk decomposition

Each forward chunk is split into four components:

  • Attention. Q/K/V projections, attention, output projection.
  • All-to-all dispatch. Cross-node communication that sends tokens to their experts.
  • MLP. The MoE expert computation.
  • All-to-all combine. Cross-node communication that brings expert outputs back.

A backward chunk adds gradient versions of each of these. DualPipe schedules them so that all-to-all dispatch runs in parallel with the attention compute of the next chunk, and all-to-all combine runs in parallel with the MLP compute of the following chunk.

Idea 2: bidirectional scheduling

Most pipeline schedules inject micro-batches at stage 0 and let them flow toward stage P-1. DualPipe injects from both ends. Stage 0 sees forward micro-batches that originate there, and so does stage P-1. The two streams meet in the middle.

For this to work, device i has to hold both the early-pipeline layer i and the late-pipeline layer P - 1 - i. That is the "dual" in DualPipe: each device keeps two copies of the layers it serves, one per direction. At DeepSeek-V3's scale this is a 2x parameter replication cost, which is affordable because Expert Parallelism already spreads the MoE experts so thin that replicating the non-expert layers is a small addition.

The forward stream in one direction and the backward stream in the other overlap where the bubbles would sit in a single-direction schedule, and that overlap is what squeezes the bubbles out.

A hand-traced schedule

Consider P = 4 ranks, 8 micro-batches, divided 4 forward / 4 reverse. Time moves left to right; rows are device ranks.

           Time →
rank 0:  F1 F2 F3 F4  F5R F6R F7R F8R  B1 B2 B3 B4  ...
rank 1:     F1 F2 F3  F4/F5R F6R F7R   B1 B2 ...
rank 2:        F1 F2  F3/F5R F4/F6R    B1 ...
rank 3:           F1  F2/F5R F3/F6R    ...

Reading the "F4/F5R" notation: rank 1 is running forward of micro-batch 4 (going left-to-right in the pipeline) AND forward of micro-batch 5 (going right-to-left) in the same time slot. That is what "bidirectional" means operationally.

At rank 2 the cross streams overlap sooner, and at rank 0 and P-1 they overlap latest. In the stable middle phase, each rank runs the forward pass of one direction overlapped with the backward pass of the other, so compute stays busy. All-to-all dispatches for the forward pass hide inside backward compute, and all-to-all combines hide inside forward compute.

Bubble accounting

Standard 1F1B pipeline bubble (time wasted per rank):

bubble_1F1B = (P - 1) * forward_chunk_time

Zero Bubble brings that down but not to zero. DualPipe has zero bubble in the stable phase if the micro-batch count is divisible by 2 times the pipeline depth. Warmup and cooldown still carry some bubble, but it does not grow with the number of micro-batches, which is the property the paper highlights.

The marketing term is "bubble-free". The technical claim is narrower: bubbles do not grow with micro-batch count. Sea AI Lab's follow-up analysis (DualPipeV / Cut-in-half) shows full zero-bubble only when Expert Parallelism is not the bottleneck. With EP-driven all-to-all, expect some scheduling compromise.

DualPipeV, the refinement

Sea AI Lab (2025) observed that the 2x parameter replication is wasteful when EP comm overlap is not the point. Their DualPipeV schedule folds the bidirectional injection into a "V-shape" schedule that runs on a single parameter copy. The bubble is slightly larger than DualPipe's, but the memory savings are substantial. DeepSeek added DualPipeV to their open-source DualPipe implementation as an EP-off mode.

The tradeoff:

FeatureDualPipeDualPipeV1F1BZero Bubble
Param copies per device2111
Bubble vs micro-batchesconstantsmall growthgrowsgrows
Compute-comm overlapfullpartialminimalpartial
Use whenEP-heavy MoEdense or EP-lightbaselineany pipeline

What it means for a 14.8T-token run

DeepSeek-V3's pre-training consumed 14.8T tokens on 2,048 H800 GPUs in roughly 2.8M GPU-hours. With naive 1F1B, they would have lost 12-15% of that to pipeline bubbles, which is 340-420K GPU-hours, enough to train a full 70B model. DualPipe recovered most of it. Quantifying the contribution directly is difficult without the internal logs, but the paper claims over 95% GPU utilization averaged across training.

For smaller runs (under 1k GPUs), DualPipe is overkill. Pipeline bubbles are smaller relative to total cost, and dense-model training rarely hits the all-to-all bottleneck. For frontier MoE training at multi-thousand GPU scale, it is effectively required.

Where it sits in the stack

  • Complementary to FSDP (Phase 10 · 05). FSDP shards the model parameters across ranks; DualPipe schedules the compute across ranks. They combine.
  • Compatible with ZeRO-3 gradient sharding, though the bookkeeping for the two-copy replication has to cooperate with ZeRO's sharded gradients.
  • Needs custom all-to-all kernels tuned for your cluster topology. DeepSeek's open-source kernels are the reference implementation.
Check: The Concept0/33
1. What is a pipeline bubble in pipeline parallelism?Define
Two rank timelines, each a row of busy blocks with one unlabeled blank slot drawn between busy blocks on each row. A question asks what schedulers call these blank slots.
The busy blocks and blank slots are a generic timeline; the name for the blanks is the question.
2. What is 1F1B?Define
A term card reading 1F1B. Context note: Context: a baseline pipeline schedule named in the Pipeline parallelism refresher, the one DualPipe is compared against. A question asks: What does this schedule do?
The term as the lesson names it; its mechanism is the question.
3. How does Zero Bubble (Qi et al., 2023) nearly close the pipeline bubble?Define
A term card reading Zero Bubble. Context note: Context: a 2023 scheduling idea (Qi et al., Sea AI Lab), named in the Pipeline parallelism refresher as the step after 1F1B. A question asks: How does it nearly close the pipeline bubble?
The term as the lesson names it; its mechanism is the question.
4. What is DualPipe?Define
A term card reading DualPipe. Context note: Context: the pipeline schedule this lesson is about, introduced by DeepSeek in December 2024. A question asks: What is it?
The term as the lesson names it; its mechanism is the question.
5. What is DualPipeV, and what does it trade away relative to DualPipe?Define
A term card reading DualPipeV. Context note: Context: Sea AI Lab's 2025 refinement of DualPipe, named in The Concept section. A question asks: What is it, and what does it trade away relative to DualPipe?
The term as the lesson names it; its mechanism is the question.
6. In DualPipe's vocabulary, what is a chunk?Define
A term card reading Chunk. Context note: Context: the basic unit of pipeline work that DualPipe schedules and overlaps, named throughout Idea 1: chunk decomposition. A question asks: What is a chunk?
The term as the lesson names it; its mechanism is the question.
7. Which four components does DualPipe split each forward chunk into?Define
A single forward chunk box with four arrows fanning out to four blank, unlabeled dashed slots. A question asks which four components DualPipe splits each forward chunk into.
That the chunk splits into four pieces is the stem's own setup; naming the four pieces is the question.
8. What does all-to-all dispatch do in an MoE layer with Expert Parallelism?Define
Tokens flowing from their home ranks into an all-to-all dispatch box, then out to a blank, unlabeled destination box. A question asks what this step does with the tokens that arrive.
That tokens enter this step from their home ranks is the stem's own setup; where dispatch sends them is the question.
9. What does all-to-all combine do?Define
Expert outputs, produced after the MLP runs, flowing into an all-to-all combine box, then out to a blank, unlabeled destination box. A question asks what this step does with the outputs that arrive.
That expert outputs enter this step after the MLP is the stem's own setup; where combine sends them is the question.
10. What does Expert Parallelism shard?Define
Four GPU boxes, each holding a different, blank unlabeled group with no name given. A question asks what exactly is sharded here.
That each GPU holds a different, unnamed group is the stem's own setup; what the group actually is is the question.
11. What does Pipeline Parallelism split across ranks, and so what does DualPipe schedule?Define
Four device boxes, illustrative N=8 and P=4, each holding a consecutive pair of unnamed item numbers using the lesson's own device-i formula: device 0 holds items 0-1, up through device 3 holding items 6-7. A question asks what Pipeline Parallelism shards here and so what DualPipe schedules.
Illustrative item count; the device-to-item formula follows the lesson's own shape, but the item's identity is left unnamed.
12. What does the bubble fraction measure?Define
A term card reading Bubble fraction. Context note: Context: a ratio the schedule simulator reports for every schedule choice, named in the Key Terms table. A question asks: What does it measure?
The term as the lesson names it; its mechanism is the question.
13. Why does DualPipe split a chunk into attention, dispatch, MLP and combine instead of treating it as one block?Explain
One forward chunk shown as four generic unnamed parts in a row, flanked by a greyed previous chunk box and a greyed next chunk box, with no arrows drawn between chunks. A question asks why the chunk is split into four pieces instead of one block.
That the chunk has four pieces and sits between neighboring chunks is the setup; the reason for splitting is the question.
14. What does the 'dual' in DualPipe refer to?Explain
A term card reading the 'dual' in DualPipe. Context note: Context: the extra memory cost that Idea 2: bidirectional scheduling names, so that micro-batches can enter from either end of the pipeline. A question asks: What does 'dual' refer to?
The term as the lesson names it; its mechanism is the question.
15. When does DualPipe reach zero bubble in its stable phase?Explain
A term card reading zero bubble in the stable phase. Context note: Context: a specific condition on micro-batch count and pipeline depth, from the Bubble accounting section. A question asks: When does DualPipe reach it?
The term as the lesson names it; its mechanism is the question.
16. What does 'bubble-free' honestly mean for DualPipe?Explain
Two boxes side by side, one labelled the marketing term, bubble-free in quotes, the other labelled the technical claim with a blank in place of its content. A question asks what the narrower technical claim actually says.
That the lesson distinguishes a marketing term from a narrower technical claim is the setup; what the claim says is the question.
17. Why can DualPipeV drop the second parameter copy when Expert Parallelism is inactive?Explain
A scenario card titled A cluster with Expert Parallelism switched off, subtitled DualPipeV considered for this cluster. Given: Expert Parallelism: inactive; all-to-all traffic: little to none. A question asks: Why can DualPipeV drop DualPipe's second parameter copy here?
Every fact shown is the stem's own given setup; the question itself is left blank.
18. Why is DualPipe's 2x parameter replication affordable at DeepSeek-V3's scale?Explain
A scenario card titled DeepSeek-V3's scale, subtitled DualPipe's 2x parameter replication, in production. Given: replication cost: 2x parameter copies per device; scale: DeepSeek-V3's training run. A question asks: Why is this 2x replication affordable at this scale?
Every fact shown is the stem's own given setup; the question itself is left blank.
19. With forward chunk time fixed, how does the 1F1B bubble per rank change as pipeline depth P grows?Explain
Two pipeline-depth boxes, P equals 4 and P equals 8, each with the same blank question mark in place of its bubble per rank. A question asks how the 1F1B bubble per rank changes as pipeline depth grows, forward chunk time held fixed.
The two depths are the stem's own comparison; how the bubble changes between them is the question.
20. How does DualPipe relate to FSDP and ZeRO-3?Explain
Three plain name boxes, FSDP, DualPipe and ZeRO-3, with no description of what each one does. A question asks how DualPipe relates to the other two.
Only the three names are given; how they relate to each other is the question.
21. In the hand-traced schedule, what does 'F4/F5R' at rank 1 mean?Apply
Rank 1's own first four operations in sequence, labelled op 1 through op 4: F1, F2, F3, and F4/F5R highlighted, with no other rank's row shown. A question asks what the notation F4/F5R means at this step.
This is rank 1's own sequence from the hand-traced schedule, renumbered by local step rather than the schedule's global time slot; decoding F4/F5R is the question.
22. Using bubble_1F1B = (P - 1) * forward_chunk_time, what is the per-rank bubble for P = 8 and a 2 ms forward chunk?Apply
The lesson's own bubble accounting formula, bubble_1F1B equals P minus 1 times forward_chunk_time, with P at 8 and forward_chunk_time at 2 milliseconds, and the result left blank. A question asks what the per-rank bubble comes out to.
The formula and both numbers are the stem's own; the result is the question.
23. Naive 1F1B would lose 12-15% of about 2.8M GPU-hours to pipeline bubbles. Roughly how many GPU-hours is that?Apply
The stem's own two figures: a total budget of about 2.8 million GPU-hours, and a 12 to 15 percent loss to pipeline bubbles, with the resulting GPU-hour range left blank. A question asks roughly how many GPU-hours that is.
Both figures are the stem's own numbers; the resulting range is the question.
24. In main.py, bubble_1f1b uses total = 2*M + 2*(P-1) and bubble = 2*(P-1). What fraction does bubble_1f1b(P=4, M=8) return?Apply
The real bubble_1f1b formula from main.py, total equals 2 times M plus 2 times P minus 1, bubble equals 2 times P minus 1, with P at 4 and M at 8, and the resulting fraction left blank. A question asks what fraction this call returns.
The formula and both numbers are quoted from main.py and the stem; tracing it is the question.
25. In main.py, bubble_dualpipe uses total = 3*M + (P-1) and bubble = (P-1)//2. What fraction does it give at P = 8, M = 16?Apply
The real bubble_dualpipe formula from main.py, total equals 3 times M plus P minus 1, bubble equals P minus 1 integer-divided by 2, with P at 8 and M at 16, and the resulting fraction left blank. A question asks what fraction this call gives.
The formula and both numbers are quoted from main.py and the stem; tracing it is the question.
26. bubble_dualpipev multiplies DualPipe's bubble by 1.2. If DualPipe gives about 5.5% at P = 8, M = 16, what does DualPipeV give?Apply
The stem's own given DualPipe figure of about 5.5% at P equals 8 and M equals 16, multiplied by 1.2, with the DualPipeV result left blank. A question asks what DualPipeV gives at the same P and M.
The DualPipe figure and the multiplier are both the stem's own; the product is the question.
27. In the hand-traced P = 4 schedule, rank 0 runs F1 in the first slot. In which slot does rank 3 first run F1?Apply
Ranks 0, 1 and 2 shown running F1 at steps 1, 2 and 3 respectively, with rank 3's step left blank. A question asks in which step rank 3 first runs F1.
Ranks 0 through 2's F1 steps are the stem's own pattern; rank 3's step is the question.
28. gpu_hours_recovered(P=16, M=128, 2.8M) subtracts DualPipe's bubble (about 1.8%) from 1F1B's (about 10.5%) and multiplies by the total. About how many GPU-hours is that?Apply
The stem's own three figures: a 1F1B bubble of about 10.5%, a DualPipe bubble of about 1.8%, and a total of 2.8 million GPU-hours, with the recovered amount left blank. A question asks about how many GPU-hours this recovers.
All three figures are the stem's own; the recovered amount is the question.
29. A team runs DualPipe with P = 8 and 24 micro-batches, and a profile shows a bubble in the stable phase. Which requirement did they miss?Analyze
A scenario card titled A DualPipe run that still shows a bubble, subtitled P = 8, 24 micro-batches, profiled. Given: pipeline depth P: 8; micro-batches M: 24; profiled stable-phase bubble: present, not zero. A question asks: Which requirement did this run miss?
Every fact shown is the stem's own given setup; the question itself is left blank.
30. To save memory, a team on an EP-heavy MoE cluster moves from DualPipe to DualPipeV. All-to-all time now shows up on the critical path. What explains it?Analyze
A scenario card titled Switching schedules to save memory, subtitled EP-heavy MoE cluster, DualPipe to DualPipeV. Given: cluster: EP-heavy MoE; change made: DualPipe -> DualPipeV; result: all-to-all now shows up on the critical path. A question asks: What explains this result?
Every fact shown is the stem's own given setup; the question itself is left blank.
31. You train a 13B dense model on 256 GPUs with a 4-stage pipeline and no expert parallelism. Which choice fits?Design
A scenario card titled A 13B dense model, no Expert Parallelism, subtitled 256 GPUs, 4-stage pipeline. Given: model: 13B, dense; GPUs: 256; pipeline stages: 4; Expert Parallelism: none. A question asks: Which choice fits this run?
Every fact shown is the stem's own given setup; the question itself is left blank.
32. You train a dense 30B model with a deep pipeline, memory is tight, there is no Expert Parallelism, and you want bubbles that grow little with micro-batch count. Which schedule fits?Design
A scenario card titled A dense 30B model, memory tight, subtitled deep pipeline, no Expert Parallelism. Given: model: 30B, dense; pipeline: deep; Expert Parallelism: none; memory: tight; goal: little bubble growth as M increases. A question asks: Which schedule fits this plan?
Every fact shown is the stem's own given setup; the question itself is left blank.
33. A 2k-GPU MoE run has expert-parallel all-to-all costing about as much as compute. Which plan fits best?Design
A scenario card titled A 2k-GPU MoE run, all-to-all costly, subtitled EP comm roughly matches compute cost. Given: scale: 2,048 GPUs, MoE; Expert Parallelism: active; all-to-all cost: about 1:1 with compute. A question asks: Which plan fits best?
Every fact shown is the stem's own given setup; the question itself is left blank.

Use It

code/main.py is a pipeline schedule simulator. Its summarize(P, M) function returns the bubble fraction for each of 1F1B, Zero Bubble, DualPipe, and DualPipeV, and main() prints it at P=8, M=16, then sweeps micro-batch count and pipeline depth. It is a teaching tool. The bubble formulas are closed-form approximations with unit-normalized chunk costs, so read the numbers as relative comparisons, not as measured speedups.

Run it as is, then edit the P and M values in main() and compare how the schedules rank. The script takes no command-line arguments. DualPipe stays below the others at every setting it sweeps, and DualPipeV sits just above it.

Integration considerations for a real training run:

  • Pick a pipeline-parallel depth that divides cleanly into your micro-batch count.
  • Make sure your expert-parallel mesh supports bidirectional all-to-all. DeepSeek's kernels are the reference.
  • Budget about a week of debugging on the schedule itself the first time. The bookkeeping is fiddly.
  • Monitor GPU utilization per rank, not just aggregate. DualPipe's benefit comes from tightening the stragglers.
Check: Use It0/4
1. Why does the lesson advise monitoring GPU utilization per rank rather than only in aggregate?Explain
A scenario card titled Monitoring a DualPipe run, subtitled Aggregate looks fine; per-rank is unchecked. Given: aggregate GPU utilization: looks healthy; per-rank GPU utilization: not yet checked. A question asks: Why does the lesson advise checking per-rank utilization instead of trusting the aggregate figure?
Every fact shown is the stem's own given setup; the question itself is left blank.
2. Your pipeline depth is P = 8. Which micro-batch count keeps DualPipe's stable phase at zero bubble?Apply
Eight stage boxes numbered 0 through 7, representing a pipeline depth of P equals 8, with nothing else drawn. A question asks which micro-batch count keeps DualPipe's stable phase at zero bubble.
Only the pipeline depth is given; the qualifying micro-batch count is the question.
3. A reader runs main.py, sees every schedule's bubble fraction fall as micro-batches grow, 1F1B included, and decides the claim that 1F1B bubbles grow with M is false. What is the sound reading?Analyze
A real curve of 1F1B's own bubble fraction from main.py's Step 2 sweep at P equals 8, falling as the micro-batch count M grows from 4 to 128. A note says a reader sees every schedule's fraction fall this way and concludes the lesson's claim is false, and asks what the sound reading is.
The curve is the real output of main.py's own sweep; how to read it against the lesson's claim is the question.
4. The Step 4 estimate recovers about 245K GPU-hours, below the 340-420K implied by 12-15% of 2.8M. What best explains the gap?Analyze
A scenario card titled Two estimates that do not match, subtitled 245K recovered vs. 340-420K implied. Given: Step 4 estimate (P=16, M=128): about 245K GPU-hours; implied by 12-15% of 2.8M: 340-420K GPU-hours. A question asks: What best explains the gap between these two figures?
Every fact shown is the stem's own given setup; the question itself is left blank.

Ship It

This lesson produces outputs/skill-dualpipe-planner.md. Given a training cluster specification (GPU count, topology, interconnect, model shape), it recommends a pipeline parallelism strategy, the scheduling algorithm to use, and the expected bubble fraction at the target scale.

Author's Note

I'd run main.py first and read the Step 2 table before any of the schedule diagrams. It sweeps micro-batch count at P=8, and you can see DualPipe's bubble fraction sit below 1F1B's and Zero Bubble's in every row. DualPipeV is not computed from a schedule at all: the code multiplies DualPipe's bubble by 1.2, so its gap to DualPipe is an assumption I made, not a result.

Keep the toy's numbers in proportion to the Problem section. At P=8 and 16 micro-batches the simulator gives 1F1B a bubble of about 30%, well above the roughly 12% quoted earlier, because its formula counts warmup and cooldown against a short run. Its fractions also shrink as M grows for every schedule, so it does not reproduce the claim that 1F1B bubbles grow with micro-batch count. I'd trust the ordering of the schedules and ignore the absolute values.

The Step 4 estimate is where I'd be most skeptical. It assumes P=16 and M=128, which are my picks and not DeepSeek's configuration, and it lands at about 245K recovered GPU-hours, below the 340-420K range from the 12-15% figure. If you want a number for your own cluster, plug your real P and M into gpu_hours_recovered and check it against a measured per-rank utilization trace.

Exercises

  1. Run code/main.py and read the 1F1B and DualPipe rows of Step 1 (P=8, M=16). Compute the GPU utilization difference and express it as recovered GPU-hours per million tokens of training.

  2. Sketch the schedule table for (P=4, micro_batches=8, schedule=dualpipe) by hand. Mark each time slot with the micro-batch ID and direction. Identify the first time slot where bubbles are absent.

  3. Read Figure 5 of the DeepSeek-V3 technical report (arXiv:2412.19437). Identify the overlap window for all-to-all dispatch inside a DualPipe forward chunk. Explain how the compute schedule hides it.

  4. Compute the 2x parameter overhead of DualPipe for a 70B dense model with P=8 pipeline stages and a 671B MoE model with P=16 pipeline stages. Show why the MoE case's overhead is proportionally smaller (most parameters are experts, sharded across a large EP group).

  5. Compare DualPipe to Chimera (a competing bidirectional scheduler from 2021). Identify the two specific properties DualPipe added that Chimera did not have, using the paper's Section 3.4 as the reference.

Key Terms

TermWhat people sayWhat it actually means
Pipeline bubble"Idle time per rank"GPU cycles wasted because a pipeline stage is waiting for its input or gradient
1F1B"Default pipeline schedule"One forward / one backward interleaved scheduling; the baseline DualPipe beats
Zero Bubble"Sea AI Lab 2023"Splits backward into B (input gradient) and W (weight gradient); almost fully tightens the pipeline
DualPipe"DeepSeek-V3 schedule"Bidirectional pipeline + compute-comm overlap; bubbles do not grow with micro-batch count
DualPipeV"Cut-in-half"V-shape refinement that drops the 2x parameter replication at the cost of slightly larger bubbles
Chunk"Unit of pipeline work"A forward or backward pass of one micro-batch through one pipeline stage
All-to-all dispatch"Send tokens to experts"Cross-node comm that routes tokens to their assigned MoE experts
All-to-all combine"Bring expert outputs back"Cross-node comm that gathers expert outputs after the MLP
Expert Parallelism (EP)"Experts across GPUs"Shards MoE experts across ranks so different GPUs hold different experts
Pipeline Parallelism (PP)"Layers across GPUs"Shards model layers across ranks; the dimension DualPipe schedules
Bubble fraction"Wasted GPU time"(bubble_time / total_time); the fraction DualPipe drives toward zero

Further Reading

Code

Ships With