Speculative Decoding with Draft Models for Faster LLM Inference
This article explains how speculative decoding with draft models accelerates LLM inference. It covers why autoregressive decoding is memory-bound, how draft generation and parallel verification preserve output quality, key draft-model design requirements, dynamic path selection, measured latency and throughput gains, and practical deployment recommendations.
1. Why Inference Speed Has Become a Key Bottleneck for LLM Deployment
As large models enter a phase of continuous iteration, training and inference are no longer isolated from each other: data generated during inference flows back into training, and environmental feedback drives parameter updates, forming a closed loop. In this loop, decoding speed directly determines the upper bound of data-generation throughput, the response latency experienced by users, and the output efficiency per unit of compute.
The fundamental problem with autoregressive decoding is token-by-token serial generation: each time the model generates a token, it must complete a full forward pass and wait for the result before generating the next token. For models with hundreds of billions of parameters, each forward step involves massive weight reads, while the actual amount of arithmetic computation is relatively limited. As a result, the decoding process remains memory-bound for a long time, and GPU compute utilization stays low.
At the same time, resource scheduling, data management, computational consistency, and inference performance are interconnected, and any weak link in one area can be amplified. Reproducing the validated performance of a new model in a real runtime environment and locating bottlenecks across the model, runtime, software, and hardware layers is a key bridging step in the AI engineering chain.
2. Speculative Decoding: Breaking Serial Generation with Parallel Verification
Speculative decoding is a mainstream technical approach to the serial decoding problem. Its core idea can be summarized as “a small model drafts, and a large model reviews”:
- Draft generation: A draft model with far fewer parameters than the target model quickly generates several candidate tokens based on the current context. The draft model has lightweight single-step computation and can produce multi-step speculation at high frequency and low cost.
- Parallel verification: The target model performs one forward pass over the candidate token sequence produced by the draft model and verifies whether these tokens are consistent with the target model’s distribution. Because a Transformer can process multiple tokens in one forward pass, verifying multiple candidates costs far less than generating them one by one.
- Accept or roll back: Accepted tokens are adopted directly. At the first inconsistent position, the process rolls back from that point and resamples according to the target model’s distribution, then enters the next round.
Because the verification process mathematically guarantees that the output distribution is exactly consistent with the target model, speculative decoding preserves generation quality while changing “one token per step” into “potentially multiple tokens per step,” greatly reducing end-to-end decoding latency.
3. Key Design Considerations for the Draft Model
The effectiveness of speculative decoding depends heavily on the quality of the draft model. A well-designed draft model needs to satisfy the following requirements at the same time:
- Distribution alignment: The draft model’s output distribution should be as close as possible to that of the target model. The higher the acceptance rate of draft tokens, the more tokens are produced per verification round on average.
- Extreme lightweight design: The draft model’s own forward-pass latency must be low enough; otherwise, drafting cost will consume the gains from parallel verification.
- Co-deployment with the target model: The draft model and target model should share the vocabulary and context-processing logic to avoid frequent encoding and decoding conversion overhead.
In real engineering practice, draft models are usually obtained from the target model through distillation, pruning, or layer truncation. They form a matched pair within the same technical stack rather than an independently trained third-party model. This ensures distribution alignment and simplifies version management.
4. Dynamic Path Selection and Reusable Deployment Design
The benefits of draft models vary greatly across scenarios. In low-entropy contexts, the model’s subsequent direction is highly deterministic, and long drafts have a high acceptance rate. In high-entropy, highly divergent generation scenarios, overly long drafts instead waste compute due to frequent rollbacks. To address this, a dynamic path selection mechanism can be introduced:
- Adjust the draft length and speculation strategy for the current round in real time based on signals such as the entropy of the current context and draft confidence.
- Lengthen drafts for highly certain segments to increase parallel output, and shorten drafts for highly uncertain segments to reduce rollback overhead.
- Encapsulate these strategies in the inference engine and expose them as a configurable, reusable solution, so users can enable acceleration without understanding internal details.
An illustrative pseudocode example is as follows:
def speculative_decode(model, draft_model, ctx, max_new_tokens):out = []while len(out) < max_new_tokens:k = estimate_draft_length(ctx) # Dynamically determine draft lengthdrafts = draft_model.generate(ctx, k) # Draft multiple candidates with the draft modelverified = model.verify(ctx, drafts) # Verify candidates in parallel with the target modelout += verified # Accept the consistent prefixctx = ctx + verifiedreturn out
5. Measured Benefits: Gains in Both Single-Concurrency Latency and High-Concurrency Throughput
On a deployment with a model with hundreds of billions of parameters, eight high-performance GPUs, and tensor parallelism degree 8, comparative tests were conducted for a 32K low-entropy context scenario:
- Single-concurrency decoding speed reached 288.2 tokens/s, about 3.41x that of native autoregressive decoding, significantly improving response latency in interactive scenarios.
- Aggregate throughput at 64 concurrent requests reached 608.71 tokens/s, a 44.9% improvement over the native approach, also providing considerable benefits for throughput-sensitive scenarios such as batch data processing and offline generation.
It is worth noting that the single-concurrency speedup (3.41x) is much higher than the high-concurrency throughput improvement (44.9%). This is consistent with the inherent characteristics of speculative decoding: under high concurrency, batched verification across requests competes for the same GPU compute and memory resources, and the per-request advantage of “multiple tokens in parallel” is partially diluted. However, for typical low-entropy long-context workloads, throughput and latency can still benefit at the same time.
6. Recommendations for Production Deployment
- Locate the bottleneck first: Confirm that the decoding stage is indeed memory-bound before introducing speculative decoding; otherwise, the gains may be offset by compute bottlenecks.
- Tune parameters by scenario: Low-entropy long-form scenarios are suitable for aggressive draft strategies, while open-ended generation scenarios should favor conservative configurations.
- Monitor quality consistency: The verification mechanism guarantees distribution equivalence, but it is still recommended to run regression comparisons with business evaluation sets before launch.
- Build a closed loop: Include decoding speed, acceptance rate, and rollback rate in monitoring metrics, and continuously feed the results back into iterating the draft model and scheduling strategy.
Speculative decoding represents an engineering approach of trading collaborative system design for inference efficiency: it does not modify the target model itself, but through the combination of a draft model and parallel verification, it approaches the hardware throughput ceiling without sacrificing quality. As the training-inference closed loop becomes a standard paradigm for LLM iteration, such inference acceleration solutions will become an indispensable foundational capability in AI engineering systems.
