What is speculative decoding?
hardAnswer
- Use a small 'draft' model to propose K tokens ahead, then have the large 'target' model verify all K in a single parallel forward pass.
- Whichever prefix the target agrees with is accepted; the first disagreement position is corrected and the rest re-drafted.
- Output is identical to target-only decoding.
- Speedup: 2-3x when draft agreement is high.
- Foundation of vLLM's speculative decoding, Medusa, EAGLE.
- Draft model choice: same-family small model (Llama-3-8B drafting for Llama-3-70B) or a trained n-gram head.
Check yourself — multiple choice
- Sacrifices output identity
- Small draft proposes K tokens → target verifies all in one pass → identical output, 2-3× faster
- Doubles latency
- Only for training
Speculative decoding: draft model proposes → target verifies in parallel → 2-3× speedup, exact same output.
#inference#generation
Practise LLMs & GenAI
214 interview questions in this topic.
Related questions
- How do Medusa and EAGLE differ from vanilla speculative decoding?
- What do temperature and top-p do at generation time?
- What is the context window and what tricks extend it?
- What is quantization and what tradeoffs come with it?
- What is the KV cache and why does it matter for LLM inference?
- What is Grouped-Query Attention (GQA) and why does it matter?