Drafting more than one token
A cheap draft can reduce expensive sequential target work. Incorrect verification changes the generated distribution. Follow acceptance, replacement, and suffix rejection before asking whether the whole round is faster.
#Section 19Speculative decoding
The large model takes a costly pass to produce one token. A cheaper model could propose several tokens in that time, but a fast guess is no substitute for the target, so the target has to check it.
Draft model, target model, and candidate tokens
Speculative decoding uses a cheap draft model to propose tokens and a target model to verify them. From the accepted prefix, the draft samples candidates autoregressively. The target then runs the candidate sequence through one causally masked forward pass, getting its next-token distribution at every candidate position.
Each candidate is still conditioned on the ones before it. Verification runs in parallel only because all proposed inputs are already known. If every candidate passes, the same pass also gives the distribution for a bonus token.
Verification and accept/reject behavior
For greedy decoding, compare each draft token with the target’s argmax under that prefix and keep the longest matching run. At the first mismatch, emit the target’s argmax, drop the remaining candidates, and draft again. With exact target computation and the same tie-breaking, this reproduces the greedy target output.
For sampling, keeping tokens that happen to match is not exact. Let be the draft probability of candidate and the target probability at the same prefix. Accept with probability
Read this as always accept proposals the draft underweights, and thin out those it overweights. On rejection, draw a replacement from the normalized positive difference max(0,p-q), drop later candidates, and continue. Use the distributions after the declared temperature and filters.
Accepting several tokens per target pass
The positive difference [max(0,0.3-0.6),max(0,0.7-0.4)]=[0,0.3] normalizes to [0,1], so every rejection becomes B. Final mass is [0.3,0.4+0.3]=[0.3,0.7], exactly the target.
In general, accepted mass at is min(p(x),q(x)) and the correction adds max(0,p(x)-q(x)); together they give p(x). Applied at each prefix, this preserves the target sampling distribution, though not identical sample paths unless the random draws are coupled.
Leviathan, Kalman, and Matias described exact speculative decoding in 2022, published 2023. Speculative decoding paper. The guarantee covers the declared target distribution, not a different sampler or approximate verification.
#Section 20Speculative decoding performance
A speculative implementation accepts many tokens and still runs slower than plain decoding. The verifier was efficient; the draft's cost and synchronization ate the saving.
Acceptance rate and draft-model speed
The acceptance rate is how often draft candidates survive verification. A smaller draft is cheaper but agrees less; a larger one agrees more but costs more. Measure agreement and cost together.
In a simplified model with draft length and a constant, independent acceptance probability per position, the expected tokens per round, counting the replacement or bonus token, is
Read this as a round always emits one token, a second if the first candidate survives, and so on up to all plus a bonus. Real acceptance varies with position and prefix; this is a simplification.
At K=4 and alpha=0.8, E[N]=1+0.8+0.64+0.512+0.4096=3.3616 tokens, an average over rounds rather than a count any round emits.
Verification cost and when speculation helps
With draft time per token, verification time , and ordinary target time per token, ignoring other overhead:
Read this as ordinary time for the expected output divided by one speculative round's time. Speculation helps when . Verification costs less than target passes but grows with .
Speculation has the most room when target decoding is bound by weight movement and verification reuses those weights across positions. At high batch or with a compute-heavy verifier the balance shifts, and draft memory, transfers, sampling, and synchronization all count. Measure end to end to pick the draft length.