Speculative Decoding: Accelerating LLM Inference Without Hardware Upgrades
This article explains why autoregressive decoding is limited by memory bandwidth, how speculative decoding uses a small draft model and a target model to verify multiple candidate tokens in one forward pass, what determines the speedup through average accepted length, and which practical tuning and monitoring factors matter for local or private deployments.
1. The Root Cause: Why LLMs Generate One Token at a Time
A typical LLM inference run has two phases. During prefill, the model processes the entire user prompt at once, computes many tokens in parallel, and builds the KV cache. GPU compute is well utilized in this phase. Once decoding begins, however, the situation changes fundamentally: the model can generate only one token at a time.
To generate the next token, the GPU must move tens or even hundreds of gigabytes of model weights and the existing KV cache from memory to the compute units, perform the calculation, write the new key and value entries back to the cache, and then repeat the process. During this loop, the GPU’s large compute units spend most of their time waiting for data. In other words, the decoding bottleneck is not compute but memory bandwidth and data movement speed.
A useful analogy: generating each character requires flipping through the entire encyclopedia again. The cost of flipping through the book far exceeds the benefit of reading one character. That is the resource waste inherent in token-by-token generation.
2. Speculative Decoding: A Small Model Drafts, a Large Model Reviews
The core idea of speculative decoding is to assign the “easy guessing” part to a much smaller draft model and leave the “review” to the target LLM.
The workflow is as follows:
- Based on the current context, the draft model quickly predicts several candidate tokens in sequence. For example, after the input “The cat,” it may produce “sat on my lap.”
- The target model verifies these candidate tokens in parallel against its own probability distribution in a single forward pass.
- Accepted tokens are adopted directly. At a rejected position, the target model generates a corrected token, and all subsequent candidates are discarded.
The key point is that because the target model itself is an autoregressive probability distribution, verifying multiple candidates can be completed in one forward pass. Its computational cost is close to generating a single token, but memory movement happens only once. A process that originally required three or four rounds of “read weights, compute, write cache” is compressed into one verification round. More importantly, regardless of how many candidates are accepted, the final output distribution remains mathematically consistent with what the target model would produce when generating independently. Output quality is therefore unaffected—the target model always retains control.
3. What Determines the Speedup: Average Accepted Length
Speculative decoding is not guaranteed to be a net win. The metric that really determines the benefit is average accepted length: the average number of draft tokens accepted by the target model per round.
- If the draft model predicts four tokens at a time and three are accepted on average, one target-model forward pass advances roughly four positions, which is a significant gain.
- If the draft model guesses incorrectly frequently, the target model must repeatedly reject and correct. Drafting itself also has a cost, so overall speed may actually decrease.
Therefore, choosing a draft model requires three conditions:
- Distribution correlation: the closer its output distribution is to the target model’s, the higher the acceptance rate. A common approach is to use a compact version from the same model family.
- Small enough size: drafting overhead must be much lower than the data movement cost of one target-model forward pass, typically one to two orders of magnitude smaller.
- High enough speed: the draft model’s per-token generation latency must be clearly lower than that of the target model.
Task type also affects results. Highly predictable scenarios such as code generation and structured text tend to have higher acceptance rates. Highly divergent creative writing scenarios see a reduced benefit.
4. Practical Considerations and Tuning Recommendations
When deploying speculative decoding locally, consider the following:
- Do not blindly increase draft length: more candidate tokens raise the upper bound of the benefit per verification, but also increase the drafting cost wasted when candidates are rejected. Adjust dynamically based on measured average accepted length.
- Gains change under concurrency: single-request speedup may be high, but as concurrent requests increase, batching itself already helps amortize memory movement costs. The relative benefit of speculative decoding declines, although it usually still delivers a meaningful throughput improvement.
- Framework support: mainstream inference frameworks are increasingly adding native support for speculative decoding. Usually, you only need to specify an additional draft model when loading the target model. Illustrative pseudocode:
target_model = load("target large model")draft_model = load("small model from the same family")engine = InferenceEngine(model=target_model,draft_model=draft_model,num_speculative_tokens=4 # number of candidates drafted per round)for chunk in engine.generate(prompt):print(chunk, end="")
- Monitoring metrics: before deployment, track metrics such as average accepted length, output tokens per second, and extra draft-model latency, then iterate on the draft model and parameter configuration accordingly.
5. Conclusion
The value of speculative decoding is that it does not depend on more expensive GPUs or further model compression. Instead, it improves the utilization of the memory bandwidth bottleneck severalfold by changing the generation mechanism. For developers running LLMs locally or in private environments, matching the workload with a suitable draft model is often one of the highest-return optimizations available. As inference frameworks continue to improve support for this capability, “small model drafts, large model verifies” is likely to become a standard configuration for high-throughput inference.
