Fast Inference from Transformers via Speculative Decoding
Fast Inference from Transformers via Speculative Decoding
Problem
Framing
Autoregressive Transformer latency scales linearly with the number of decoded tokens because each token needs one serial target-model pass. The paper closes this with speculative decoding: a small draft model proposes tokens, the large model verifies them in parallel, and exact output distribution is preserved while reaching roughly – speedups on T5-XXL and Chinchilla-class models.
Currently Used Methods
Direct antecedents
- @hintonDistillation2015 — compresses a large model into a smaller student for cheaper inference.
- Limitation in context: reduces quality or requires model replacement, not exact target-model decoding.
- @chenCodex2021 — uses lightweight drafting and verification for code generation.
- Limitation in context: specialized to code-edit settings, not exact general autoregressive sampling.
- "Attention Is All You Need" — standard autoregressive Transformer decoding with KV caching.
- Limitation in context: still needs one serial target-model pass per emitted token.
- "Fast Inference from Sequence Models via Speculative Execution" — speculative execution for sequence transduction.
- Limitation in context: assumes aligned outputs, not arbitrary next-token Transformer decoding.
Proposed Method
Architecture
Two autoregressive models share the same tokenizer and sampling standardization: a large target model and a much cheaper approximation model . Each step lets draft continuations autoregressively, then runs once on the prefix plus drafted tokens to verify several positions in parallel.

Loss / Objective
The paper is algorithmic.It defines an adjusted fallback distribution after rejection:
Sampling Rule / Algorithm
Accept each drafted token with a modified rejection rule; on rejection, resample from the residual of over .
Training Procedure
- Draft LM example: 6M-parameter GPT-like decoder on lm1b.
- Draft LM dimensions: hidden size 256.
- Feed-forward width: 1024.
- Layers: 2.
- Attention heads: 4.
- Context length: 8k tokens.
- Verification width: drafted tokens per step.
Evaluation
Datasets
- lm1b unconditional language modeling.
- EnDe translation with T5 family.
- Summarization with T5 family.
- Chinchilla-class language modeling.
Metrics
- Empirical speedup factor.
- Acceptance rate .
- Cost coefficient .
- Expected vs empirical runtime improvement.
Headline results
- T5-XXL EnDe, , T5-small draft: , , expected , empirical .
- T5-XXL EnDe, , T5-base draft: , , expected , empirical .
- T5-XXL EnDe, , T5-large draft: , , expected , empirical .
- T5-XXL with lenience on EnDe: improvement rises from at to at .
- Example generation: 38 tokens require only 9 serial large-model runs.
Ablations
- Draft model size: larger drafts raise but can hurt net speedup when grows.
- Sampling mode: argmax yields higher and larger speedups than temperature-1 sampling.
- Lookahead : optimal increases as rises and decreases as rises.
- Lenience: relaxing exactness increases and can push speedup to on T5-XXL.

Method Strengths and Weaknesses
Strengths
- Exact decoding distribution is preserved despite multi-token drafting.
- One target-model pass can emit several tokens in parallel.
- Theory predicts runtime gains well enough to choose .
- Works across language modeling, translation, and summarization setups.
Weaknesses
- Gains depend sharply on acceptance rate .
- A stronger draft model can erase speedup by increasing cost .
- Exact method still needs target-model evaluation every iteration.
- Reported maximal gains are near without relaxing exactness.
Suggestions from the authors
- Design better approximation models that maximize at fixed cost .
- Exploit relaxed exactness with lenience for larger practical speedups.
- Optimize implementations to reduce system overhead beyond the theoretical model.
- Extend speculative decoding to broader Transformer inference settings.
Links
Prior Papers
- @hintonDistillation2015 — distillation is a core baseline for reducing inference cost with smaller models.
- @chenCodex2021 — provides a direct precursor that also uses draft-and-verify generation.
Further Papers
- @kwonvLLM2023 — extends the systems view of speculative decoding for LLM serving.
- @daoFlashAttention2_2023 — targets the same Transformer inference bottleneck from the kernel side.
- @jiangMixtral2024 — overlaps on fast large-model inference where speculative decoding is a natural complement.