dual-batch-overlap -- hiding an expert all-to-all behind another microbatch

When a model's specialist sub-networks are spread over many chips, every step has to ship each word out to the chip holding its specialist and ship the answer back, and while that is in flight the arithmetic units sit doing nothing. The fix is to split the batch of work in two and stagger the halves: while one half waits for its data to arrive, the other half computes, and then they swap. If each half's arithmetic lasts at least as long as the shipping it has to hide, the waiting disappears entirely. The catch is that splitting halves the arithmetic inside each piece while the fixed set-up cost of a transfer is paid again for every piece — so cut the work too finely and the step ends up slower than not splitting at all.

Interactive page: a mixture-of-experts layer served with expert parallelism has to route. Every token is sent to whichever device holds the expert it picked, and the results come back -- two all-to-all collectives per layer, while they are in flight the arithmetic units have nothing to do. Split the batch in two and interleave the halves: while microbatch A is in its all-to-all, microbatch B computes, and vice versa. With balanced halves the communication disappears into the arithmetic entirely; with unbalanced halves a visible bubble remains. Anchor: A4 KV cache / runtime shape (Family J, serving time).

Scope. parallelism owns what expert parallelism puts on the wire and why the volume is set by the router rather than the topology. This page does not re-derive any of that: it is about hiding that cost in time, and the communication cost here is a single duration you set with a slider or drag directly. Sibling scheduling pages: chunked-prefill packs one queue's work into steps; continuous-batching packs many requests into one step; this one packs two lanes against each other.

What it shows

The millisecond figures come from a deliberately simple illustrative cost model -- a per-microbatch share of the work plus a fixed per-invocation overhead on each lane -- chosen so the shape of the trade is readable. They illustrate the mechanism; they are not a measurement of any particular model, interconnect or accelerator.

Where the mechanism comes from (public sources)

SourceWhat it contributes
DeepSeek-V3 Technical Report, <https://arxiv.org/abs/2412.19437>The DualPipe schedule and its computation-communication overlap: dispatch/combine all-to-all of one chunk hidden behind another chunk's compute
MegaScale, <https://arxiv.org/abs/2402.15627>Overlapping collectives with computation at scale, and what stops it being free
Lina, <https://arxiv.org/abs/2210.17223>MoE serving work that decomposes and pipelines the all-to-all against expert compute
Tutel, <https://arxiv.org/abs/2206.03382>Adaptive MoE dispatch, including splitting the all-to-all so it can be pipelined

Interactions

InteractionWhat it does
TransportPlay / pause / step / scrub the schedule; phases fill in on both lanes in the order the scheduler placed them. Autoplays and loops.
Drag a compute blockStretches the compute cost -- the whole lane re-packs under your hand and the bubble grows or vanishes.
Drag a comm blockStretches the communication cost, the same way.
Drag across the split chartRe-splits the batch (1, 2 or 4 microbatches); each bar is a complete re-simulation at that count.
Hover any phase blockIts duration, what it waits on (its own previous phase, or the lane being busy), what it overlaps on the other lane, and how much of a transfer was actually hidden. Hover a bubble for what was still in flight.
Resize the problemLayers (1-3) and microbatch count, live.
ChallengesGet the overlap to 100%; then find a setting where four microbatches are slower than not splitting at all.

URL hooks: every control is mirrored into the query string (?C= compute ms, ?V= all-to-all ms, ?M= microbatches, ?L= layers), plus ?step=N, ?hover=x,y and ?play=1 -- so a dragged state is reproducible headlessly.

Two worth opening directly:

Render tier

T1 (Canvas2D throughout: two lane strips, a baseline ghost strip, a bubble hatch, and a re-simulated split chart).

Wiring

layout.mount + controls (compute cost, all-to-all cost, microbatches, layers) + a Transport over the scheduled tasks (autoplay + loop) + onPointer block-stretch and split-chart drag + hover-to-inspect + two challenges + an A/B compare between one batch and two microbatches. Source: page.js.