Log inStart free
LESSON 29.18 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Chunked prefill

Watch long prompts split into chunks so streaming tokens keep flowing.


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

Go Pro · $8.25/mo
EXPLAINER · 29.18 · SCHEDULER20 STEPS · LONGEST 50 MS
01
Stage 1 of 5 · Engine steps
Each engine step reads the weights once, then works on its tokens. More tokens make a longer step.
Explain it simply

Each bar at the bottom is one engine step, and its width is its time. The ochre part is the weight read, 10 ms in every step. The rest grows with the tokens, 40 ms for 512 of them. So one big step costs less than several small ones.

20 engine steps run the 13 requests. The longest step lasts 50 ms, and 14 steps tie at that length. The last step ends at 802.3 ms.

request, prompt chunkswait, stalloutput tokensweight read, budget
0100200300400500600700800900 mssteps1 A 2,0482 A 1,5363 A 2,0484 B 2565 A 1286 B 2567 A 1288 A 2569 B 25610 A 12811 A 25612 A 12813 B 256engine stepslongest steps (14, outlined): 10 + 40 × 512/512 = 50 ms0100200300400500600700800900 mssteps1 A 2,0482 A 1,5363 A 2,0484 B 2565 A 1286 B 2567 A 1288 A 2569 B 25610 A 12811 A 25612 A 12813 B 256engine stepslongest steps (14, outlined): 10 + 40 × 512/512 = 50 ms
Toy: 13 requests, 1 step = 10 ms + 40 ms per 512 tokens
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
tstep=10+40⋅n512 ms\sy{t}{param}{t_{\text{step}}} = \sy{w}{param}{10} + 40 \cdot \frac{\sy{n}{data}{n}}{512}\ \text{ms}
tstep=10+40⋅512512=50 mst_{\text{step}} = 10 + 40 \cdot \tfrac{512}{512} = 50\ \text{ms}

A step costs 10 ms for the weights plus time per token.

Common mix-ups

MYTHCutting prompts into chunks stops decode stalls by itself.

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

Predict, then reveal
3 CHECKS · PRO
Q01With decodes first, is the worst gap at a 2,048-token budget longer or shorter than at 512?

Make your guess, then test it in the diagram. All 3 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 3 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.