What is speculative decoding?
Speculative decoding has a small draft model propose several tokens and the large model verify them in one pass, cutting latency without changing the output distribution.
Speculative decoding is an inference technique where a fast draft proposes several tokens at once and the large target model verifies them in a single forward pass. Leviathan, Kalman and Matias introduced it as a way to compute several tokens in parallel while leaving the output distribution unchanged, with no retraining or architecture change. The model stays the same; only latency drops.
Why it helps
Generating text is slow mostly because of memory, not arithmetic. Hugging Face explains that each forward pass yields one next token, and the delay comes mainly from moving the model’s weights to the compute cores. NVIDIA’s introduction says each token needs a full pass that reloads weights, which leaves GPU compute underused. This is the decode phase described in LLM inference, and it reads the KV cache at every step.
Because the pass leaves compute idle, NVIDIA frames the goal as cutting the number of sequential steps, which is what speculation does.
How it works
- A cheap draft proposes a short run of tokens. NVIDIA gives 3 to 12 as a typical draft length.
- The target model scores all of them in one forward pass.
- A verification rule decides how many to keep. With greedy decoding, Hugging Face describes accepting tokens up to the first mismatch and keeping the main model’s own token at that point; with sampling, a modified rejection sampling step does the same job.
- The loop repeats from the accepted position.
NVIDIA’s post defines acceptance rate as accepted tokens over total generations; a higher rate means a bigger speedup. In the worst case every draft is rejected and the step still yields one target token, so each step makes at least that much progress.
The output stays the same
The Google authors say the method guarantees an identical output distribution. Chen and colleagues at DeepMind, who published the same idea as speculative sampling in February 2023, describe a modified rejection sampling scheme that preserves the target distribution “within hardware numerics.”
The vLLM docs add two caveats: outputs can still vary because of floating-point precision and batch size, and logprobs are not guaranteed stable across runs. Some methods are lossy on purpose; vLLM says its FLy verification “deliberately relaxes verification and is not distribution preserving.”
Methods
| Method | Where the draft comes from | Notes | Source |
|---|---|---|---|
| Draft model | A separate small model | Hugging Face says it must share the main model’s tokenizer and be roughly an order of magnitude smaller | Leviathan and colleagues, Chen and colleagues |
| Medusa | Extra decoding heads on the target, verified with tree attention | Medusa-1 trains the heads on a frozen backbone and the authors report over 2.2x with no loss of quality; Medusa-2 trains heads and backbone together for 2.3 to 3.6x | Cai and colleagues (2024) |
| EAGLE | A lightweight head that predicts the target’s hidden features | NVIDIA says it removes the cost of training and running a second model; the paper reports 2.7x to 3.5x latency speedup on LLaMA2-Chat 70B; NVIDIA describes the later EAGLE-3, which fuses low, middle and high features with a dynamic draft tree | Li and colleagues (2024) |
| MTP | Multi-token prediction heads built into the model | NVIDIA notes DeepSeek’s version uses specialized prediction heads | vLLM, NVIDIA |
| N-gram and suffix | Matches from the prompt or earlier text, no model | vLLM lists modest speedups without extra load at peak traffic | vLLM docs |
The speedups come from each paper’s own models and hardware and are not directly comparable.
How much it speeds things up
The original results were 2x to 3x on T5-XXL against the standard T5X implementation, and 2 to 2.5x on the 70-billion-parameter Chinchilla in a distributed setup. Hugging Face reports up to 2x for models that fit in GPU memory, up to 3x with INT8, and up to 10x on commodity hardware that relies on memory offloading. It adds that input-grounded tasks such as summarization benefit most and that lower temperatures keep more of the gain, because the draft matches more often. See LLM temperature.
In December 2024, Google Research said speculative decoding is used to produce AI Overviews in Google Search faster at the same quality.
When it does not help
vLLM describes the feature as meant to reduce inter-token latency under medium-to-low request rates and memory-bound workloads. At high load the GPU is already busy, so there is less spare compute to spend on drafts. vLLM adds that real gains depend on model family, traffic, hardware and sampling settings, and Hugging Face advises benchmarking on your own task.
What you see as a user
If you call a hosted API, the provider usually decides whether to use it, and you see it, if at all, as lower inter-token latency with the same text quality. If you serve models yourself, you choose a method and a draft length, then watch the acceptance rate and per-token latency alongside throughput.
Track time to first token and tail latency such as p99 latency before and after switching it on, because the benefit shows up in the decode phase, not in the wait for the first token. HoneyHive’s tracing concepts describe events that record model inputs, outputs and metadata such as token counts and cost, so you can compare runs on the same prompts. More in LLM monitoring and LLM cost optimization.
FAQ
What is speculative decoding?
It is an inference technique in which a faster draft proposes several tokens and the large target model checks them in one forward pass. Leviathan, Kalman and Matias introduced it as a way to compute several tokens in parallel while keeping the output distribution unchanged.
Does speculative decoding change the output?
In theory, no. The vLLM docs say sampling is lossless up to the precision limits of hardware numerics, though results can still vary with floating-point precision and batch size. Methods that relax verification are the exception.
How much faster is speculative decoding?
The original papers reported 2x to 3x on T5-XXL and 2 to 2.5x on Chinchilla. The gain depends on how often the target accepts the draft, so it varies by task, model and hardware.
When does speculative decoding not help?
When the system is not memory-bound. vLLM describes it as aimed at medium-to-low request rates and memory-bound workloads, and says the gain depends on model family, traffic, hardware and sampling settings.
Is speculative decoding the same as speculative sampling?
They are the same idea described by two teams. Leviathan and colleagues named it speculative decoding in November 2022, and Chen and colleagues at DeepMind named it speculative sampling in February 2023.