Fast Inference from Transformers via Speculative Decoding
Yaniv Leviathan, Matan Kalman, Yossi Matias2023ICML 2023
Read it on arxiv.org(opens in a new tab)Why this one
Read this after Attention Is All You Need and Efficiently Scaling Transformer Inference. The trick is not to make the big model cheaper per token, but to stop asking it one token at a time when a smaller draft model can guess several likely next tokens. The big model then verifies a block in parallel, accepting the guesses that match its own distribution and repairing the first miss. People often describe this as approximate decoding, which misses the point: the paper is valuable because the sampling procedure preserves the target model's output distribution. That distinction matters if you serve models where quality regressions are hard to measure or legally risky. For an engineer, this is the cleanest example of an inference idea that spends extra FLOPs to buy wall clock latency. It also gives you the mental model behind later systems such as Medusa and production draft model stacks.
What to take away
- A small draft model proposes multiple tokens, while the large model verifies them in one parallel pass.
- The acceptance rule preserves the large model's sampling distribution, so speed does not require output drift.
- The speedup depends on draft quality, target batch shape, and unused parallel compute, not just model size.
Reads with
- Attention Is All You Need
defines the autoregressive transformer whose decoding loop this accelerates
- Efficiently Scaling Transformer Inference
sets up why token by token decoding, not training, becomes the serving bottleneck
- Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads
turns the draft model idea into extra heads that propose multiple future tokens