Speculative decoding is an inference acceleration technique where a small, fast 'draft' model (or the same model using a faster generation method) proposes a sequence of future tokens, which are then verified in parallel by the larger, target model. This process preserves the original model's output distribution and quality while significantly increasing generation speed, as the target model processes multiple tokens in a single forward pass instead of generating them autoregressively one-by-one. The key mechanism is the parallel verification and acceptance of a block of tokens.
Glossary
Speculative Decoding

What is Speculative Decoding?
A technique to accelerate large language model inference by using a draft model to propose tokens for parallel verification.
The technique is most effective when the draft model's predictions are highly accurate, leading to high acceptance rates. It directly reduces latency and lowers inference cost by improving hardware utilization. It is fundamentally different from model distillation and is often combined with other optimizations like KV caching and continuous batching. The draft model can be a separate, smaller network or a shallower version of the target model itself.
Key Characteristics of Speculative Decoding
Speculative decoding accelerates large language model inference by using a fast draft model to propose token sequences, which are then efficiently verified in parallel by the larger target model.
Two-Model Architecture
The technique relies on a draft-target model pair. The draft model is a smaller, faster model (e.g., a distilled version of the target) that proposes a sequence of future tokens. The target model is the original, larger, and more accurate model that verifies the draft's proposals in a single, parallel forward pass. This decouples the speed of proposal from the quality of verification.
Parallel Verification via Jacobian
Instead of generating tokens one-by-one, the target model performs a single forward pass on the draft's proposed sequence. It uses the Jacobian (full output distribution) to check each token in parallel. For each position, it compares the draft's proposed token against the target's predicted distribution. If the draft token matches the target's most likely token, it is accepted. This parallel check is the core mechanism for latency reduction.
The Acceptance/Rejection Algorithm
A probabilistic algorithm determines which draft tokens to accept.
- Acceptance: If the draft token matches the target's sampled token (based on the target's distribution), it is kept.
- Rejection: On the first mismatch, the draft token is rejected. The target model's distribution at that position is then used to sample a corrected token. All subsequent draft tokens in that sequence are discarded, and generation continues from the corrected point. This ensures the output distribution is identical to the target model's autoregressive output.
Wall-Time Speedup
The primary benefit is a reduction in time-to-first-token (TTFT) and time-per-output-token (TPOT). Speedup occurs because:
- The draft model's rapid proposals hide the latency of the target model's larger forward pass.
- Multiple tokens are verified in parallel, amortizing the cost of the target model's single pass.
- In practice, speculative decoding can achieve 2x-3x latency reduction for models like Llama 2 and GPT-3, with the exact gain depending on the draft model's quality and the task's predictability.
Identical Output Distribution
A critical guarantee of the algorithm is that the final generated text has an identical probability distribution to text generated autoregressively by the target model alone. This is not an approximation; it is mathematically proven by the acceptance algorithm. The draft model only influences the speed of generation, not the quality or statistical properties of the output. This makes it a lossless acceleration technique.
Implementation & System Considerations
Effective deployment requires careful engineering:
- Draft Model Selection: The draft model must be small (e.g., 7B parameter model drafting for a 70B target) and have a high token acceptance rate. A poor draft model leads to frequent rejections, negating the speedup.
- Memory Footprint: Both models must be loaded into GPU memory, increasing static memory requirements.
- Kernel Optimization: Custom kernels are needed to efficiently manage the two-model workflow and the parallel verification step. Frameworks like vLLM and TensorRT-LLM have integrated support for speculative decoding.
Speculative Decoding vs. Standard Autoregressive Decoding
A technical comparison of two core text generation algorithms, highlighting how speculative decoding accelerates inference while preserving output quality.
| Feature / Metric | Standard Autoregressive Decoding | Speculative Decoding |
|---|---|---|
Core Generation Mechanism | Generates one token per forward pass, sequentially. | Uses a small draft model to propose a block of tokens (γ), verified in parallel by the target model. |
Parallelization Strategy | Inherently sequential; no token-level parallelism within a single sequence. | Parallel verification of the proposed token block via the target model's forward pass. |
Theoretical Speedup | 1x (baseline). Speed is bound by the target model's latency per token. | Up to 2-3x for well-matched draft/target models, limited by draft accuracy and verification overhead. |
Output Fidelity | Guarantees the target model's exact output distribution. | Preserves the target model's output distribution; rejected drafts are corrected by the target model. |
Memory & Compute Overhead | Lower memory footprint; only the target model's KV cache is maintained. | Higher memory footprint; requires storing KV caches for both draft and target models simultaneously. |
Implementation Complexity | Low. Standard implementation for transformer-based LLMs. | High. Requires careful orchestration of two models, token alignment, and rejection sampling logic. |
Optimal Use Case | General-purpose serving, latency-sensitive applications where simplicity is key. | High-throughput batch inference, where the cost of draft model execution is amortized over many tokens. |
Key Bottleneck | Sequential dependency; latency is a linear function of sequence length. | Draft model quality. A low-accuracy draft leads to high rejection rates, negating speedup. |
Frequently Asked Questions
Speculative decoding is a key inference optimization technique for accelerating large language model generation. These questions address its core mechanisms, trade-offs, and practical implementation.
Speculative decoding is an inference acceleration technique where a small, fast draft model proposes a sequence of future tokens, which are then verified in parallel by a larger, more accurate target model, accepting valid tokens and regenerating only where discrepancies occur.
The process works in three stages:
- Drafting: The small draft model runs autoregressively to generate a short sequence of
kcandidate tokens (e.g., 3-5 tokens). - Parallel Verification: The target model processes the entire drafted sequence in a single, non-autoregressive forward pass. It produces logits for each position.
- Acceptance & Correction: Starting from the first token, the system compares the draft token against the target model's probability distribution. If the draft token's probability is high enough (typically via a modified sampling rule), it is accepted. The first rejected token triggers the target model to sample a correction from its distribution, and the remaining draft is discarded. The process repeats from this new position.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Speculative decoding is part of a broader ecosystem of techniques designed to reduce the latency and cost of generating text with large language models. These related concepts address different aspects of the inference pipeline.
KV Caching
A fundamental optimization that stores the computed Key and Value tensors for previously processed tokens during autoregressive generation. This eliminates the need to recompute attention for the entire prompt and prior context on each new token generation step.
- Direct Relationship to Speculative Decoding: Both the draft and target models in speculative decoding heavily rely on efficient KV caching to minimize per-token latency. The target model's verification step is parallelized partly due to cached keys and values.
- Performance Impact: Can reduce inference latency by 10x or more for long generation sequences.
- Memory Challenge: The KV cache is often the memory bottleneck for long-context models, leading to techniques like PagedAttention.
Early Exiting
An inference optimization where 'exit classifiers' are placed at intermediate layers of a neural network. If the classifier at an early layer is confident enough in its prediction, the inference halts, and the result is returned without traversing the full model depth.
- Contrast with Speculative Decoding: Both are 'adaptive computation' methods. Early exiting adapts depth (number of layers computed), while speculative decoding adapts width (using a draft model to propose multiple tokens for parallel verification).
- Best For: Classification tasks or generations where difficulty can be assessed early (e.g., simple factual queries).
- Limitation: Less effective for open-ended, creative text generation where later layers are crucial for coherence.
Mixture of Experts (MoE)
A neural network architecture where a routing network dynamically selects a small subset of specialized 'expert' sub-networks for each input token. This enables massive model capacity (e.g., trillion parameters) with a manageable computational cost per token.
- Shared Principle of Sparse Activation: Both MoE and speculative decoding are forms of conditional computation. MoE activates different parameters per token; speculative decoding conditionally uses a draft model.
- Performance Characteristic: MoE reduces FLOPs per token, while speculative decoding reduces latency per sequence by generating multiple tokens in parallel.
- Infrastructure Need: Both techniques add complexity to inference serving systems (e.g., managing expert routing or draft/target model coordination).

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us