Speculative Decoding
A language model writes one token at a time, and each token means another full pass over billions of weights. The strange part is that the hardware is barely working during those passes — they are limited by how fast weights can be pulled out of memory, not by arithmetic. Speculative decoding turns that idle capacity into speed by guessing ahead.
Draft, then verifyA small, cheap draft model — or a lightweight extra head attached to the big one — proposes the next handful of tokens. The large target model then evaluates all of those positions in a single forward pass, because checking tokens you already have is parallel work while producing them is not. Where the target agrees, the tokens are kept; at the first disagreement the rest of the draft is thrown away, the target's own token is used, and the next round begins. A rejection-sampling step makes the accepted text follow exactly the distribution the target model would have produced alone, so this is a pure latency trick with no quality cost.
What decides whether it paysEverything rides on how often the draft is accepted, and on three practical conditions:
- Draft agreement — the drafter must usually guess right, so it is typically a much smaller model from the same family, or Medusa- and EAGLE-style heads trained on the target's own outputs.
- Draft cheapness — its own passes must be nearly free, or they eat the winnings.
- Spare hardware — the gain comes from unused memory bandwidth, so single-stream generation in vLLM or llama.cpp speeds up two- to threefold, while a server already saturated with large batches has nothing to spare and can even run slower.
Speculative decoding speeds up generation by letting a small draft model propose several tokens at once, which the large model verifies in one forward pass, accepting them up to the first disagreement. Because checking known tokens is parallel work while generating them is not, single-stream latency drops two- to threefold, and a rejection-sampling step keeps the output distribution identical to the large model's. The gain shrinks when the hardware is already saturated by large batches.
Writing out a long answer word by word is slow. So picture a quick junior assistant who scribbles the next few words as a guess, and an expert who only has to read the guess and nod — far faster than writing it from scratch. Speculative decoding does this inside an AI chat system. A small fast model drafts ahead, the big careful model checks the whole draft in one go, keeps the words it agrees with, and takes over from the first word it does not like. You end up with the same answer the big model would have written on its own, just sooner.