Speculative Decoding: Speed Up LLM Inference Several Times Without Upgrading Your GPU

    Speculative decoding lets a large target model run several times faster by pairing it with a small draft model. This article explains why the decode phase is memory-bandwidth bound, how the draft-and-verify loop works, why the output distribution stays identical to standard decoding, and what factors determine the speedup. It closes with practical guidance for adopting speculative decoding in local or private deployments.

    1. A concrete comparison: same model, different speed

    Imagine the following scenario: the same computer, the same target large model, and the exact same prompt. On the left, the interface has already finished generating the complete answer; on the right, tokens are still trickling out one by one. Both outputs are produced under the strict quality control of the same model. The only difference is that the left side has one extra ingredient: a small, fast “draft model.”

    Across publicly shared demos and hands-on feedback, this “large model paired with a small model” setup typically speeds up single-request generation by 2x to 4x. Even as concurrent requests keep increasing, the system can still achieve roughly a 2x throughput improvement. Notably, no hardware was swapped out, and the target model was not further quantized or pruned. Only one thing changed: how tokens are generated.

    This technique is called speculative decoding. It is being adopted by more and more mainstream inference frameworks, and the “draft model” is becoming a role you can’t avoid when running large models locally.

    2. Where the decode phase actually slows down

    To understand the value of speculative decoding, you first need to see where the bottleneck in large model inference really lies. A full inference run is usually split into two phases.

    Prefill: After the user submits a prompt, the model processes the entire input at once, computing attention in bulk and building the key-value cache (KV Cache). This phase handles many tokens in parallel and is a classic compute-bound task, so the GPU’s compute power is fully utilized.

    Decode: Once the model starts answering, it can only produce one token at a time. To generate the next word, the GPU must move the model’s entire set of weights and the existing KV Cache from memory into the compute units; after generation, it writes the new key-value data back into the cache. Then, for the next token, this exact shuffling process repeats all over again.

    Here lies the root of the problem. A model can have tens or even hundreds of gigabytes of weights, yet every single token generation requires reading all of that data again. At this point, how many compute cores the GPU has is no longer the deciding factor. Memory bandwidth and data movement speed are the real ceiling. The compute units sit largely idle, like a nimble worker facing an extremely narrow feed channel, forced to wait for raw materials.

    This also explains a counterintuitive phenomenon: in single-request, low-concurrency scenarios, simply piling on more compute yields limited gains. What really needs optimizing is “how to make each unit of data the GPU moves per cycle produce more useful output.”

    3. The core idea of speculative decoding

    Speculative decoding seizes on exactly this property of the decode phase. Its central insight is:

    For a large model, verifying whether K tokens are correct “all at once” takes almost the same amount of time as honestly generating 1 token.

    The reason is simple: parallel verification is a single forward pass that fully utilizes idle compute, putting back to work the computing power that memory bandwidth had been wasting.

    So the whole method introduces a second role: a small, fast draft model. It cheaply “guesses” the next several tokens; then the large target model checks all these guesses in one forward pass. If a guess is correct, it’s accepted directly; if it’s wrong, it’s discarded and prediction resumes from the point of error.

    In one sentence: the draft model “guesses fast and maybe inaccurately,” the target model “verifies slowly but reliably,” turning serial generation into parallel verification.

    4. A complete speculative decoding flow

    Below are the typical steps of a speculative decoding run, which can be summarized with the following pseudocode:

    1. def speculative_decode(target_model, draft_model, prompt, gamma):
    2. # 1. Target model prefills normally to get the current context distribution
    3. context = prompt
    4. last_dist = target_model.forward(context)
    5. while not finished:
    6. # 2. Draft model autoregressively "guesses" gamma candidate tokens
    7. draft_tokens = []
    8. dist = last_dist
    9. for _ in range(gamma):
    10. token = draft_model.sample(dist)
    11. draft_tokens.append(token)
    12. dist = draft_model.next_distribution(token)
    13. # 3. Target model does ONE parallel forward pass over
    14. # [draft tokens + current context]
    15. target_dists = target_model.forward(context, draft_tokens)
    16. # 4. Verify one by one: accept the longest matching prefix,
    17. # correct at the first rejection
    18. accepted = verify_and_sample(draft_tokens, target_dists)
    19. context = context + accepted
    20. last_dist = target_model.distribution_after(accepted)
    21. return context

    Broken down in words, there are four key steps:

    1. Draft prediction: The small model autoregressively generates several (γ) candidate tokens along the current context. Since the model is small, this step is very cheap.
    2. Parallel verification: Feed all γ candidate tokens to the target model at once. A single forward pass produces the target probability distribution at every position simultaneously.
    3. Accept and reject: Compare left to right. If a drafted token falls within the acceptable probability range of the target distribution, it’s accepted; the moment a token is rejected, resample a correct token at that position from the corrected distribution and discard all subsequent guesses.
    4. Iterate: Append the accepted sequence back to the context and start the next round. Each round advances at least one token, and when you’re lucky, several at once.

    5. Why verifying multiple tokens at once speeds things up

    Comparing this flow against standard decoding reveals where the speedup comes from.

    • Standard decoding: Generating N tokens requires N serial forward passes, each limited by memory bandwidth, with compute largely spinning idle.
    • Speculative decoding: After the draft model guesses K tokens, the target model needs only one forward pass to verify them. If most of these K tokens are accepted, you effectively get multiple tokens for the cost of roughly “one forward pass.”

    Time is therefore saved at both ends: the draft phase is handled by the cheap small model, and the verification phase frees the target model from “waiting token by token” to “checking in batches.” The more tokens accepted, the higher the output per forward pass, and the more pronounced the overall speedup.

    6. Why output quality doesn’t drop

    This point is crucial: speculative decoding is a speed optimization with a strictly equivalent output distribution, not an approximation or a compromise.

    The key lies in the carefully designed acceptance/rejection sampling check. When a drafted token is rejected, the system does not simply roll back. Instead, it performs a corrected resampling based on the difference between the target model’s and the draft model’s distributions (resampling from a “residual distribution”). This mathematical construction guarantees that—regardless of how accurately the draft model guesses—the probability distribution of the final output sequence is exactly the same as when the target model generates token by token on its own.

    Therefore, the draft model only affects “how fast it runs,” not “what gets generated.” The accuracy, style, and quality of the answer are decided solely by the target model. Even a poor draft model cannot contaminate the result; it can only lower the speedup ratio.

    7. Key factors that determine the speedup

    Speculative decoding is not a “free lunch.” Its gains depend on several tunable factors:

    • Alignment between the draft model and the target model: This is the most important factor. The closer the draft model’s output distribution is to the target model’s, the higher the acceptance rate and the more obvious the speedup. For this reason, the two are usually chosen from the same model family, or the draft model is distilled directly from the target model.
    • The number of speculated tokens (γ): Guess more, and each hit advances you further; but once an early token is wrong, all subsequent guesses are discarded, wasting the compute of both the draft and target models. There is an optimal range that needs tuning for the specific workload.
    • Task predictability: Highly repetitive, strongly structured text (such as code completion, formatted output, or templated content) yields higher acceptance rates; open-ended, highly divergent creative writing yields lower ones.
    • Concurrency and batching: In low-concurrency, single-request scenarios, decoding is severely limited by memory bandwidth, so the gains are largest; under high concurrency, batching itself has already improved compute utilization, so the marginal gains shrink.

    8. Practical implementation guidance

    If you want to introduce speculative decoding in a local or private environment, consider the following engineering points:

    1. Prefer pairing the draft model within the same model family to achieve a higher acceptance rate; if resources allow, distilling the draft model from the target model usually works better.
    2. Treat γ as a metric to observe and continuously tune. Monitor average accepted length and acceptance rate, and find the sweet spot for your current hardware and workload rather than blindly setting it high.
    3. Enable it first in latency-sensitive, single-user interactive scenarios. These are exactly where the decode-phase bottleneck is most pronounced, making speculative decoding the most cost-effective.
    4. Leverage existing inference optimization capabilities. In mainstream inference engines, model-serving frameworks, or cloud-based LLM inference services that support speculative decoding, this capability is gradually becoming an optional feature. Combined with container platforms, monitoring and alerting, and logging services, you can observe each request’s acceptance rate and throughput changes, and tune accordingly.
    5. Run A/B comparisons with real workloads. Compare time-to-first-token, overall throughput, and output consistency before and after switching, and use data to confirm the gains, avoiding needless complexity in scenarios where it doesn’t apply.

    9. Applicability boundaries and summary

    It’s important to recognize objectively that speculative decoding does not deliver multiples of speedup in every scenario. It is essentially a clever exploitation of the property that “the decode phase is memory-bandwidth limited with idle compute.” So in extreme high-concurrency scenarios where compute is already fully utilized, the gains shrink noticeably. In addition, it introduces an extra draft model, which brings a small memory overhead and added scheduling complexity.

    Even so, for the vast majority of local deployments, single-machine inference, and response-speed-focused applications, speculative decoding trades a tiny extra cost for several-fold generation speedup with no loss in output quality. The core idea it conveys is highly instructive:

    When the hardware bottleneck is not “computing fast” but “moving slowly,” the truly efficient optimization direction is to make every expensive data movement carry more useful output.

    Without swapping a single GPU and without further compressing the model, simply changing how tokens are generated and verified can make a large model noticeably faster. This is precisely the practical value that speculative decoding brings to local inference engineering.