What is speculative decoding?
Speculative decoding is an inference method in which a small, fast draft model proposes several tokens and the large target model verifies them in one parallel pass, speeding up generation.
It differs from lookahead decoding in the number of models: lookahead works with one model's own guesses, while speculative decoding uses a second draft model. Done correctly, the final output keeps the target model's probability distribution; the answer does not come from the small model.
- Topic
- Inference and performance
- Also known as
- Speculative sampling, draft and verify
- Origin
- 2023, Leviathan et al. and Chen et al.
How speculative decoding works
- The small draft model cheaply generates the next few candidate tokens.
- The large target model computes the probability of all candidates in a single parallel forward pass.
- Accept-reject sampling keeps matching tokens; the first rejected token is resampled from a corrected distribution built from the target and draft probabilities and remaining draft tokens are dropped.
- Speed-up depends on the draft model's cost, the acceptance rate and implementation details.
In more detail
The bonus token guarantee and mean accepted length
Each target-model verification step yields at least one guaranteed token (either all k draft tokens are accepted plus one bonus token from the target model's final logit or the first rejected position is resampled). Expected speedup scales with the mean acceptance length (τ) minus draft overhead, meaning a 70B target paired with a 1B draft often achieves 2x to 3x latency reduction on code and structured tasks.
The memory bandwidth regime versus the high-concurrency threshold
Speculative decoding thrives in low-to-medium batch regimes where generation is memory-bandwidth bound. At high request concurrency, GPU arithmetic units saturate (compute-bound regime), so verifying k candidate tokens per request competes with serving other active users and can reduce total system throughput.
EAGLE, MTP and prompt lookup variants
Instead of a standalone small LLM, modern inference stacks increasingly use feature-level draft heads (such as EAGLE-2/3), native Multi-Token Prediction (MTP) layers trained with the base model or training-free n-gram/suffix-tree lookup over the prompt and retrieval context, which excels in RAG and document editing workloads.
Commonly confused terms
| Term | How it differs |
|---|---|
| Beam search | Beam search explores multiple competing continuation hypotheses at each step to maximise sequence probability, altering the output distribution, whereas speculative decoding accelerates sampling from a single exact distribution without changing output probabilities. |
| Medusa and multi-token prediction | Medusa or Multi-Token Prediction (MTP) adds extra lightweight prediction heads directly onto the target model's hidden states so no external draft model or separate KV cache is needed, representing an evolution of the draft-verify paradigm. |
Why speculative decoding matters for on-premises AI
Because decoding is mostly bound by memory bandwidth, letting the large model verify several tokens per step uses the GPU better and can speed answers on in-house hardware. In return the draft model needs extra GPU memory and the two models' tokenisers must be compatible. When acceptance is low, such as with off-domain or highly creative text, the gain shrinks and can even turn into a loss. The gain is measured on the organisation's own workload.
A defence body uses speculative decoding in its in-house field report summarisation system; the small draft model adds speed while the large model decides the final output.
Common questions
Does speculative decoding speed up every workload equally?
No. Gains are large when draft proposals are often accepted and shrink for text with low acceptance. The effect is measured on your own workload.
Does speculative decoding lower answer quality?
Not when implemented correctly; the accept-reject step keeps the output distribution identical to the target model's. Only speed changes.
Related terms
Sources
- Leviathan, Kalman and Matias, Fast Inference from Transformers via Speculative Decoding, ICML 2023
- Chen et al., Accelerating Large Language Model Decoding with Speculative Sampling, 2023
In the glossary: Glossary, R to Z