Speculative decoding is an inference acceleration technique where a small, fast 'draft' model (e.g., a distilled version) proposes a sequence of future tokens. This draft sequence is then processed in parallel by the larger, more accurate 'target' model, which accepts correct tokens and regenerates only the first incorrect one. This approach reduces the number of serial calls to the slower target model, cutting overall inference latency without altering the final output distribution.
Glossary
Speculative Decoding

What is Speculative Decoding?
Speculative decoding is a latency-reduction technique for autoregressive language model inference that uses a draft model to propose token sequences for parallel verification by a larger target model.
The technique hinges on efficient parallel verification. The target model scores the draft tokens in a single forward pass. A modified rejection sampling algorithm then determines the longest correct prefix. This is particularly effective for large language model serving, where the draft model's low cost is amortized by the target model's high parallel throughput. It is a form of algorithmic speculation that optimizes the autoregressive decoding bottleneck.
Key Characteristics of Speculative Decoding
Speculative decoding is a latency-reduction technique that uses a small, fast draft model to propose token sequences, which are then verified in parallel by a larger, more accurate target model.
Two-Model Architecture
The core mechanism relies on a draft model and a target model. The draft model is small and fast, often a distilled version of the target or a simpler architecture like an n-gram model. Its sole purpose is to generate a speculative continuation (e.g., γ tokens). The larger, more accurate target model then verifies this sequence in parallel, accepting correct tokens and regenerating from the first incorrect one. This decouples the task of rapid proposal generation from accurate verification.
Parallel Verification & Token Acceptance
Instead of generating tokens autoregressively one-by-one, the target model verifies the entire proposed sequence in a single, parallel forward pass. It computes the probability distribution for each speculative token position. A verification algorithm (like token-level acceptance) compares these distributions to the draft's outputs. Consecutive correct tokens are accepted; generation rolls back to and continues from the first mismatched token. This parallel check is the primary source of speedup, as it amortizes the cost of the large model's forward pass over multiple tokens.
Speedup via Reduced Decoding Steps
The theoretical speedup is determined by the acceptance rate and the relative costs of the two models. If the draft model is significantly faster and its proposals are frequently accepted, the effective number of slow target model runs is reduced. Key metrics include:
- Draft Efficiency: The time cost of running the draft model for γ steps.
- Acceptance Length: The average number of tokens accepted per verification step.
- The goal is for
(time_target) / (acceptance_length) > (time_draft + time_target) / (γ), making the process faster than standard autoregressive decoding.
Implementation & System Optimizations
Practical implementations require careful system design:
- KV Cache Management: Both models' key-value caches must be efficiently managed and shared where possible to avoid redundant computation.
- Batch Processing: The verification step naturally batches γ tokens, improving hardware utilization.
- Early Exit Strategies: Some systems implement logic to halt the draft early if confidence is low.
- Frameworks like Google's Medusa or vLLM's speculative sampling integrate these optimizations, handling the orchestration between draft and target models, including rollback logic and cache updates.
Draft Model Strategies
The choice of draft model is critical for performance. Common strategies include:
- Distilled Model: A smaller version of the target model trained to mimic its next-token predictions.
- N-gram or Lookup Model: Extremely fast, statistical models that lack coherence but can predict high-probability short sequences.
- Structured Drafting: Using multiple draft 'heads' or a tree-based structure to propose several potential continuations simultaneously, increasing the chance of acceptance.
- Self-Drafting: Where the target model drafts for itself using a faster, approximated mode (e.g., with early layers).
Trade-offs and Constraints
Speculative decoding introduces specific trade-offs:
- Memory Overhead: Requires hosting two models and managing multiple cache states.
- Draft Quality Dependency: Performance degrades if the draft model's predictions are poor, leading to low acceptance rates and wasted computation.
- Optimal Speculative Length (γ): There is a sweet spot for how many tokens to draft. Too few reduces parallelization benefit; too many increases the chance of error and wasted draft computation.
- Mathematical Guarantee: The process is lossless—the output distribution is identical to that of the target model alone, preserving quality.
Speculative Decoding vs. Standard Autoregressive Decoding
A technical comparison of two inference paradigms, highlighting how speculative decoding reduces latency by parallelizing token verification.
| Feature / Metric | Standard Autoregressive Decoding | Speculative Decoding |
|---|---|---|
Core Mechanism | Sequentially generates one token per forward pass, using the model's own output as the next input. | Uses a small 'draft' model to propose a block of γ (gamma) tokens, which are verified in parallel by the large 'target' model. |
Parallelization Potential | None. Computation is inherently sequential and serial. | High. The target model's forward pass verifies the entire proposed block in parallel via a modified attention mask. |
Wall-Clock Latency | High. Directly proportional to sequence length (O(n)). | Reduced. Speedup depends on draft model accuracy and block size. Theoretical upper bound is γ+1 times faster. |
Memory Access Pattern | Predictable, sequential reads/writes to the Key-Value (KV) cache. | Irregular. Requires efficient KV cache management for the draft model's proposals and the target model's parallel verification. |
Hardware Utilization | Low for large models, as most compute units are idle between token generations. | High. The single, large parallel verification pass fully utilizes GPU/NPU compute resources. |
Model Requirements | Single model (the target). | Two models: 1) A large, accurate target model. 2) A small, fast draft model (e.g., a distilled version). |
Token Acceptance Rate | 100% (by definition). | < 100%. Speedup is a function of the draft model's accuracy. Rejected tokens trigger a fallback to standard generation. |
Implementation Complexity | Low. Standard implementation in all frameworks. | High. Requires custom sampling logic, parallel scoring, and rollback mechanisms. |
Best-Suited For | Simple deployments, correctness-critical applications where any speed-accuracy trade-off is unacceptable. | Latency-sensitive applications (e.g., chat, real-time translation) where the draft model is highly aligned with the target's distribution. |
Frameworks and Implementations
Speculative decoding is a key inference acceleration technique for autoregressive models. It uses a fast draft model to propose token sequences, which are then efficiently verified in parallel by a larger target model, significantly reducing latency.
Core Mechanism: Draft & Verify
The technique operates in a two-stage loop. A small, fast draft model (e.g., a distilled version of the target) autoregressively generates a short sequence of K candidate tokens (the draft). This draft is then passed in parallel to the larger, more accurate target model, which uses a modified forward pass to verify the tokens. The target model scores each candidate token against its own predictions, accepting consecutive tokens until a discrepancy is found, at which point it rejects the rest and samples a correction. This allows the target model to generate multiple tokens from a single, parallelized forward pass.
Key Metric: Acceptance Rate
The effectiveness of speculative decoding is primarily determined by the acceptance rate—the probability that a token proposed by the draft model matches the target model's preferred token. A high acceptance rate means more tokens are generated per target model forward pass, maximizing speedup. The theoretical speedup is bounded by Speedup ≤ (1 / (1 - α)), where α is the acceptance rate. Performance hinges on the draft model's ability to approximate the target's output distribution.
Implementation: Lookahead Decoding
Lookahead decoding is a prominent implementation that eliminates the need for a separate trained draft model. Instead, it uses a drafting strategy based on the target model's own cached activations. Common approaches include:
- N-gram speculation: Using recently generated tokens to predict the next K.
- Jacobian speculation: Performing a single forward pass to generate multiple candidate continuations from different positions in the prompt. This 'self-drafting' simplifies deployment by avoiding a secondary model.
Hardware & System Optimizations
Speculative decoding exploits modern hardware parallelism. The verification step is implemented as a batched forward pass through the target model, which is highly efficient on GPUs/NPUs. Critical system-level optimizations include:
- Efficient KV-Cache Management: Sharing the key-value cache between draft and target verification steps to avoid recomputation.
- Memory-Bound Focus: The technique is particularly effective when inference is memory-bound (limited by reading model weights), as the parallel verification amortizes the memory access cost over multiple tokens.
Practical Trade-offs & Limitations
While powerful, the technique introduces trade-offs:
- Increased Memory Bandwidth: The parallel verification pass requires loading the full target model weights, which can increase peak memory bandwidth usage.
- Draft Model Overhead: The computational cost of running the draft model must be significantly less than the target model for a net gain.
- Sequence Length Sensitivity: Efficiency can degrade with very long sequences due to cache management complexity. It is most beneficial for large models (7B+ parameters) where the cost of a single forward pass is high.
Frequently Asked Questions
Speculative decoding is a key inference acceleration technique for large language models, particularly relevant for on-device deployment where latency and compute efficiency are paramount. These FAQs 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 tokens, which a larger, more accurate 'target' model then verifies or rejects in parallel. The core mechanism involves a draft-then-verify loop: the draft model generates a short sequence of K candidate tokens autoregressively. This candidate sequence is then fed to the larger target model in a single forward pass using a technique called parallel verification. The target model's output distributions are used to determine which draft tokens are accepted. Accepted tokens are kept, and generation continues from the first rejected token. This process reduces the number of costly forward passes required from the large target model, as multiple tokens can be generated per target model invocation when the draft is accurate.
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 a key technique in the broader ecosystem of methods designed to accelerate model inference, particularly for large language models. These related concepts are essential for engineers optimizing performance on edge hardware.
Continuous Batching
An inference optimization for autoregressive models where new requests are dynamically added to a running batch as previous requests finish generating tokens. This maximizes GPU utilization by eliminating idle time, unlike static batching which waits for the entire batch to finish.
- Key Benefit: Dramatically improves throughput in serving scenarios with variable-length sequences.
- Mechanism: Uses iteration-level scheduling to maintain a consistently full batch.
- Relation to Speculative Decoding: Both techniques aim to improve hardware utilization; speculative decoding accelerates a single sequence, while continuous batching optimizes across multiple concurrent sequences.
PagedAttention
An attention algorithm that manages the Key-Value (KV) cache in non-contiguous, paged memory blocks, analogous to virtual memory in operating systems. This enables efficient memory sharing for variable-length sequences and reduces fragmentation.
- Key Benefit: Allows for high-throughput serving of LLMs by efficiently handling requests of different lengths.
- Core Innovation: Decouples logical blocks of the KV cache from physical memory, enabling flexible allocation.
- Relation to Speculative Decoding: Speculative decoding generates a draft sequence whose KV cache must be managed. PagedAttention optimizes the memory system that underpins this cache management, making the verification step of speculative decoding more efficient.
Quantization
A model compression technique that reduces the numerical precision of a neural network's weights and activations (e.g., from 32-bit floating-point to 8-bit integers). This decreases model size and memory bandwidth requirements, accelerating inference.
- Types: Includes Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT).
- Hardware Impact: Lower precision arithmetic (INT8) is faster and more energy-efficient on modern CPUs, GPUs, and NPUs.
- Relation to Speculative Decoding: The draft model in a speculative decoding setup is often a quantized version of the larger target model, making it fast enough to run ahead without becoming a bottleneck.
Knowledge Distillation
A model compression technique where a smaller, more efficient 'student' model is trained to mimic the behavior or output distributions of a larger, more complex 'teacher' model.
- Objective: Capture the teacher's generalization capabilities in a smaller footprint.
- Methods: Can use logits (soft targets), intermediate features, or relational knowledge.
- Relation to Speculative Decoding: The draft model in speculative decoding is effectively a distilled, smaller version of the target model. It is trained to approximate the target's token predictions quickly, enabling the speculative execution pipeline.
Operator Fusion
A compiler optimization that combines multiple sequential neural network operations into a single, fused kernel. This reduces intermediate memory writes and kernel launch overhead.
- Common Fusions: Convolution + BatchNorm + Activation, or Linear + Activation.
- Benefit: Decreases latency and improves cache locality by keeping data in registers.
- Relation to Speculative Decoding: The efficiency of both the draft model (which must be extremely fast) and the parallel verification pass in the target model relies heavily on low-level optimizations like operator fusion to minimize per-token latency.
Inference Latency
The time delay, measured in milliseconds, between submitting an input to a machine learning model and receiving its output. It is the primary metric for real-time applications.
- Critical for: Chat applications, real-time translation, and interactive agents.
- Components: Includes compute time, memory I/O, and communication overhead.
- Relation to Speculative Decoding: Speculative decoding is a direct technique for reducing per-output-token latency for autoregressive LLMs. By verifying multiple tokens in parallel, it amortizes the cost of the slower target model's forward pass.

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