Speculative Decoding Explained: How Small Models Make Large Models Faster

Speculative Decoding Explained: How Small Models Make Large Models Faster

Speculative decoding explained simply is this: a small, fast draft model guesses the next few tokens, and the large target model checks all of those guesses in a single forward pass, keeping the ones it agrees with. Speculative decoding explained in one sentence matters because it can cut generation latency by roughly two to three times without changing a single output token. The central question is how a shortcut can be free, and the answer is that verification uses a rejection sampling rule which guarantees the final text has exactly the same distribution as ordinary decoding from the large model alone.

Language models generate text one token at a time, and each token costs a full forward pass through billions of parameters. At small batch sizes that step is limited by memory bandwidth: the hardware spends its time reading weights, not doing arithmetic.

Speculative decoding exploits that imbalance by getting several tokens out of each expensive weight read, turning a memory-bound process into a more efficient one. It needs no retraining, no change to the model weights and no new hardware.

Key takeaways

  • Speculative decoding uses a small draft model to propose tokens and the large model to verify them in one pass.
  • The original papers reported roughly two to three times faster generation with output distribution unchanged.
  • Speedup depends on the draft acceptance rate, which is highest on predictable text and lowest on surprising text.
  • EAGLE and Medusa are newer variants that draft without a separate small model.
  • It helps single-user latency most and adds little when the GPU is already saturated by large batches.

Why one token at a time is slow

Autoregressive generation is sequential by definition: each token depends on all the ones before it, so the model cannot produce the next token until the current one exists. On a GPU, a single-token step at batch size one reads the entire weight set from memory to perform a small amount of arithmetic, which means the step is bound by how fast weights can be moved, not by how fast they can be multiplied. The hardware is mostly waiting.

How the draft and verify loop works

Each cycle has two phases. In the drafting phase, a small model, often ten to a hundred times smaller than the target, generates a short run of candidate tokens, typically between three and twelve.

Because the draft model is small, this is fast. In the verification phase, the target model scores the whole draft sequence in one batched forward pass and compares its own probabilities with the draft’s at each position.

The acceptance rule is what makes the method exact rather than approximate. A candidate token is accepted when the target model would have been at least as likely to produce it as the draft model was; otherwise it is rejected with a probability that depends on the ratio of the two probabilities.

At the first rejection, a replacement token is sampled from a corrected distribution and the remaining candidates are discarded. If every candidate is accepted, the target model adds one bonus token of its own, so a cycle can yield more tokens than were drafted.

The result is a mathematical guarantee, not a hope: the tokens produced are distributed exactly as if the target model had generated them one at a time. That is why the technique is described as lossless. A poor draft simply means fewer tokens accepted per cycle, and in the worst case the system falls back to roughly the speed of ordinary decoding, plus the small cost of drafting.

The papers behind the idea

The modern form of the technique comes from two independent papers. Yaniv Leviathan, Matan Kalman and Yossi Matias at Google Research posted “Fast Inference from Transformers via Speculative Decoding” on arXiv in November 2022, reporting roughly two to three times faster generation on T5-XXL, an 11-billion-parameter model, with a 77-million-parameter T5-small as the draft model. Separately, Charlie Chen and colleagues at DeepMind published a closely related method called speculative sampling in February 2023, reporting speedups of about two to two and a half times on the 70-billion-parameter Chinchilla model.

An earlier precursor, blockwise parallel decoding from 2018, predicted several future tokens with extra heads, but it only worked with greedy decoding and did not preserve the full sampling distribution. The 2022 and 2023 papers added the rejection sampling step that guarantees the output is unchanged, which made the idea safe for production. The name comes from speculative execution in CPU design, where a processor runs instructions along a predicted branch before the outcome is known.

Choosing a draft model

The draft model should be much smaller than the target, share its tokenizer and come from the same model family where possible, since a same-family model has learned similar patterns and its guesses match more often. A one-billion-parameter draft for a 70-billion-parameter target is a common pairing.

Size is a trade-off, not a race to the smallest. A draft model that is too small guesses badly, so most candidates are rejected and the verification pass is wasted. A draft model that is too large guesses well but costs almost as much as the target, leaving no saving.

The number to watch is the acceptance rate: the share of drafted tokens the target keeps. If it is low, the draft model or the draft length needs changing. Best for: teams serving a large model to few concurrent users, where latency matters more than total throughput.

Draft length matters too. Longer drafts offer more tokens per verification pass, but each extra draft token is less likely to be accepted, because the draft is guessing further into the future. Most deployments settle on four to eight draft tokens per cycle and tune from measured acceptance rates rather than from theory.

An engineer watching latency graphs on a large monitor in an office
Acceptance rate is the number to watch: it shows how often the draft model’s guesses survive verification, and it decides whether speculative decoding pays off.

