Speculative Decoding: How a Draft Model Speeds Up LLM Inference by Several Times

    When LLM generation feels slow, developers often reach for more powerful GPUs. But profiling a real inference run usually shows that the bottleneck is not the number of compute units — it is how fast data can be moved. Speculative decoding attacks that bottleneck directly: a small, fast draft model proposes candidate tokens ahead of time, and the large target model verifies them in a single forward pass. This article breaks down why the decode stage is memory-bandwidth-bound, how speculative decoding stays mathematically lossless through rejection sampling, why average acceptance length decides whether you get a speedup at all, and the tradeoffs to weigh when adopting it in production.

    1. Why LLM Inference Is Slow

    Most developers’ first instinct is “we don’t have enough compute, so let’s get faster cards.” But if you actually break down a single inference pass, the limiting factor is usually not the number of compute units — it’s how fast data can be moved around. To see why, split inference into two phases.

    Prefill: digesting the input all at once

    Once the prompt arrives, the model enters the prefill phase. Here it processes the entire input in parallel, computes attention across all tokens, and caches the intermediate results as the KV Cache (key-value cache). Because a large batch of tokens is handled in one shot, this phase is compute-bound, and the GPU’s raw throughput is fully exploited.

    Decode: one token at a time

    As soon as generation begins, the model switches to the decode phase, whose defining property is that it emits exactly one token per iteration:

    1. Read the model weights and the existing KV Cache;
    2. Compute the next token;
    3. Append the newly produced keys and values back to the cache;
    4. Go back to step 1 and generate the next token.

    The real bottleneck: memory bandwidth

    The problem lives inside that loop. A model with tens or even hundreds of gigabytes of weights must, in principle, stream those weights from memory in full for every single token it produces. In this “load myself again for each word” pattern, the number of compute units on the GPU stops being the only thing that matters — what actually caps throughput is memory bandwidth and the efficiency of data movement.

    That leads to an awkward situation: compute is nowhere near saturated, yet generation is already slow because of constant reads and writes to GPU memory. The parallel processing power we paid a premium for is simply wasted in this phase.


    2. The Draft Model Idea: Outsource the Easy Work

    The core insight behind speculative decoding is that generating tokens one at a time — a serial process — leaves a lot of predictable and parallelizable work on the table.

    The technique introduces a “draft model” that is much smaller and much faster than the target model. The collaboration boils down to one sentence: the assistant model proposes a batch of candidate tokens, and the main model validates them all in a single forward pass.

    An intuitive example

    Suppose the user’s prompt is “The cat” and the goal is to produce a full sentence.

    • The draft model races ahead and predicts a run of candidates: “sat on my lap”;
    • The target model then performs one single forward pass that checks all of those candidate tokens at once;
    • If the first few tokens fit the target model’s probability distribution, they are accepted outright; as soon as one token is rejected, the rest of the candidates are discarded, and the target model produces one corrected token to continue from.

    Work that previously required three or four separate decode iterations of the target model now has a chance to be folded into one verification pass. And because the draft model is tiny, generating candidates costs far less than repeatedly streaming the full weights of the target model — that is where the speedup actually comes from.

    Why is it lossless?

    There’s a detail here that is easy to miss but critical. Speculative decoding does not “approximately” guess the answer. It uses a rejection sampling mechanism to stay rigorous: for each draft token, an accept-or-reject decision is made according to a specific probability rule, and when a token is rejected, a replacement is resampled from the target model’s adjusted distribution.

    The result is that the final output distribution is identical to what you would get generating token by token with the target model alone — no quality is traded away. The draft model only makes suggestions; the target model keeps both the authority to accept them and the final say.

    Illustrative pseudocode

    1. def speculative_decode(target_model, draft_model, prefix, K):
    2. # 1. Draft model autoregressively proposes K candidate tokens
    3. draft_tokens = draft_model.generate(prefix, num_tokens=K)
    4. # 2. Target model runs one parallel forward pass over prefix + candidates
    5. target_probs = target_model.forward_probs(prefix + draft_tokens)
    6. accepted = []
    7. for i, token in enumerate(draft_tokens):
    8. # 3. Rejection sampling: accept or reject by the probability rule
    9. if accept(token, target_probs[i], draft_model_probs[i]):
    10. accepted.append(token)
    11. else:
    12. # 4. Rejected: resample a corrected token from the adjusted target distribution
    13. accepted.append(resample(target_probs[i]))
    14. break
    15. return accepted # one round may advance several tokens

    The key point is step 2: the “single forward pass” is the precondition for the whole scheme to save time. The draft model ran serially K times, but the target model ran only once.


    3. The Metric That Matters: Average Acceptance Length

    Speculative decoding looks like a free lunch, but nothing is truly free. What actually determines the speedup is a metric called average acceptance length — the number of draft tokens the target model accepts per round on average.

    • If the draft model proposes 4 tokens and 3 are accepted, then one call to the large model has advanced 3 positions;
    • Conversely, if the draft model guesses wrong often, the target model has to reject and correct over and over, and every verification pass still has to stream the full weights. In that case the added verification overhead can actually slow generation down overall.

    Put differently, the draft model’s value is not in “guessing a lot” but in “guessing accurately.” Only a draft model that is both accurate and fast keeps the average acceptance length high enough for the speedup to materialize.


    4. Tradeoffs in Real Systems

    Getting speculative decoding to pay off in production means balancing a few things.

    Choosing the draft model size

    A draft model that is too small predicts poorly and gets rejected often; one that is too large makes candidate generation expensive, which defeats the purpose. In practice, teams usually pick a small model that is from the same family as the target and shares its vocabulary, then tune it empirically based on measured acceptance rates.

    Longer drafts are not always better

    Simply increasing the number of draft tokens does not reliably improve throughput. The longer the draft, the more likely a rejection occurs later in the sequence — the already-verified prefix is still kept, but the marginal benefit keeps shrinking. A sensible draft length usually has to be benchmarked against your specific workload.

    Workload sensitivity

    Speculative decoding pays off most in highly predictable scenarios such as code completion, structured output, and formatted text, because that kind of content is easy for a small model to guess. On open-ended, high-variance creative tasks, acceptance rates tend to be lower and the speedup shrinks accordingly.

    Integration with mainstream inference frameworks

    Worth noting is that speculative decoding is being progressively built into mainstream inference engines. For developers and enterprises, that means it is moving from “a technique from a paper” to “a deployment capability that works out of the box.” When choosing an inference framework, whether it natively supports draft models and whether it exposes tunable draft lengths and verification strategies is becoming a factor worth weighing. Check the official documentation for the specifics of each option.


    5. Takeaways

    The biggest lesson from speculative decoding is a reframing of what performance optimization means: beyond adding hardware or compressing the model, you can start from how tokens are generated in the first place. By letting a small, fast draft model predict ahead and having the large model verify the batch in one shot, it raises both single-request latency and concurrent throughput without swapping GPUs and without sacrificing output quality.

    For developers, understanding average acceptance length and knowing how to tune the draft model is often a better return on effort than chasing more VRAM or a faster card. So the next time generation is bottlenecked on memory bandwidth, ask yourself: could this “carry myself across memory one token at a time” work be outsourced to a small assistant?