Speculative Decoding — Draft, Verify, Repeat
Autoregressive decoding is serial. Each token waits for the previous one. Speculative decoding breaks the chain: a cheap model drafts N tokens, the expensive model verifies all N in one forward pass. When the draft is right you paid one big forward for N generations. A 70B LLM sampling one token takes 30 ms on an H100. A 3B draft model takes 3 ms. If we let the 3B draft 5 tokens ahead, then run the 70B once to verify all 5, the total is 5×3 + 30 = 45 ms for up to 5 accepted tokens — versus 5×30 = 150 ms for straight-line generation. That is the full speculative-decoding pitch: trade a small amount of extra GPU memory (draft model) for 2–4× lower decode latency. The trick has to preserve the distribution. Speculative sampling, introduced by Leviathan et al. (2023) and by Chen et al. concurrently, guarantees that the output sequence is identically distributed to what the big model would have produced on its own. No quality tradeoff. Just faster. Four families of draft-verifier pairs dominate 2026 inference: Vanilla speculative (Leviathan 2023). Separate draft model (e.g., Llama 3 1B) + verifier (e.g., Llama 3 70B). Medusa (Cai 2024). Multiple decoding heads on the verifier predict positions t+1..t+k in parallel. No separate draft model. EAGLE family (Li 2024, 2025).…
Speculative Decoding — Draft, Verify, Repeat: Autoregressive decoding is serial. Each token waits for the previous one. Speculative decoding breaks the chain:…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.