Speculative Decoding

Speculative decoding is an inference-acceleration technique that produces several tokens per expensive forward pass of a large language model without changing its output distribution. A small, fast draft model proposes a short run of future tokens; the large target model then verifies all of them in a single parallel pass, accepts the longest prefix consistent with its own probabilities, and corrects the first token that disagrees. The result is the same text the target would have generated alone, produced in fewer of its costly passes.

Autoregressive decoding is memory-bound, so a pass has spare compute. Generating one token normally requires one full forward pass of the target, and because that pass is dominated by streaming the model's weights and KV cache from memory, the GPU's arithmetic units sit largely idle. Verifying K candidate tokens costs almost the same as generating one, since the extra tokens ride along in the same weight load. Speculative decoding exploits exactly this slack: it fills the underused compute of a single pass with the work of checking several guesses.

A draft proposes, the target verifies, and a sampling rule keeps it exact. The draft model (a smaller model, or the target with a cheaper head) autoregressively emits K tokens. The target scores all K in one batched pass and applies a rejection-sampling test: each drafted token is accepted with a probability that makes the accepted stream identical in distribution to pure target sampling. The first rejected token is resampled from a corrected distribution, and everything after it is discarded. Quality is provably unchanged — this is a pure speedup, not an approximation.

Standard decodingSpeculative decoding
Target passesone per tokenone per K-token block
Tokens per pass11 to K+1 (accepted+1)
Extra modelnonesmall draft model
Bottleneck usedmemory bandwidthreuses the same pass
Output qualitybaselineidentical distribution
Speedup driver—draft acceptance rate
Speculative decoding — draft cheaply, verify in one expensive pass Standard: one target pass per token Target model (large)one passtok 11 expensive pass = 1 tokenN tokens → N large-model passes Speculative: draft K, verify K together Draft (small)fast, cheapp1p2p3p4draft proposes K tokensTarget verify — ONE parallel passp1✓p2✓p3✓p4✗t4'resampledaccept matching prefix (p1–p3)4 tokens from 1 target pass · same output distribution Autoregressive generation needs one forward pass of the large model per token — the model is memory-bound, so each pass barely uses the compute it loads. Speculative decoding lets a cheap draft model guess several tokens ahead, then the target scores all guesses in a single batched pass, accepts the longest prefix that matches its own distribution, and resamples only the first mismatch — so several tokens emerge per expensive pass with identical output quality.

Speedup tracks the acceptance rate, and variants remove the separate draft. If the draft agrees with the target a fraction of the time, the expected tokens per pass grow with that acceptance rate and the drafted length K, commonly giving two-to-three times faster generation. The catch is that a bad draft wastes passes, so the draft must be cheap yet well-aligned with the target. Self-speculative methods like Medusa and EAGLE attach extra prediction heads to the target itself, and lookahead decoding drafts from n-gram guesses — all avoiding a second model while keeping the verify-in-parallel core.

Read speculative decoding through a quant lens rather than a 'guess ahead' lens: it trades cheap draft compute for fewer memory-bound target passes, and the payoff is governed by one number — the acceptance rate times the draft length, minus the draft's own cost. The design question is matching a draft that is fast enough to be nearly free against one accurate enough to be accepted often, since the technique only wins while the tokens saved per target pass outrun the draft overhead and the wasted work of rejected guesses.

Speculative Decoding — Draft then Verify a small draft model proposes γ tokens; the large target model verifies all γ in one forward pass One Speculative Decoding Step (γ = 5 draft tokens) 1. Draft (fast, small model) The cat sat on the ← 5 sequential small-model passes 2. Verify (one target-model forward pass over all 5) The ✓ cat ✓ sat ✓ on ✗ the ✗ ← one parallel forward pass 3. Accept "The cat sat" (3 tokens) + resample position 4 from target Why this is faster Normal decode: 5 tokens = 5 target passes Spec decode: 5 draft + 1 target = ~3 accepted Net: 3 tokens for cost of ~1.2 target passes acceptance rate α ≈ 0.7-0.9 typical speedup ≈ γ·α / (1 + γ·c) where c = draft/target cost Acceptance: Exact Distribution Match For each position i, accept draft token with probability: min(1, p_target(x_i) / p_draft(x_i)) If rejected: resample from adjusted distribution Guarantee: output ≡ target model distribution exactly Variants and Extensions Medusa extra heads on target (self-speculative) EAGLE feature-level draft from target hidden states Lookahead Jacobi-iteration parallel decode SpecInfer tree-structured speculation Real-World Speedups (decode phase only) Llama-70B + 7B draft 2-3× decode speedup Medusa-2 2.2× (no separate model) EAGLE-2 3-4× (context-aware) Speedup increases with acceptance rate; works best when draft closely matches target distribution The insight: verification is parallelizable (like prefill), but generation is sequential — speculate to batch verification. Speculative decoding converts sequential memory-bound decode steps into parallel compute — free speedup with no quality loss.

Take speculative decoding further

Ask the copilot about this term, or have our engineers assess it against your process.