EAGLE, Medusa and other variants

Keeping a separate draft model adds operational work: it must be versioned, loaded and kept in step with the target, and every fine-tune of the target needs a matching draft. Two newer approaches remove that burden.

Medusa, published by Cai and colleagues in 2024, adds extra prediction heads to the target model itself, each predicting a token at a different future position. EAGLE, published by Li and colleagues in 2024 and presented at ICML, drafts at the level of the target model’s hidden features rather than tokens, and reported latency speedups of 2.7 to 3.5 times on LLaMA2-Chat 70B with output unchanged.

Support in serving engines is now broad. vLLM documents speculative decoding with a draft model, and llama.cpp, LM Studio and Ollama all provide ways to enable it for local serving.

The configuration is usually a draft model path, a draft token count and, in some engines, a choice of method such as EAGLE. For more on the engine side, see our guide to continuous batching for LLMs, which covers the serving stack speculative decoding plugs into.

When speculative decoding helps, and when it does not

Speculative decoding helps most when the GPU is underused: single-user chat, local serving and low-concurrency APIs. In those settings the weights are read once per token and mostly wasted, so verifying several tokens per read is nearly free. It helps least when the GPU is already saturated by a large batch, because a big batch already reuses each weight read across many requests and there is little spare capacity to exploit.

Text predictability matters as much as load. Boilerplate, code and structured output are easy to predict, so acceptance is high; creative writing and high-temperature sampling are harder, so the gain shrinks. Measure acceptance per workload rather than assuming one number for the whole product.

There is also a memory cost: the draft model needs its own weights and KV cache, which reduces memory for the target model and concurrent requests. Our guide to KV cache optimisation explains how to weigh cache pressure against speed.

Comparing speculative decoding approaches

Approach How it drafts Main strength Main weakness Best for
Draft model (Leviathan et al. 2022) Small model from same family Lossless, well supported Second model to operate General production serving
Speculative sampling (Chen et al. 2023) Small model, sampling-aware Preserves sampling distribution Second model to operate Non-greedy generation
EAGLE (Li et al. 2024) Feature-level draft network High acceptance, no second model Needs a trained draft head Maximum single-user speed
Medusa (Cai et al. 2024) Extra heads on target model No second model to run Heads need training Greedy and structured output
Prompt lookup Repeats text from the prompt No training or extra model Only helps repetitive text Code and quoted material

Speculative decoding checklist

  • Baseline latency and tokens per second are measured without speculative decoding, per workload.
  • The draft model shares the target’s tokenizer and comes from the same model family where possible.
  • Draft length starts at four to eight tokens and is tuned from measured acceptance rates.
  • Acceptance rate is tracked per workload, not assumed from published results.
  • Output quality is spot-checked against non-speculative output to confirm the distribution is unchanged.
  • GPU memory is checked after loading the draft model, including its KV cache.
  • High-temperature and creative workloads are measured separately from predictable ones.
  • The feature is disabled under high batch sizes if measurements show no gain there.
  • Draft and target model versions are updated together so they do not drift apart.
  • A fallback to ordinary decoding exists if the draft model fails to load.

Frequently asked questions

Does speculative decoding change what the model writes?

No, when the rejection sampling rule is used correctly. The verification step guarantees the output distribution matches ordinary decoding from the target model alone. That guarantee is the reason the original papers describe the method as lossless.

How large should the draft model be?

Small enough to run quickly and large enough to guess well, often ten to a hundred times smaller than the target. A one-billion-parameter draft for a 70-billion-parameter target is a common pairing. Watch the acceptance rate: if it is low, the draft is too weak or mismatched.

Why is my speedup smaller than the published two to three times?

Published results used predictable tasks and single-request batches on datacentre hardware. Creative text, high sampling temperatures and large concurrent batches all lower the gain. Measure acceptance rate on your own traffic to see which factor applies.

Does speculative decoding work with sampling, or only greedy decoding?

It works with sampling. The rejection sampling rule was designed to preserve the full output distribution, including temperature and top-p sampling, which is what separates the 2022 and 2023 papers from the earlier blockwise approach that only supported greedy decoding.

Can I use speculative decoding without a second model?

Yes, through EAGLE or Medusa, which draft from the target model itself, or through prompt lookup, which drafts from the input text. Each needs some setup or training, but none requires operating a separate small model.

Is speculative decoding worth it at high concurrency?

Often not. Large batches already reuse each weight read across many requests, so there is little spare capacity for verification to exploit.

It pays best at low concurrency, where latency rather than total throughput is the constraint. For more on the batching side, see our guide to FP8 inference, which covers another way to speed up the decode phase.

Latest articles

Scroll to Top