Fast Inference from Transformers via Speculative Decoding
Leviathan, Kalman & Matias in Inference & systems
A small model drafts, a big one verifies: same outputs, 2–3× faster
Fast Inference from Transformers via Speculative Decoding
Decoding is serial and memory-bound
One full forward pass of the large model per token. The GPU mostly waits on memory reads while its compute sits idle.
A cheap model guesses several tokens ahead. The large model scores all guesses in one parallel pass and keeps the longest valid prefix.
Spare compute buys fewer serial steps.
Accepted drafts in green, rejections in red

Each line is one iteration. The small model proposes tokens; the target model accepts the green ones, rejects the red, and supplies a correction in blue.
Speculative sampling keeps the exact distribution
- 1
Draft γ tokens
The approximation model Mq samples γ tokens one by one; it is cheap and fast.
- 2
Verify in parallel
The target Mp scores all γ+1 positions in a single forward pass.
- 3
Accept or resample
Keep each draft with probability min(1,p/q); at the first rejection, sample from the adjusted residual and stop.
The acceptance rule that guarantees identical outputs
Where the draft overestimates a token it is sometimes rejected; sampling from the residual fills the gap, so outputs follow the target exactly.
- p(x)
- Target model's probability
- q(x)
- Draft model's probability
- max(0,p−q)
- Mass the draft under-proposed, used on rejection
The smallest draft model gives the biggest speedup
T5-XXL (11B) target on WMT English-German. Greedy is temperature 0; sampling is temperature 1.
Speed depends on how well the draft guesses
Needs a matched draft
Speedup depends on the acceptance rate; a draft that diverges from the target wastes work.
Extra arithmetic
Total operations rise because rejected drafts are computed and discarded. It pays only when compute is idle.
Latency, not throughput
Gains target single-request latency; with large batches the GPU is already busy.
Why it matters
- Speculative sampling provably preserves the target model's output distribution, so no quality is traded.
- It works with off-the-shelf models: no retraining or architecture changes.
- Draft-and-verify now powers fast decoding in major LLM serving stacks.
11 upvotes on Hugging Face 8 slides, 2 min
30 Nov 2022