Speculative Decoding: Speed Up LLM Inference Without Upgrading Hardware

    Speculative decoding lets a small draft model propose several tokens at once and a larger target model verify them in a single forward pass, turning one expensive weight read into multiple generated tokens. This article explains why autoregressive decoding is bound by memory bandwidth rather than compute, how the draft-then-verify loop works and stays distributionally unbiased, and which metrics and tuning knobs — average acceptance length, draft length γ, and draft/target alignment — actually determine the speedup. It also covers the practical limits: extra VRAM for the draft model, gains that shrink under high concurrency, and the need to monitor acceptance rate rather than draft speed.

    Why Local LLM Generation Slows Down as It Goes

    Anyone running a large model on a consumer GPU knows the feeling: the model thinks fast but speaks one syllable at a time. Explaining why requires splitting a single inference pass into its two standard phases.

    The prefill phase. Once a user submits a prompt, the model feeds the entire sequence through the network in one shot, computing attention in parallel and building the KV cache that later steps will reuse. This phase processes a large number of tokens and is a classic compute-bound task: throughput is governed by raw arithmetic capacity, such as the GPU’s floating-point throughput. Its defining trait is “do a lot of work at once.”

    The decode phase. From the first emitted token onward, generation enters an autoregressive loop in which every new token requires recomputing against all the context accumulated so far. Each iteration produces exactly one token, which makes this phase memory-bandwidth-bound.

    Herein lies the root cause. To predict the next token, the GPU must move the model weights and the existing KV cache from VRAM to the compute units; once the math is done, it must write the newly produced keys and values back into the cache. For a model with tens or even hundreds of gigabytes of weights, generating a single token means reading that entire payload again. What determines speed at this point is no longer “how many compute units you have” but “how fast VRAM can feed them.” As a result, a GPU in the decode phase often sits in a state of idle compute, saturated bandwidth: the arithmetic units are waiting for data rather than crunching it.

    Speculative Decoding: From Token-by-Token Fetching to Batch Verification

    If the bottleneck is reading the whole weight set to produce one token, a natural idea follows: can a single weight read produce several tokens?

    Speculative decoding is built on exactly this idea. The division of labor is simple. A small, low-latency draft model runs ahead and speculatively proposes a sequence of candidate tokens. The target model — the large model the user actually wants — then verifies all of those candidates in a single forward pass.

    A simple example makes it concrete. The user enters “The cat,” and the draft model quickly proposes “sat on my lap.” The target model then needs only one forward pass to score the distributions at the “sat / on / my / lap” positions in parallel. If “sat,” “on,” and “my” all fall within the target model’s probability distribution, they are accepted outright. If “lap” turns out to be a point of disagreement, it is rejected along with everything proposed after it, and the target model produces a corrected token as compensation.

    Why does this save time? The key is a frequently overlooked fact: verifying K tokens in parallel costs the target model roughly the same as generating 1 token. Decode is bandwidth-bound, so whether the forward pass covers one position or K positions, the full set of weights has to be read either way. Since the fixed cost of “read the weights once” does not change, verifying a few extra tokens is nearly free. Consequently, whenever the draft model guesses well enough, a path that previously took the target model three or four loop iterations can be advanced by several positions in a single verification round. And because the draft model is tiny, the cost of generating its candidates is far lower than the cost of the target model repeatedly reading its full weights.

    A Single-Step Walkthrough

    The pseudocode below sketches the core logic of one speculative decoding iteration. It is illustrative only; a real implementation must also handle sampling and numerical details.

    1. def speculative_step(context, draft_model, target_model, gamma):
    2. # 1. The draft model autoregressively predicts gamma candidate tokens
    3. draft_tokens, draft_probs, x = [], [], context
    4. for _ in range(gamma):
    5. probs = draft_model(x)
    6. token = sample(probs)
    7. draft_tokens.append(token)
    8. draft_probs.append(probs[token])
    9. x = token
    10. # 2. One target-model forward pass, computing distributions at gamma+1 positions in parallel
    11. target_probs = target_model(context + draft_tokens)
    12. # 3. Accept/reject token by token; stop at the first rejected position
    13. accepted = 0
    14. for i in range(gamma):
    15. ratio = target_probs[i][draft_tokens[i]] / draft_probs[i]
    16. if random() < min(1.0, ratio): # rejection sampling keeps the distribution unbiased
    17. accepted += 1
    18. else:
    19. break
    20. # 4. Resample one corrected token from the last accepted position
    21. corrected = resample(target_probs[accepted])
    22. return draft_tokens[:accepted] + [corrected]

    One property deserves emphasis: the output is distributionally unbiased. By using rejection sampling, canonical speculative decoding guarantees that the final output strictly follows the target model’s probability distribution. In other words, the speedup does not come at the expense of generation quality — the same target model remains the arbiter of what gets emitted.

    The Real Scoreboard: Average Acceptance Length

    Speculative decoding may look like a free lunch, but it is not unconditional acceleration. The metric that decides success or failure is the average acceptance length: how many draft tokens the target model accepts per verification round, on average.

    • If the draft model predicts 4 tokens and 3 are accepted, one target-model forward pass has advanced 3 to 4 positions — a clear win.
    • If the draft model guesses wrong frequently, the target model can only keep rejecting and correcting, and the added draft overhead ends up slowing generation down overall.

    In measured terms, this class of approach typically delivers the following: in single-request scenarios, generation speed can rise to several times the baseline; in high-concurrency scenarios, the throughput gain usually falls back to roughly 2x. The reason is straightforward — as concurrency rises, the decode phase shifts from bandwidth-bound toward compute-bound, the “verify several tokens for the price of one weight read” dividend gets diluted, and the available speedup naturally narrows.

    The Two Tuning Knobs: Draft Length and Alignment

    Draft length γ. This is the knob that demands the most careful trade-off. Set γ too small and each round advances too few tokens to deliver much acceleration; set it too large and every rejection throws away a long run of candidates, inflating wasted draft computation. The sensible approach is to tune γ dynamically against the average acceptance length — extend it when acceptance is high, and cut it back decisively when acceptance is low.

    Alignment between the draft model and the target model. The closer the draft model’s distribution is to the target model’s, the higher the acceptance rate. If the two differ too much in “character” — mismatched domains, corpora, or training methods — no amount of draft speed will help. In practice, choosing a small model from the same family and lineage as the target model, or distilling it against a modest amount of data to improve alignment, usually works better than simply chasing a smaller model.

    Limitations and Deployment Advice

    Speculative decoding is not free, and the following points matter in production:

    • Extra VRAM overhead. The draft model needs its own resident space in VRAM, which calls for careful budgeting on memory-constrained edge devices.
    • Gains are workload-dependent. The payoff is largest for single-request, low-concurrency, bandwidth-bound interactive chat, and diminishes for high-concurrency, compute-bound batch workloads.
    • Draft quality is decisive. Make the acceptance rate, not the draft model’s speed, the core monitoring metric, and keep tuning against it.

    For developers deploying large models on limited hardware, speculative decoding offers a viable way to get more speed without swapping GPUs. Its value lies not in some magic parameter but in moving the inference bottleneck away from “compute anxiety” and back to the fundamental question of how to move data efficiently. Combined with the growing native support for the technique in mainstream inference frameworks, and with elastic deployment on cloud inference platforms that scale with available resources, developers can find a better performance-to-cost balance for both local and online scenarios within a controlled budget.