Speculative Decoding: How Draft Models Accelerate Large Language Model Inference
Speculative decoding speeds up large language model inference by using a small, fast draft model to propose several tokens that the target model verifies in a single forward pass. This article explains why the decode phase is bottlenecked by memory bandwidth rather than compute, how the draft-and-verify process works, why the technique is mathematically lossless, and which factors—especially average acceptance length and draft length—determine the actual speedup, followed by practical deployment tips.
Where Large Language Model Inference Is Slow: Two Phases and the Bandwidth Wall
To understand why speculative decoding works, it helps to first look at the two distinct phases inside a single inference pass.
Prefill phase: After the user submits a prompt, the model processes the entire input in parallel, computing the attention distribution and building the KV cache (key-value cache). Because a large number of tokens can be processed in parallel, this phase has high computational density and is primarily limited by GPU compute.
Decode phase: Once the model starts generating its answer, it switches to autoregressive mode and produces only one token at a time. To generate the next token, the GPU must read all of the model weights and the existing KV cache, complete one forward pass, and then write the new key-value data back into the cache. The whole process is highly serial.
The root of the problem lies in the decode phase. Model weights that run into tens of gigabytes, or even hundreds, mean that generating each token requires repeatedly moving massive amounts of data between memory and compute units. What determines speed at this point is often no longer how many compute units the GPU has, but memory bandwidth—the speed of data movement becomes the real ceiling. This is what the industry commonly calls the “memory wall.”
Draft Models: Outsourcing the Easy-to-Guess Work
The core insight behind speculative decoding is to let a small, fast “draft model” handle most of the predictable work, so the target large model can focus on verification.
A simple example: given the input “The cat,” the draft model guesses several tokens in a row, such as “sat on my lap.” The target large model then needs only a single forward pass to evaluate these candidates at once:
- If the first few candidate tokens match the target model’s probability distribution, they are accepted directly;
- As soon as one token is rejected, it and all candidates after it are discarded;
- The target model generates a corrected token at the rejection point and starts the next round.
The essence is to verify multiple positions with one pass through the large model. Content that previously took the model three or four autoregressive rounds to advance now has a chance of being compressed into a single verification pass. The draft model is small and cheap to run, so generating candidates costs far less than repeatedly reading the full weights through the large model—and what gets saved is precisely the most expensive memory movement.
It is worth emphasizing that speculative decoding is “lossless” mathematically. Through a specific accept-reject sampling strategy, the final output distribution is strictly identical to that of the original target model. In other words, the speedup does not sacrifice generation quality—and this is exactly what sets it apart from compression techniques such as quantization and pruning.
The verification flow can be written as the following pseudocode:
def speculative_generate(draft_model, target_model, prompt, gamma=4):output = prefill(target_model, prompt)while not done:# 1. Draft model autoregressively guesses gamma tokensdraft_tokens = draft_model.generate(output, num_tokens=gamma)# 2. Target model runs one forward pass to verify all candidates at onceprobs = target_model.forward(output, draft_tokens)# 3. Accept / reject token by tokenaccepted = 0for t in draft_tokens:if accept(t, probs):accepted += 1else:breakoutput += accepted_tokens# 4. If not all tokens are accepted, the target model generates a correctionif accepted < gamma:output += target_model.correct()return output
Average Acceptance Length: The Core Metric Behind the Speedup
Speculative decoding may look like a “free lunch,” but what really determines the payoff is one key metric—the average acceptance length: the average number of draft tokens the target model accepts per round.
Suppose the draft model predicts 4 tokens at once:
- If 3 of them are accepted, the large model has advanced 3 tokens with a single forward pass—a significant gain;
- If it guesses wrong frequently, the target model must keep rejecting and correcting, and the extra draft overhead actually slows the whole process down.
So the speedup can be roughly understood as positively correlated with the average acceptance length: the longer the accepted draft and the higher the hit rate, the more effective tokens are produced per unit of time. In some test scenarios, a sound draft strategy can boost single-request generation speed severalfold, and as concurrency grows, it can still deliver meaningful throughput improvements.
Writing More Drafts Doesn’t Necessarily Mean Faster
There is a common misconception here: that the longer the draft model guesses, the better. The opposite is true—there is a “sweet spot.”
- Draft too short: the hit rate is high, but too few tokens advance per round, and the fixed overhead of the draft calls and the large model cannot be fully amortized, so the gain is limited;
- Draft too long: the further out you guess, the higher the chance of rejection; and once a position is rejected, all subsequent candidates are discarded along with it, which amounts to a lot of wasted work.
The optimal draft length depends on how well the draft and target models are “aligned,” the type of task, and hardware characteristics. It usually needs to be tuned empirically on the target scenario rather than simply increased.
A Few Practical Points
- Choose a draft model from the “same family and same domain”: a small model with the same vocabulary as the target model and a similar domain tends to have a higher hit rate. Ideally, distill one from the same model family or pick a small model from the same lineage.
- Focus on the acceptance rate, not just the draft length: keep monitoring the average acceptance length to judge whether the draft model is actually worthwhile.
- The payoff changes under concurrency: under high concurrency, the compute that was originally “idle” during the decode phase gets filled by multiple requests, so the relative impact of the bandwidth bottleneck decreases. The speedup from speculative decoding may narrow, though it often still brings a throughput improvement.
- Combine it with an inference framework: mainstream inference frameworks have progressively built in speculative decoding support, and together with scheduling techniques such as continuous batching, the gains can be further amplified in production deployment.
- There is no free acceleration: the draft model itself occupies some memory and compute, so you need to weigh the overall memory budget before deployment.
Conclusion
What makes speculative decoding elegant is that it neither modifies the model itself nor relies on more powerful hardware. Instead, it reorganizes how tokens are generated—turning the serial “load one token at a time” process into batch advances that can be verified in parallel. For developers who want to speed up local inference without swapping GPUs or sacrificing quality, understanding and making good use of draft models is becoming an essential skill that is hard to avoid.
