Speculative Decoding Explained: How Draft Models Accelerate LLM Inference by Nearly 4×
As large language models grow, inference is increasingly limited by memory bandwidth rather than raw compute. Speculative decoding addresses this bottleneck by using a fast draft model to predict several tokens and a larger target model to verify them in a single forward pass. This article explains the mechanism, the role of average acceptance length, and key engineering strategies for deploying the technique effectively.
As large language models continue to grow in parameter count, efficient inference under limited hardware resources has become a major challenge for developers and enterprises. Recent demonstrations from the open-source AI ecosystem have shown that, on the same hardware and with the same target model, changing only the token-generation strategy can increase single-request generation speed by nearly four times and improve throughput by approximately two times under concurrency.
This approach does not require replacing the GPU or compressing and quantizing the large model. It is known as speculative decoding, a technique that has attracted significant attention in modern LLM inference.
1. The Memory-Bandwidth Bottleneck in LLM Inference
To understand speculative decoding, it is useful to first examine how large-model inference works. A standard inference process generally consists of two stages: prefill and decoding.
During prefill, the model processes the complete user prompt in a concentrated computation and builds the KV cache. Because many tokens are processed at once, this stage has high computational density and is primarily limited by the GPU’s floating-point performance.
Once the model begins generating a response, it enters the decoding stage. In traditional autoregressive generation, the model produces and outputs only one token at a time. To generate the next token, the GPU must read the model’s large parameter weights, access the accumulated KV cache, and then write the newly generated key-value data back to the cache. This process is repeated for every token.
Modern LLMs can have tens or even hundreds of gigabytes of weights. As a result, much of the decoding time is spent moving data rather than performing computations. The GPU’s compute units may remain underutilized, while inference becomes constrained by memory bandwidth instead of computational capacity.
This is the fundamental reason large models appear to “reload themselves” one token at a time.
2. Speculative Decoding: Collaboration Between Draft and Target Models
Speculative decoding addresses this bandwidth bottleneck through a division-of-labor strategy. Inspired by branch prediction in CPUs, it uses a small and fast draft model to assist a larger target model.
The draft model first makes speculative predictions. Given a prompt, it quickly generates a sequence of candidate tokens. For example, after receiving the input “The cat,” it might predict the continuation “sat on my lap.” Because the draft model has far fewer parameters, it can read its weights and generate tokens much faster than the target model.
The target model then performs batch verification. In a single forward pass, it evaluates the candidate sequence generated by the draft model using its more capable representations. If the first two tokens—“sat” and “on”—match the target model’s probability distribution, they are accepted directly. If the third token, “my,” is rejected, the remaining speculative tokens are discarded, and the target model generates a corrective token itself.
In a conventional process, the target model might need three or four separate decoding rounds to produce the same number of tokens. With speculative decoding, that work can be compressed into one verification pass. The low cost of the draft model effectively exchanges inexpensive speculative computation for fewer repeated forward passes through the large model, reducing redundant memory-bandwidth usage.
3. The Key Metric: Average Acceptance Length
Speculative decoding is not a free performance gain. Its effectiveness depends heavily on one central metric: average acceptance length, or the average number of draft-model tokens accepted by the target model during each verification pass.
Suppose the draft model predicts four tokens and the target model accepts three of them. One target-model computation has advanced generation across multiple positions, producing a substantial speedup. This indicates that the draft and target models have a high degree of agreement in their probability distributions.
However, if the draft model frequently makes incorrect predictions, the target model cannot fully benefit from batch verification. It must repeatedly reject speculative tokens and generate replacements. The additional computation and rejection handling can consume resources and introduce latency, potentially making the overall process slower.
For this reason, speculative decoding is not universally beneficial. Its performance is strongly correlated with the draft model’s prediction accuracy and its agreement with the target model.
4. Engineering Practices and Optimization Strategies
To maximize the benefits of speculative decoding in production, developers should focus on several areas.
1. Choosing the Draft Model
The draft model should not be so large that its generation cost offsets the speedup. At the same time, its output distribution should be as close as possible to that of the target model.
In practice, a smaller model from the same model family and with the same or a closely related architecture is often the preferred choice.
2. Using a Dynamic Draft Length
A fixed number of speculative tokens may perform very differently across contexts. In highly predictable scenarios, such as code completion, increasing the draft length may improve performance.
For complex reasoning tasks, however, shortening the draft length can produce a higher overall acceptance rate and avoid unnecessary speculative computation.
3. Framework Integration and Cloud-Native Support
Speculative decoding has been incorporated into a number of mainstream open-source inference frameworks. When building cloud-based or local inference services, developers can use an inference engine or general-purpose container platform that supports the technique and configure it as part of a multi-model serving pipeline.
For example, Baidu AI Cloud’s general AI computing and container services can be used to orchestrate inference workflows containing both draft and target models, helping organizations make more flexible use of available resources.
5. Conclusion
Speculative decoding introduces a lightweight draft model to address the memory-bandwidth bottleneck in large-model inference. By allowing the target model to verify multiple candidate tokens in a single forward pass, it provides a cost-effective way to accelerate local and hosted LLM deployment without changing the GPU or compressing the target model.
As cloud-native inference platforms integrate this technique more deeply, developers will be able to run models with tens or even hundreds of billions of parameters with lower deployment complexity and improved efficiency. Understanding mechanisms such as average acceptance length—and selecting and configuring the draft model appropriately—will become an important engineering skill for production AI systems.
