Home Knowledge Base Speculative Decoding

Speculative Decoding is the inference acceleration technique that uses a small, fast draft model to generate multiple candidate tokens in parallel, which are then verified by the large target model in a single forward pass — achieving 2-3x speedup in autoregressive LLM inference without any change to the output distribution, because verification of K draft tokens costs approximately the same as generating one token from the large model.

The Autoregressive Bottleneck

Standard LLM inference generates one token at a time: each token requires a full forward pass through the model, and the next token depends on the previous one (sequential dependency). For a 70B parameter model, each forward pass takes ~30-50 ms on a single GPU, limiting throughput to ~20-30 tokens/second regardless of available compute — the process is memory-bandwidth bound, not compute bound.

How Speculative Decoding Works

1. Draft Phase: A small model (e.g., 1B parameters, 10x faster) generates K candidate tokens autoregressively: t₁, t₂, ..., tₖ. 2. Verification Phase: The large target model processes the original context plus all K draft tokens in a single forward pass (parallel evaluation, like processing a prompt). This produces the target model's probability distributions for each position. 3. Acceptance/Rejection: Starting from t₁, each draft token is accepted with probability min(1, p_target(tᵢ)/p_draft(tᵢ)). If a token is rejected, it is resampled from an adjusted distribution. All tokens after a rejection are discarded. 4. Guarantee: The acceptance-rejection scheme ensures the output distribution is mathematically identical to sampling directly from the target model — zero quality degradation.

Why It Works

LLM inference is memory-bandwidth bound: loading the model weights from GPU memory dominates the time, and the compute units are underutilized. Verifying K tokens requires loading the weights once (same as generating one token) but performs K times more useful compute. The speedup approaches K × acceptance_rate, where acceptance_rate depends on how well the draft model approximates the target.

Variants and Extensions

Speculative Decoding is the key insight that LLM inference wastes most of its computational capacity generating one token at a time — and that parallel verification is essentially free, converting wasted compute into real throughput gains.

speculative decodingdraft model verificationparallel token generationassisted generation llmspeculative sampling

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.