Speculative decoding is an inference acceleration technique where a small, fast 'draft' model (or the target model using a shallow computation) proposes a sequence of candidate tokens. The larger, target LLM then verifies these tokens in a single, parallel forward pass, accepting correct tokens and rejecting only the first incorrect one. This process, also known as assisted generation or speculative sampling, leverages the fact that verification is cheaper than generation, reducing overall latency.
Glossary
Speculative Decoding

What is Speculative Decoding?
Speculative decoding is a technique for accelerating the text generation of large language models by using a smaller, faster model to draft tokens that are then verified in parallel by the primary model.
The technique provides a speedup by reducing the number of sequential decoding steps required from the large model. It is most effective when the draft model has high prediction accuracy, as incorrect proposals force a fallback to standard autoregressive generation. This method directly optimizes time-to-first-token and throughput, making it a key strategy for cost and resource management in production LLM serving without altering the final output distribution.
Key Characteristics of Speculative Decoding
Speculative decoding is a latency-reduction technique that accelerates autoregressive generation by using a smaller, faster model to draft tokens, which are then verified in parallel by the primary model.
Draft & Verify Architecture
The core mechanism uses a two-model system. A small, fast draft model (e.g., a distilled version of the target) proposes a sequence of γ (gamma) candidate tokens. The larger, more accurate target model then processes this entire sequence in a single, parallel forward pass to verify its correctness, accepting tokens until the first mismatch.
Wall-Time Speedup
The primary benefit is a reduction in end-to-end latency, typically achieving 1.5x to 3x faster generation. This occurs because the target model's expensive, sequential autoregressive steps are replaced with fewer, batched verification steps. The speedup is most effective when the draft model has high prediction accuracy, leading to longer accepted sequences.
Lossless Accuracy Guarantee
A critical property is that the output distribution is mathematically identical to that of the standard autoregressive target model. The verification step ensures no degradation in output quality; it only accelerates the sampling process. This makes it a safe optimization for production systems where output consistency is paramount.
Memory & Compute Trade-off
The technique trades off different resources:
- Increased Memory Bandwidth: The parallel verification pass requires loading the full KV cache for the draft sequence, increasing memory bandwidth pressure.
- Reduced Serial Steps: The number of sequential GPU kernel launches is reduced, alleviating a major bottleneck.
- Draft Model Overhead: The system must host and run the draft model, adding memory footprint, but its cost is offset by the reduced target model steps.
Optimal Draft Model Selection
The draft model's performance is crucial. Common strategies include:
- Using a distilled version of the target model.
- Employing a smaller, same-family model (e.g., using Llama 3 8B to draft for Llama 3 70B).
- A task-specific n-gram or lookup model for highly predictable text. The goal is to maximize the acceptance rate (the number of draft tokens verified per step) while minimizing the draft model's latency.
Related Inference Optimizations
Speculative decoding is often combined with other techniques:
- PagedAttention/vLLM: Efficient KV cache management is essential for handling the longer sequences verified in parallel.
- Continuous Batching: The draft-and-verify step can be batched across multiple user requests.
- Model Quantization: Applying INT4/INT8 quantization to the draft model further reduces its latency, enhancing the overall speedup.
Speculative Decoding vs. Other Inference Optimizations
A comparison of speculative decoding against other prominent techniques for accelerating and reducing the cost of LLM inference.
| Feature / Metric | Speculative Decoding | Dynamic Batching | Model Quantization (e.g., INT8) | KV Cache Optimization (e.g., PagedAttention) |
|---|---|---|---|---|
Core Optimization Principle | Parallel verification of draft tokens | Grouping concurrent requests | Reducing numerical precision of weights/activations | Efficient memory management of past token states |
Primary Performance Gain | Increased tokens/sec (throughput) | Increased tokens/sec (throughput) | Reduced latency & memory footprint | Reduced memory waste, increased concurrency |
Impact on Model Output | Mathematically identical to target model | No impact on output | Potential minor accuracy loss | No impact on output |
Hardware Requirement Change | Requires a small draft model | No change | Requires hardware support for low-precision math (e.g., INT8 cores) | No change |
Memory Overhead | Additional memory for draft model & parallel processing | Increased memory for larger batch sizes | Reduced memory footprint (e.g., ~4x for INT8) | Reduced fragmentation, allows larger batch sizes |
Best Suited For | Improving latency of large, slow target models | Improving throughput under variable load | Deploying models on memory-constrained or latency-sensitive hardware | Serving scenarios with high concurrency and long sequences |
Implementation Complexity | High (requires draft model, verification logic) | Medium (requires dynamic scheduler) | Low (PTQ) to Medium (QAT) | Medium (requires integration with serving engine like vLLM) |
Typical Latency Reduction | 1.5x - 3x | Improves throughput, not per-request latency | 1.5x - 4x | Reduces out-of-memory errors, improves throughput stability |
Implementation and Practical Considerations
Speculative decoding is a powerful inference acceleration technique, but its successful deployment requires careful engineering trade-offs. This section details the practical systems, architectural decisions, and cost models involved.
Draft Model Selection
The choice of draft model is the primary engineering decision. It must be:
- Significantly faster than the target model (often 3-10x) to offset verification overhead.
- Architecturally aligned (e.g., same tokenizer) to ensure token compatibility.
- Sufficiently accurate to maintain a high acceptance rate. Common strategies include using a smaller version of the same model family (e.g., Llama 3 8B drafting for Llama 3 70B) or a heavily distilled model. The draft model's size directly impacts memory footprint and cost.
Verification & Rollback Mechanism
The core of speculative decoding is the parallel verification step. The target model processes the proposed token sequence in a single forward pass. The system then performs a token-by-token comparison between the draft and target model outputs.
- Acceptance: Tokens are accepted until the first mismatch.
- Rollback: Generation rolls back to the first incorrect token, which is replaced by the target model's corrected output. This deterministic correction ensures output quality is identical to standard autoregressive generation. Efficient implementation requires careful tensor masking and index management.
Performance & Speedup Factors
The actual speedup is not guaranteed and depends on several variables:
- Draft Acceptance Rate: The probability the draft's next token matches the target's. Higher rates (e.g., >80%) yield better speedups. This rate is task and data-dependent.
- Draft Length (k): The number of tokens proposed per step. There's a trade-off: longer drafts increase potential speedup but risk lower acceptance rates for later tokens. Optimal
kis typically 3-5. - Hardware Parallelism: Speedup is maximized when the verification forward pass time is less than generating
ktokens autoregressively. This requires sufficient parallel compute (e.g., large batch size on GPU). The theoretical max speedup isk.
Cost & Memory Trade-offs
Speculative decoding introduces a cost-memory-latency trade-off:
- Compute Cost: While it reduces time-to-first-token and increases tokens/second, it requires running two models. The cost efficiency gain depends on the draft model's cheapness relative to the speedup achieved.
- Memory Overhead: The draft model and the parallel verification batch increase GPU memory consumption. The draft's KV cache must also be managed.
- Infrastructure Complexity: Requires hosting and loading two models, complicating serving systems. The benefit is greatest for large, slow target models where the latency reduction provides significant user experience or cost-per-token improvements.
Use Cases & Limitations
Ideal for:
- Chat applications with long, interactive sessions where low latency is critical.
- Batch inference jobs (e.g., summarization) where high throughput reduces cost.
- Larger models (70B+ parameters) where the relative cost of the draft is small.
Less effective for:
- Very small target models where the draft offers little relative speed advantage.
- Tasks with highly unpredictable outputs (e.g., creative writing) where draft acceptance rate plummets.
- Memory-constrained environments where loading two models is prohibitive.
Frequently Asked Questions
Speculative decoding is a leading-edge technique for accelerating large language model inference. This FAQ addresses the core technical questions developers and CTOs have about its mechanisms, trade-offs, and 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 the larger, target model, accepting correct tokens and rejecting only the first incorrect one to speed up generation.
It works through a three-stage process:
- Drafting: A small, computationally inexpensive model (the drafter) generates a short sequence of
kcandidate tokens autoregressively. - Verification: The target LLM processes the entire drafted sequence in a single, parallel forward pass, producing probability distributions for each token position.
- Acceptance/Rejection: The system compares the draft tokens against the target model's distributions. It accepts a block of
ntokens wheren ≤ k, stopping at the first token where the draft's probability falls below a threshold. Only the rejected token and subsequent ones need to be generated by the target model, saving the computation of the accepted tokens.
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 accelerate inference and reduce computational cost. These related concepts address different facets of the performance optimization challenge.
Continuous Batching
Also known as in-flight batching, this is a serving optimization that dynamically adds new requests to a running batch as previous sequences finish generation. Unlike static batching, it eliminates idle GPU time caused by variable-length sequences, maximizing hardware utilization and throughput. It is a foundational technique often used in conjunction with speculative decoding to improve overall server efficiency.
- Key Mechanism: Manages a pool of active requests, scheduling token generation in waves.
- Benefit: Dramatically increases tokens per second (TPS) in multi-user serving scenarios.
- Example: A request finishing early doesn't stall the batch; a new request is immediately slotted in.
KV Cache
The Key-Value (KV) Cache is a memory optimization for transformer decoder blocks. It stores computed key and value tensors for all previously generated tokens during autoregressive decoding. This prevents the recomputation of these tensors for every new token, which is the primary computational bottleneck. Speculative decoding relies heavily on efficient KV cache management, as both the draft and target models use their own caches.
- Purpose: Trade memory for compute, reducing latency per token.
- Challenge: Memory footprint grows linearly with sequence length and batch size.
- Optimization: Techniques like PagedAttention (from vLLM) manage this cache in non-contiguous blocks to reduce fragmentation.
Model Quantization
A model compression technique that reduces the numerical precision of a model's weights and activations (e.g., from 32-bit floating-point to 8-bit integers). This decreases memory footprint and increases compute speed on hardware with optimized integer units. Quantization is often applied to the draft model in speculative decoding to make it extremely fast and cheap to run.
- INT8/FP8: Common formats for inference, offering 4x memory reduction vs. FP32.
- GPTQ/AWQ: Advanced algorithms for quantizing to very low precision (e.g., 4-bit) with minimal accuracy loss.
- Use Case: A 4-bit quantized, small model serves as an efficient draft model, while the target model may run in higher precision.
PagedAttention & vLLM
PagedAttention is an algorithm that manages the KV cache in fixed-size, non-contiguous blocks (pages), analogous to virtual memory in operating systems. It is the core innovation behind the vLLM inference serving engine. This eliminates memory fragmentation caused by variable-length sequences, allowing for near-zero waste in KV cache memory. This efficient memory management is critical for serving systems implementing speculative decoding at high concurrency.
- Solves: External and internal fragmentation of KV cache.
- Result: Enables higher batch sizes and better GPU utilization.
- Ecosystem: vLLM is a production-grade serving system that natively supports speculative decoding.
Early Exiting
An inference acceleration technique where certain input samples exit the neural network through intermediate layers rather than passing through all layers. The heuristic is that 'easier' tokens or sentences can be accurately predicted with less computation. This is conceptually related to speculative decoding as both are adaptive computation methods, but early exiting modifies the depth of computation for a single model, while speculative decoding uses a separate draft model.
- Mechanism: A confidence metric (e.g., entropy) at intermediate layers determines if inference can halt early.
- Contrast: Speculative decoding modifies the breadth of token exploration per step using a separate model.
- Goal: Reduce average latency, particularly for non-uniform difficulty inputs.
Inference Cost & Tokens Per Second
The core business metrics that speculative decoding directly optimizes. Inference Cost is the total financial expenditure of generating tokens, driven by GPU time and memory. Tokens Per Second (TPS) is the primary throughput metric for LLM serving. Speculative decoding aims to increase TPS for a given model (reducing latency) and/or maintain TPS with a lower effective compute cost, thereby driving down the cost per token.
- Direct Impact: A successful speculative decoding system can increase TPS by 2-3x for the same hardware.
- Metric: Performance is measured by speedup (wall-time time reduction) and acceptance rate (how many draft tokens are verified).
- Trade-off: Must account for the added cost of running the draft model versus the time saved.

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