Speculative Decoding and Draft Models: A Deep Dive into Local LLM Inference Acceleration

    Speculative decoding uses a lightweight draft model to predict multiple tokens and a larger target model to verify them in a single forward pass. This article explains the memory-wall bottleneck in autoregressive inference, how speculative decoding converts sequential work into a more parallel process, why average acceptance length determines its effectiveness, and how the technique can improve private LLM deployments in local and cloud environments.

    Introduction: The Performance Bottleneck in LLM Inference

    As large language models (LLMs) have grown from a few billion parameters to tens or even hundreds of billions, inference latency has become a major challenge for local and private cloud deployments. Even with high-end GPUs, many developers and enterprises find that generation speeds remain below expectations.

    This bottleneck is not caused solely by insufficient compute. It is also closely related to the underlying memory architecture. In recent years, a technique known as speculative decoding has become an important feature of major open-source inference frameworks. By introducing a lightweight draft model, it can deliver substantial inference speedups without requiring new hardware.

    The Memory Wall in LLM Inference

    To understand the value of speculative decoding, it is useful to examine the standard LLM inference workflow. A complete inference request is generally divided into two distinct stages: prefill and decoding.

    1. Prefill stage: After receiving a prompt, the model processes the entire input sequence at once. The GPU computes attention across all input tokens in parallel and generates the initial KV cache. Because many tokens are processed simultaneously, this stage is typically compute-intensive and makes good use of the GPU’s processing capacity.

    2. Decoding stage: Once prefill is complete, the model begins generating the response one token at a time. Under the autoregressive generation process, every new token requires the model to read the entire set of model weights—often tens or even hundreds of gigabytes—as well as the accumulated KV cache. After the forward pass, the key-value pairs for the new token are written back to the cache.

    The main problem occurs during decoding. Moving tens of gigabytes of data to generate a single token means that performance is determined largely by memory bandwidth rather than by the number of GPU compute cores. In computer architecture, this situation—where data movement limits computation—is known as the memory wall. A significant portion of the GPU’s compute capacity remains idle while waiting for data to be loaded from memory.

    How Speculative Decoding Works: Turning Sequential Generation into Parallel Verification

    Speculative decoding is designed to reduce the impact of the memory wall during decoding. Its central idea is straightforward: instead of having the large model generate one token at a time, use a smaller and faster draft model to predict several candidate tokens, then let the target model verify them together.

    The workflow is as follows:

    1. Draft prediction: Given a prompt such as “The cat,” the lightweight draft model quickly predicts several subsequent tokens, such as “sat on my lap.”

    2. Batch verification: The target model receives the candidate sequence and uses its parallel processing capability to calculate the probability distributions for those tokens in a single forward pass.

    3. Acceptance and correction: The target model compares the draft model’s predictions one by one. If the first two tokens, “sat on,” are consistent with the target model’s distribution, they are accepted directly. If the third token, “my,” is rejected, that token and all subsequent draft candidates are discarded. The target model then generates a corrective token according to its own distribution.

    With this approach, work that would normally require three or four sequential decoding steps can be completed in a single verification round. Because the draft model has far fewer parameters, generating candidate tokens requires much less data movement than repeatedly loading the full target model.

    Key Performance Metric: Average Acceptance Length

    Speculative decoding is not automatically beneficial in every situation. Its actual speedup depends heavily on one key metric: average acceptance length. This measures how many draft tokens the target model accepts on average during each verification round.

    Assume that the draft model predicts four tokens at a time:

    • Ideal case: If the target model accepts three of them, one forward pass advances generation by three positions. The system avoids two additional target-model weight-loading cycles while making better use of otherwise idle compute capacity. Overall generation speed improves significantly.

    • Pessimistic case: If the draft model frequently predicts incorrectly, the target model may accept only one token—or none—per round. The system must then perform the verification work while also paying the cost of unsuccessful draft generation. In some cases, this additional overhead can make generation slower rather than faster.

    For this reason, the degree of probability-distribution alignment between the draft model and the target model is critical. In practice, teams often select a smaller model from the same model family as the target model. Such models commonly share similar data and training strategies, which can lead to better alignment and higher acceptance rates.

    Engineering Practice and Cloud Deployment Considerations

    Speculative decoding has now been adopted by many mainstream inference frameworks. Developers generally do not need to implement the underlying verification logic from scratch. Instead, they can enable the feature by configuring the draft model path and the relevant parameters in an existing inference framework.

    The technique can also provide substantial value in cloud deployments. For example, when privately deploying an LLM on GPU compute instances through Baidu AI Cloud, speculative decoding can improve generation speed by several times for individual requests. Even as concurrent requests increase and pressure on GPU memory bandwidth grows, it can still provide meaningful throughput improvements.

    This allows enterprises to support more concurrent workloads without increasing hardware procurement costs, reducing the inference cost per token.

    Conclusion

    Speculative decoding uses a division of labor between a small draft model and a large target model. By having the smaller model propose tokens and the larger model verify them, it takes advantage of the mismatch between available compute capacity and memory bandwidth, providing an effective acceleration path for both local and cloud-based LLM inference.

    As the technique continues to evolve, more advanced verification strategies—such as tree-based speculative decoding—are emerging. These approaches may create further opportunities to improve inference efficiency. For developers and enterprises, understanding how speculative decoding works and introducing a suitable draft model in the right scenarios can be an important step toward improving the return on investment of LLM applications.