Speculative Decoding for LLM Inference: Speedup Gains and Their Limits

    This article explains how speculative decoding accelerates large language model inference, why its gains depend on acceptance length, drafting cost, and verification cost, and where those gains shrink. It covers the mechanism and speedup formula, parallel drafting with layer-wise dependency modeling, the configuration variables needed to make tok/s numbers comparable, speedup decay in long-context workloads, the interaction between precision and memory, and practical rollout advice such as baselining, tiered evaluation, and keeping a fallback switch.

    1. Background: Why Small-Batch Decoding Leaves Compute Idle

    In LLM inference serving, autoregressive decoding (AR below) is the most basic generation method: each forward pass produces a single token, the new token is appended to the context, and the next round begins. The bottleneck here is usually not compute but memory bandwidth—every token generated requires moving the entire set of model weights from memory into the compute units once, while only one token actually participates in the computation. At small batch sizes, the arithmetic intensity of matrix multiplications is very low, so the compute units spend much of their time waiting.

    This also explains a common puzzle: on the same accelerator, short requests can easily reach several hundred tokens per second (tok/s), but once the context grows to around a hundred thousand tokens, throughput can drop to a third of that or lower. There are two reasons. First, attention computation grows with context length, and the amount of KV cache read increases. Second, long contexts usually come with longer outputs and more complex logic, so acceptance patterns become less regular.

    2. How Speculative Decoding Works

    The core idea of speculative decoding is “draft first, verify after”: a smaller draft model (drafter) proposes multiple candidate tokens in one shot, and the target model then verifies that whole span of candidates with a single forward pass.

    Verification scans from left to right and truncates at the first position that is not accepted, discarding all subsequent drafts and keeping only the continuously accepted prefix, plus one extra token. So the number of tokens advanced per round is a random variable. Denoting the average acceptance length as τ (including the extra token produced by the target model), the per-round time of the decoding stage can be approximated as:

    1. T_round ≈ T_draft + T_verify + T_other
    2. Speedup ≈ τ / (T_draft + T_verify + T_other) × T_ar

    Here T_other covers overhead not listed separately, such as scheduling, sampling, and state maintenance. This expression yields two key conclusions:

    • A high acceptance length is a necessary condition, not a sufficient one. Drafting and verification must themselves be cheap enough, otherwise the gains from τ get eaten up.
    • Verification is usually the main cost. Publicly reported experiments in the industry generally show that verification accounts for more than seventy percent of per-round time, with little variation across different drafting schemes. This means optimization should focus on “making drafts more accurate” and “making verification more parallel.”

    As long as the verification rules are implemented correctly, speculative decoding does not change the output distribution of the target model, and this is the prerequisite for using it with confidence in production.

    3. Parallel Drafting and Layer-Wise Dependency Modeling

    In the traditional approach, the draft model predicts all positions in parallel and independently, which is prone to errors on long-range dependencies. One line of improvement injects the current prediction features of the previous position into the next position at every layer of the draft model, so that dependencies between tokens are built up layer by layer along the network depth. It keeps the parallel advantage of “drafting an entire span in one forward pass” while adding the conditional dependencies within the sequence, which raises the acceptance length.

    Methods of this kind have reported average acceptance length gains of roughly twenty to thirty percent on small and medium target models, with end-to-end throughput gains of about twenty percent. It is worth stressing that these numbers come from specific model sizes and specific test sets and cannot be extrapolated directly to all scenarios; on larger target models with longer contexts, the structure of the gains differs markedly.

    4. Which Variables to Record When Benchmarking

    When people in the community discuss “how many tok/s,” the numbers cannot be compared with each other because configuration constraints are missing. It is advisable to at least fix and disclose the following dimensions:

    • Hardware environment: accelerator model and memory capacity, interconnect method, whether it is shared with other workloads.
    • Software environment: inference framework and version, attention backend, whether compilation and graph capture are enabled.
    • Weight precision: full precision, 8-bit or 4-bit floating-point quantization, and mixed-precision strategies (different layers at different precisions).
    • Loading and generation configuration: context window limit, KV cache precision, whether speculative decoding is enabled and the draft length, batch size, sampling parameters (temperature, top-p).
    • Metric definition: pure decode speed or end-to-end including prefill; single request or aggregated throughput under concurrency.

    A reusable record template:

    1. Hardware: <accelerator model> x N, memory <capacity>
    2. Software: <inference framework version>, attention backend <implementation class>
    3. Precision: weights <precision scheme>, KV cache <precision>
    4. Config: ctx=<length>, draft_len=<k>, batch=<b>, T=<temperature>
    5. Results: prefill <tok/s>, decode <tok/s>, average acceptance length τ=<value>

    5. Diminishing Gains in Long-Context Scenarios

    On short requests, the speedup ratio of speculative decoding often looks best, because pattern-heavy code with high draft hit rates makes up the majority. But the real shape of workloads for AI coding tools and document-understanding tasks is this: inputs are often around a hundred thousand tokens, outputs mix natural-language explanations with code snippets, and the continuation length per round is uncertain.

    Three phenomena can be observed in such workloads:

    1. The speedup ratio is usually lower than for short requests, commonly measured between two and a half and three times rather than four times.
    2. The longer the context, the heavier the KV reads in the verification stage, so verification takes up a larger share of the cost and net gains are compressed.
    3. The less regular the output, the larger the variance in acceptance length, and tail latency jitter deserves more attention than the average.

    So any evaluation plan must be based on the distribution of the target workload; representing the long-context experience with an average is misleading. It is recommended to report P50/P90 tokens advanced per round and tok/s together.

    6. How Precision and Memory Interact

    Low-precision weights (such as 4-bit floating point) can significantly reduce the number of bytes moved per round, which directly benefits the bandwidth-bound decoding stage; mixed-precision strategies keep sensitive layers at higher precision to preserve quality. But two points need attention. First, lower precision changes the numerical distribution, so the “consistency” between draft and target may change, and the acceptance length must be measured again. Second, the memory freed by low precision can be traded for longer context or larger batches, and larger batches weaken the relative advantage of speculative decoding, so the two need to be tuned jointly rather than each optimized on its own.

    7. Rollout Recommendations

    • Measure the baseline first: run pure AR under a fixed configuration, record decode speed and memory usage, and use it as the anchor for all comparisons.
    • Then measure acceptance length: collect τ and its distribution separately to determine whether the bottleneck is “inaccurate drafts” or “expensive verification.”
    • Evaluate in tiers: benchmark short requests, medium contexts, and hundred-thousand-token contexts separately, and build a comparison table.
    • Watch serving-side metrics: a higher single-request tok/s does not equal higher serving throughput; concurrency, queuing, and memory limits must be considered together.
    • Keep a fallback switch: speculative decoding is sensitive to configuration, so production should be able to toggle it dynamically by workload type, with monitoring, alerting, and logging in place to help trace whether a speed anomaly came from configuration drift or a workload change.

    8. Summary

    Decoding acceleration is not a single trick but a system problem determined jointly by acceptance length, draft cost, verification cost, precision, and batch size. Only by stating the configuration clearly, evaluating long contexts and short requests separately, and looking at averages and tail latency together can you tell how much gain an acceleration scheme actually leaves in your service.