Speculative decoding
Speculative decoding gets several tokens from one step of the big model.
Guess, then check
A cheap drafter guesses the next few tokens. The big model checks them all in one pass. Decode is memory-bound, so checking 4 tokens reads the weights once, about the same cost as making 1. If all 4 guesses are right, the pass gives 5 tokens: the 4 guesses plus one of the big model's own.
Verifying the guesses
The big model compares each guess with what it would pick. It keeps guesses up to the first wrong one, replaces that one with its own token, and drops the rest. Because the big model decides every kept token, the output is the same as it would give alone. With random sampling, a careful accept rule keeps the same odds.
Acceptance rate
The acceptance rate is how often guesses are kept. High acceptance gives several tokens per pass; low acceptance wastes the drafting. Predictable text, like code, is easier to guess than a creative story at high temperature. Measure it on your own traffic.
Ways to guess
- A draft model: a small model from the same family, using the same tokenizer.
- Medusa: small extra output heads on the big model, each guessing a token further ahead.
- EAGLE: a small layer that drafts from the big model's own vectors.
- Multi-token prediction: the model is trained to guess several tokens ahead itself.
Medusa and EAGLE are trained for one big model, but need no second model in memory.
When it helps
At low load, decode leaves the GPU's math mostly idle, so checking guesses is almost free. At high load, big batches already keep the math busy. Then wrong guesses cost real work, and gains shrink or turn into a slowdown.
Remember
- Drafter guesses, big model checks in one pass.
- Kept up to the first miss; output is unchanged.
- Speedup depends on the acceptance rate.
- Draft model, Medusa, EAGLE, multi-token prediction.
- Best at low load; weak when the GPU is busy.