Glossary/ Inference

Speculative Decoding

An inference technique that uses a smaller draft model to guess multiple future tokens, verified in parallel by the large model to reduce latency.

Speculative decoding accelerates autoregressive generation-where tokens are produced one at a time-by having a lightweight draft model generate K candidate tokens in a single forward pass, then the target large language model (LLM) validates them in parallel. If all K are accepted, the LLM outputs them quickly; if some are rejected, the model regresses to the accepted prefix and re-samples. This technique preserves exact output distribution (no loss in quality) because it uses rejection sampling. Typical speedups range from 2x to 3x on latency-sensitive tasks. The draft model must be much smaller (e.g., 1B parameters for a 70B target) and ideally use the same tokenizer. Popular implementations: Self-Speculative Decoding (using early exit from the same model) and Medusa (adding multiple prediction heads). Key tradeoffs: if draft model accuracy is low, rejection rate increases, negating benefits. Memory overhead for loading both models is minimal if draft is small. Speculative decoding is most effective for tasks where latency per token matters (chat, real-time APIs) and for long sequences where KV cache reuse speeds parallel verification. It works well with batched inference (continuous batching) especially. For AI builders, tuning the draft length K (2-5 tokens) based on your model pair and hardware is critical. Tools like TensorRT-LLM and Hugging Face Text Generation Inference support it.

Common misconception

Speculative decoding can hallucinate; it strictly maintains the same output distribution as the original model when rejection sampling is used.

Canonical reference
https://arxiv.org/abs/2211.17192

Related terms

Concepts you'll usually encounter alongside this one.

Mentioned in tutorials

Hands-on guides that put this concept to work.

VRAM Calculator

See how this term affects your memory budget.

MyAI Bench

Real numbers, real chips, every workload.

Buying guides

Picks for builders, by use case.

Stay Ahead of the AI Curve

Get weekly AI hardware news, benchmark updates, and deals in your inbox. Founding-subscriber list, be one of the first.

✓ No spam✓ Weekly digest✓ Unsubscribe anytime