Log inStart free
LESSON 30.11 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Speculative decoding: draft and verify

Watch a small model guess tokens and a big model check them in one pass.


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

Go Pro · $8.25/mo
EXPLAINER · 30.11 · DECODE BAYPLAIN · 12 PASSES · 12 TOKENS
01
Stage 1 of 6 · Plain decoding
The target model writes one token per forward pass. So 12 tokens take 12 passes.
Explain it simply

The target model is the big model you want answers from. In decode, it writes one token per pass. Each pass reads all of its weights from memory, and that reading sets the time. So the 12 tokens cost 12 full passes, the 12 bars on the plain lane.

On the plain lane, 12 target passes write 12 tokens, one token per pass.

draft guessmodel passrejectedtarget token
thecatsatonthematandthedogsleptbythedoor.plain048121620time in target passes12 passessatonthematandthedogsleptbythedoor.plain decodingthecatsatonthematandthedogsleptbythedoor.plain048121620time in target passes12 passessatonthematandthedogsleptbythedoor.plain decoding
Toy: a trigram target over 12 words and two drafts; 12 tokens; time in target passes
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Tplain=n×1 pass\sy{t}{param}{T}_{\text{plain}} = \sy{n}{out}{n} \times 1\ \text{pass}
Tplain=12×1=12 passesT_{\text{plain}} = 12 \times 1 = 12\ \text{passes}

Plain decoding needs one target pass per token.

Common mix-ups

MYTHSpeculative decoding can change the text the model writes.

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

Predict, then reveal
3 CHECKS · PRO
Q01With the small draft and k = 4, how many tokens does round 1 give?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 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.