Speculative Decoding: How Draft Models Speed Up LLM Inference Without New Hardware
On the same hardware, with the same model and the same prompt, LLM responses can vary several-fold in speed—yet much of this gap can be closed without swapping GPUs or shrinking the model further. This article explains speculative decoding, an inference acceleration technique that pairs a small draft model with a full target model to verify predicted tokens in a single forward pass. It covers why the decode phase is bound by memory bandwidth rather than raw compute, how a draft-and-verify approach turns multiple serial steps into one parallel pass, the key metric of average acceptance length, the tradeoffs of draft length and draft-model strength, and practical optimization directions for local inference.
1. Why Large Models Always Seem to “Load Themselves Token by Token”
When you use a large language model, you may notice that on the same machine, with the same model and the same prompt, some responses appear almost instantly while others still trickle out token by token—and without swapping GPUs or further shrinking the model, the gap can reach several times over. The key technique behind this is an inference acceleration method called speculative decoding, and the small draft model plays the role of the “speed pioneer.” Widely adopted by mainstream inference frameworks, this technique has become a topic you can hardly avoid when running large models locally. Let’s break down its working mechanism, key metrics, and engineering tradeoffs, starting from first principles.
To understand where the speedup comes from, first look at what happens inside a single LLM inference pass. It is usually divided into two distinct phases.
Prefill: After the user submits a prompt, the model processes the entire input at once, computing the attention relationships for all tokens in a single pass and building a key-value cache (KV Cache) for later reuse. This phase handles many tokens in parallel with high computational density, so performance is mainly constrained by compute.
Decode: Once prefill is done, the model generates the response token by token. The key point is that each round produces only one token, then appends it back to the context and repeats the entire computation to produce the next one.
The problem lies precisely in the decode phase. To produce the next token, the GPU must read the model weights and the accumulated KV Cache from GPU memory, and after computing, write the new key-value data back to the cache. A model that spans tens or even hundreds of gigabytes means every single token generation requires moving massive amounts of data between memory and the compute units. At this point, how many compute cores the GPU has is no longer the only deciding factor—memory bandwidth and data movement speed become the real bottleneck. This also explains why large models “always seem to load themselves token by token”: they spend much of their precious time repeatedly moving weights around rather than on actual computation.
2. The Core Idea of Speculative Decoding: Draft + Verify
Since the bottleneck is “one step at a time, repeatedly moving the full weights,” can we make each step cover more ground? Speculative decoding is designed around exactly this intuition.
Its core idea is this: hand off a portion of the relatively easy-to-predict work to a smaller, faster model to complete first, then let the large model focus on quality control.
The workflow can be summarized as “draft first, verify later”:
- A lightweight draft model first predicts several candidate tokens in a row based on the current context;
- The full-capability target model verifies these candidate tokens in a batch with a single forward pass;
- Position-by-position comparison: if a candidate token matches the target model’s probability distribution, it is accepted directly; once one does not match, everything from that position onward is rejected, the remaining draft is discarded, and the target model generates one correction token to fill in.
For example, given the input “The cat,” the draft model might guess “sat on my lap” in one go. The target model then verifies it in a single pass: if the first few tokens align with its distribution, they are adopted together; if some position is rejected, the sequence is truncated and recomputed. Content that the target model might have needed three or four rounds to generate now has a chance to complete in a single verification round. Because the draft model is very small, generating candidates costs far less than the target model repeatedly reading its full weights multiple times—that is where the gains come from.
3. How One Verification Pass Compresses Multiple Rounds of Computation
The reason speculative decoding speeds things up is that it turns “multiple serial small computations” into “one parallel large verification.” The core logic is shown below in pseudocode:
def speculative_decode(target_model, draft_model, prompt, gamma=4):sequence = prefill(target_model, prompt) # Prefill establishes the initial statewhile not finished(sequence):# 1) The draft model predicts gamma candidate tokens in a rowdrafts = draft_model.draft(sequence, n=gamma)# 2) The target model runs one forward pass to get candidate probabilities at each positionprobs, new_state = target_model.verify(sequence, drafts)# 3) Accept/reject position by position (standard acceptance rule)accepted = 0for token in drafts:p = probs[token] # target model probabilityq = draft_probs[token] # draft model probabilityif random() < min(1.0, p / q):accepted += 1else:break # acceptance failed; truncate from here# 4) Adopt the accepted tokens and have the target model add one correction tokensequence.extend(drafts[:accepted])sequence.append(target_model.resample(new_state))return sequence
Notice that no matter how many tokens are accepted in a verification round, the target model performs only one forward pass. This amortizes the expensive “weight movement” of the decode phase from N times down to nearly 1, sidestepping the memory bandwidth limit. It is worth stressing that because the target model performs a probability check at every position, the final output distribution remains theoretically identical to decoding directly with the target model. So this speedup does not come at the cost of generation quality.
4. Key Metric: Average Acceptance Length
Speculative decoding may look like a “free lunch,” but the metric that actually measures its effectiveness is the average acceptance length—how many draft tokens the target model accepts on average per round.
- If the draft predicts 4 tokens in one shot and 3 of them are accepted, it is like advancing 3 positions with a single large-model computation—a significant speedup;
- If the draft guesses wrong frequently, the target model has to keep rejecting and correcting, and the extra verification and recomputation overhead can offset or even exceed the gains, resulting in a net slowdown.
Average acceptance length directly determines the speedup ratio. The higher it is, the more in step the draft and target models are, and the more worthwhile the verification.
5. Is Writing More Drafts Always Better? Tradeoffs and Pitfalls
A common misconception is that “guessing more tokens at once is always faster.” In reality, there is a clear tradeoff between draft length and hit rate:
- Longer drafts: a single verification has the potential to advance more positions, but once a later position is rejected, all the draft computed before it is wasted, and the waste grows accordingly;
- Shorter drafts: less waste, but limited progress each round, and the fixed overhead of verification takes up a larger share;
- Too “weak” a draft model: larger prediction deviation, a sharp drop in acceptance length, and the overall result may not be worth it;
- Too “strong” a draft model: although the hit rate is high, its own inference also consumes resources, compressing the room for acceleration.
So the draft model and the target model need to be well matched: fast enough while staying close enough to the main model’s distribution. For different tasks, reasonably tuning the number of tokens predicted at once (the 4–8 token range is often considered an empirical starting point, but the specific value needs to be measured) is often more effective than blindly making drafts longer.
6. Practical Optimization Directions
To actually put speculative decoding into practice in local inference, you can start from these points:
- Choose the right draft model: usually a small-parameter model that shares the same source and vocabulary as the target model and has a similar structure, to ensure distribution alignment and a high verification hit rate;
- Match task characteristics: the draft model’s strengths should align with the business scenario. For highly predictable, pattern-based text (such as code completion and formatted output), the hit rate is naturally higher and the speedup more pronounced;
- The gain structure in concurrent scenarios: in single-request scenarios the latency improvement tends to be more prominent; as concurrent requests increase, overall throughput still improves, but the magnitude of the gains changes and needs to be evaluated alongside memory and scheduling strategy;
- Dynamically adjust draft length: dynamically adjust the number of tokens predicted each round based on real-time acceptance—guess more when the hit rate is high and guess less when it is low—to stabilize the average acceptance length;
- Work with mainstream inference frameworks: mainstream inference frameworks have already integrated speculative decoding as an optional acceleration capability, and usually you just need to configure the draft model to enable it, with no changes to business code and low adoption cost.
Conclusion
The value of speculative decoding lies in reexamining the fundamental contradiction of the LLM decode phase—“little computation, lots of movement”—and using a “draft first, verify in a batch” approach to turn multiple serial small steps into one parallel big step. It requires no new GPU and no sacrifice in output quality; instead, by optimizing the way tokens are generated, it squeezes more potential out of existing hardware. For local LLM applications that pursue low latency and controllable cost, understanding and making good use of draft models and speculative decoding is a pragmatic path worth investing in—one that balances effectiveness and efficiency.
