Drafting cheaply, verifying in one pass
A language model generates one token per forward pass, and each pass reads all of its weights from memory. For a single sequence that reading, not the arithmetic, sets the time, so a pass over positions costs about as much as a pass over one. Speculative decoding uses this. A small, fast draft model proposes the next tokens one at a time; the large target model scores all of them in one pass, keeps the longest run it agrees with, and adds one token of its own.
On this page Qwen2.5-0.5B-Instruct (494,032,768 parameters) drafts tokens for Qwen2.5-1.5B-Instruct (1,543,714,304 parameters). The two share a tokeniser, which the method needs: the target scores the draft's token ids. The prompt is “Why is the sky blue? Answer in one sentence.” in Qwen's chat template, 40 tokens. Two runs are recorded, greedy at temperature 0 and sampled at temperature 1 with seed 0.
One pass scores k + 1 positions
Under the causal mask, row of the target's pass depends only on the tokens up to . One pass over the context and the drafts therefore gives exactly the next-token distributions that separate passes would:
The block row shows this for round 1: block 1 of 28 of the target, scoring 5 positions, the 4 drafts and one more, with a verdict for each. Both models keep KV caches, and a rejected draft's entries are cropped from both.
With greedy decoding the check is a comparison. Each draft is kept while it equals the target's arg-max ; at the first disagreement the target's own token replaces it (a correction), and if all agree, the target's token after them comes free (a bonus):
The output is the target's own greedy output, token for token. In round 1 all 4 drafts match and “ because” comes free: 5 tokens from one target pass.
Rejection sampling keeps the target's distribution
When sampling, matching arg-maxes is not enough: the output must be distributed exactly as the target's . The rule of Leviathan et al. and Chen et al. keeps a draft with probability and, on a rejection, draws a replacement from the normalised residual:
The two branches add up to . A token is produced either by being drafted and kept, with probability , or by a rejection followed by the residual draw, with probability where :
At temperature 0 the rule reduces to the greedy one. The Draft vs target card shows both distributions at each position, and the residual on a rejection. In round 1 of the sampled run the draft proposed “ is” with , but the target gave it ; was above , so it was rejected and “ appears” was drawn from the residual. At that position the manifest checks the rule with 1,000,000 draws: 540,293 were kept, against expected.
What it buys
If each draft were kept independently with probability , a target pass would yield on average
and the speed-up would be about , where is the time of a draft pass relative to a target pass. Real text does not quite satisfy the independence; the Expected speed-up popup works through the formula.
The Cost card counts what happened. The greedy run made 32 tokens from 9 target passes, against 32 passes for the target alone: 3.56 tokens per pass, with 23 of 36 drafts kept (64 %) and five of the nine rounds ending in a bonus. The sampled run made 40 tokens in 20 passes, 2.00 per pass, keeping 21 of 80 drafts, and no round kept all four. At temperature 0 a draft only has to match the target's top token; at temperature 1 it is kept with probability , which is lower wherever the two distributions differ. The page counts passes, not seconds, and the 36 or 80 passes of the 0.49B draft cost time too.
Where it came from
Stern, Shazeer and Uszkoreit's blockwise parallel decoding (2018) had a model predict several future tokens at once and kept the longest prefix its scoring model agreed with, for greedy decoding. Leviathan, Kalman and Matias, and independently Chen et al., introduced drafting with a separate small model and the rejection-sampling rule that keeps the target's distribution exact.
Later methods draft with the target itself. The MTP tab uses MiMo's built-in multi-token prediction layer; in the Efficiency explainer, Medusa adds decoding heads, EAGLE drafts at the feature level, Lookahead uses Jacobi iterations, and LayerSkip drafts with the model's own early layers. Xia et al. survey the field.
Papers
- Fast Inference from Transformers via Speculative Decoding Speculative decoding with a draft model and the acceptance rule that keeps the target's distribution, with the expected-speed-up analysis.
- Accelerating Large Language Model Decoding with Speculative Sampling The same draft-and-verify scheme, found independently, with the modified rejection sampling and its proof.
- Blockwise Parallel Decoding for Deep Autoregressive Models Predicting several tokens in parallel and keeping the longest prefix the model verifies, the greedy precursor.
- Qwen2.5 Technical Report The Qwen2.5 family, whose 0.5B and 1.5B Instruct models are the draft and the target here.
- Unlocking Efficiency in Large Language Model Inference: A Comprehensive Survey of Speculative Decoding A survey of drafters, verification schemes and their speed-ups.
See also
- EfficiencyEAGLE EAGLE · feature-level draft model
- EfficiencyDFlash DFlash · a block-diffusion drafter
- EfficiencyDSpark DSpark · semi-autoregressive drafting and scheduled verification
- EfficiencyLookahead Lookahead decoding · Jacobi iterations and an n-gram pool
- EfficiencyDraft heads Draft heads compared · Medusa, EAGLE, DFlash and DSpark on the same two questions