IN THIS BREAKDOWN · 10 SECTIONS
You can read 20% of this breakdown.
The paper in one minute
A large language model generates text one token at a time, and each step is a full forward pass. For big models at small batch sizes, that pass spends most of its time reading weights and the KV cache from memory; the arithmetic units sit mostly idle. Running the model on five positions at once costs about the same wall time as running it on one.
Speculative decoding uses that slack. A small, fast draft model (the paper calls it the approximation model) generates γ guesses autoregressively. The large target model then scores the prefix plus all γ guesses in a single parallel pass, getting its own probability for each position. Guesses are checked left to right with speculative sampling: keep a guessed token x with probability min(1, p(x)/q(x)). At the first rejection, discard the remaining guesses and sample a replacement from the normalized positive part of p − q. If every guess survives, the target pass also yields one more token for free.
The rule guarantees the output has exactly the target model's distribution, with greedy decoding, temperature, top-k or nucleus sampling, because all of them can be expressed as sampling from an adjusted distribution. Each target pass produces between 1 and γ + 1 tokens, so it is never slower in target passes than standard decoding. With a per-token acceptance rate α (the expected overlap Σ min(p, q)), the expected tokens per pass is (1 − α^(γ+1)) / (1 − α).
On T5-XXL with T5-small as the draft, the authors measured 2.3-3.4x faster decoding on one TPU-v4, with identical outputs and no retraining. Drafts about 100 times smaller than the target worked best; even a bigram model reached α = 0.2.
Research notes: the problem, approach and results
faster decoding of T5-XXL (11B) with a T5-small draft, same outputs, batch size 1 on a TPU-v4
the output distribution equals the target model's for any draft model, temperature or sampling method
acceptance rate even a bigram model achieves as a draft for T5-XXL translation, worth about 1.25x
Large language models generate one token per forward pass, and each pass mostly waits on reading weights and KV cache from memory rather than on arithmetic. Generating K tokens takes K serial passes, so latency grows with output length while the GPU's compute sits idle.
Let a much smaller draft model guess the next gamma tokens, then run the target model once over all of them in parallel. Keep each guess with probability min(1, p/q), where p and q are the target's and draft's probabilities; at the first rejection, sample a replacement from the normalized excess of p over q. This speculative sampling rule makes the output exactly distributed as the target's, for any draft.
On T5-XXL (11B) with T5-small (77M) drafting, decoding ran 2.3-3.4x faster on one TPU-v4 with identical outputs: 3.4x for greedy translation and 2.6x with sampling. Small drafts accepted 53-88% of tokens across T5, LaMDA and GPT-like models.
Why it matters to an FDE
Latency at small batch sizes is where interactive products hurt: chat, coding assistants, agents that wait on each response. Speculative decoding is one of the few optimizations that cuts it without changing the model's outputs, which makes it easy to approve: quality can't regress.
It needs spare compute. The gain comes from idle arithmetic during memory-bound decoding. At high batch sizes, where the GPU is already compute-bound, verifying rejected guesses costs throughput. It's a latency tool first.
The draft decides the gain. Acceptance rate α and the draft's relative cost c set the speedup. A draft from the same model family, roughly 100 times smaller, is the paper's sweet spot; drafts that are too large accept more but cost too much (T5-large gave only 1.4-2.2x).
Free drafts exist. n-gram models, or copying text that already appears in the context, cost almost nothing to run. The paper proposes the copying idea for edits and rewrites, where the output repeats the input.
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 149 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦2 results tables
- ?5 interview questions with answers
- 03Key takeaways
The acceptance rule, the speedup formula, choosing gamma, operations cost and three misreadings
Free account - 04How it works
The algorithm, the acceptance rate, the walltime and operations formulas, choosing gamma
Premium - 05The numbers that matter
T5-XXL walltime results, acceptance rates across models, theory vs measurement
Premium - 06Try it yourself
Recompute the tables, verify exactness, run speculative decoding on a toy model and pick gamma
Premium - 07Where it breaks
Batch size, draft cost, vocabulary match, measurement scope and slips
Premium - 08Using it on a deployment
Picking a draft, measuring alpha and c, choosing gamma, and when to turn it off
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
