Log inStart free
LESSON 29.14 · 5 STAGES · 2 CONTROLS · 2 CHECKSPRO · PREVIEW

Continuous batching

Watch requests leave and join a running batch before every step.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 29.14 · SERVING BAY10 REQUESTS · 98 OUTPUT TOKENS
01
Stage 1 of 5 · The trace
Ten requests arrive over 260 ms. Each one has its own prompt and reply length.
Explain it simply

Each row is one request, and the teal tick shows when it arrives. The label gives its prompt length and how many tokens it writes back. Some are short chats, and R7 sends a long prompt of 1,000 tokens.

Ten lanes, R1 to R10. Each has an arrival tick between 0 and 260 ms and its prompt and output lengths.

request, prompt tokensoutput token, decodewait, paddingweights readempty slot
the trace02004006008001000 msR1200 in · 12 outR260 in · 16 outR3800 in · 6 outR4120 in · 10 outR5400 in · 14 outR680 in · 8 outR71000 in · 4 outR8150 in · 12 outR9300 in · 6 outR10100 in · 10 out10 requests · 98 output tokens · arrivals 0–260 msthe trace02004006008001000 msR1200 in · 12 outR260 in · 16 outR3800 in · 6 outR4120 in · 10 outR5400 in · 14 outR680 in · 8 outR71000 in · 4 outR8150 in · 12 outR9300 in · 6 outR10100 in · 10 out10 requests · 98 output tokens · arrivals 0–260 ms
Toy: the 29.C2 trace on one toy GPU
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ai, pi, oi\sy{a}{data}{a_i},\ \sy{n}{data}{p_i},\ \sy{o}{out}{o_i}
10 requests, ∑oi=98 tokens10\ \text{requests},\ \textstyle\sum o_i = 98\ \text{tokens}

Each request has an arrival time, a prompt length and an output length.

Common mix-ups

MYTHContinuous batching makes every request finish sooner.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01With request-level batches, does the whole trace end sooner or later?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.