Speculative Decoding for LLM Inference: How It Works, When It Fails, and How to Measure It

    This article explains how speculative decoding (and its multi-token prediction variant) speeds up large language model inference, and why it can also slow throughput down. It covers the draft-and-verify mechanism, the central role of the acceptance rate, how task type affects that rate, the differences between dense and mixture-of-experts (MoE) models, and a practical, data-driven workflow for deciding whether speculative decoding is worth enabling. The core takeaway: the acceptance rate is the make-or-break variable, and the right approach is per-task, per-architecture, two-metric evaluation rather than a single global switch.

    Introduction: Acceleration Is Not a Free Lunch

    As open-source large models scale rapidly across parameter sizes—from small models suited to edge and on-device deployment, to larger general-purpose models, to sparse, mixture-of-experts (MoE) architectures—developers running inference on their own hardware keep running into the same question: how do I generate tokens faster? Speculative decoding and its variant, multi-token prediction (MTP), are widely seen as the answer. But practice keeps proving the same thing: speculative decoding is a double-edged sword. Used well, it delivers meaningful speedups; used poorly, it drags down overall throughput.

    This article discusses no specific product. Instead, it explains the general technique of speculative decoding in depth: why it can accelerate inference, when it breaks down, and how to use data to judge whether it actually pays off.

    1. The Core Mechanism: Draft + Verify

    Standard autoregressive decoding generates one token at a time, and each token requires a full forward pass through the model. Speculative decoding introduces a lightweight “draft” stage: it first guesses several candidate tokens in one shot, then verifies those guesses in parallel with a single pass through the main model.

    • Draft stage: A cheaper mechanism (a lightweight draft model, or multiple prediction heads built into the main model) produces k candidate tokens in sequence.
    • Verify stage: The main model concatenates the k candidates into one sequence and runs a single forward pass, computing in parallel the distribution the main model would have produced at each position.
    • Accept / roll back: Comparing left to right, each draft token that falls within the main model’s acceptance range is kept; at the first mismatch, all subsequent candidates are discarded and the main model generates a token at that position.

    The key point: although the verify pass processes k positions “in parallel,” its compute cost does not drop by an order of magnitude compared to decoding position by position—it still runs the full model. So what speculative decoding actually saves is the number of sequential calls and the number of memory accesses, not the cost of a single forward pass itself.

    2. Acceptance Rate: The Variable That Decides Everything

    How much time speculative decoding saves is determined almost entirely by a single metric: the acceptance rate, the fraction of draft tokens that the main model ultimately accepts.

    Here is a rough intuition. Suppose the draft guesses k tokens per round with acceptance rate α:

    • If α is close to 1, the draft hits almost every time, and a single verify round “lets through” close to k tokens. Sequential rounds drop sharply, and the speedup is obvious.
    • If α is low, many draft tokens are discarded, and each verify round only advances 1–2 tokens—yet you still pay the full forward-pass cost for that round. At this point speculative decoding is doing extra verification work without getting the corresponding tokens back, and the net effect is slower.

    This is also why many benchmarks show that enabling speculative decoding can actually reduce decode speed. Take a typical multi-task evaluation as an illustration (numbers used only to show the trend):

    • On tasks where “the draft and the main model are highly aligned,” the acceptance rate reaches 0.75–0.80, with a speedup of roughly 1.1–1.18×;
    • On tasks where “the draft and the main model diverge,” the acceptance rate drops to 0.55–0.62, and the speedup falls to 0.74–0.87×—that is, the more you turn it on, the slower it gets.

    The conclusion is direct: the acceptance rate is speculative decoding’s line between life and death, not an optional tuning knob.

    3. Why Acceptance Rates Vary So Much Across Tasks

    Ultimately, the acceptance rate is a question of how predictable a task’s output is. The draft can hit because the main model’s output distribution at that position is concentrated and confident enough.

    • High-acceptance tasks: In code completion, retrieval-augmented generation (RAG), rewriting, and similar scenarios, the context imposes strong constraints and answer patterns are relatively fixed. The main model’s probability mass is highly concentrated at most positions, the draft guesses correctly, and the acceptance rate is naturally high.
    • Low-acceptance tasks: Creative writing, role-playing, math and logical reasoning, and open-ended Q&A have generation paths full of branches. The main model’s distribution is “flatter,” and the draft struggles to hit consistently. Blindly enabling speculative decoding on these tasks often backfires.

    The engineering takeaway: don’t expect a single global switch to fit every scenario. A more sensible approach is to evaluate the acceptance rate per task type, or even adopt a strategy that toggles speculative decoding dynamically per scenario.

    4. Dense Models vs. Mixture-of-Experts (MoE): Different Behavior from Different Architectures

    Another often-overlooked dimension is model architecture. A dense model activates all parameters for every token; an MoE model activates only a subset of its experts per token, using fewer active parameters and, in theory, spending less compute per forward pass.

    But on devices like “unified memory,” where memory and compute are shared and bandwidth is relatively constrained, the picture gets more nuanced:

    • For dense small models, the benefit of speculative decoding depends on the acceptance rate. As described above, when the acceptance rate is insufficient, it can noticeably slow things down.
    • For sparsely activated MoE models, the per-token compute is already low, so the marginal gain from “saving sequential rounds” is relatively limited. When the acceptance rate is poor, the extra overhead of the verify stage is more likely to eat up that small gain.

    So in on-device or unified-memory environments where memory bandwidth is the bottleneck, a “sparsely activated large model” is often more cost-effective than “a dense model + speculative decoding.” This also explains why, in real measurements, MoE schemes with fewer active parameters can be more stable in overall throughput.

    5. A Practical Evaluation and Tuning Workflow

    For speculative decoding, don’t go by feel—let data do the talking. Evaluate with the following process:

    1. Establish a baseline: First measure per-token throughput (tokens/s) and end-to-end latency per task with speculative decoding off.
    2. Sweep parameters: Gradually increase the draft length k (for example, test 0/2/3), and for each task category record the decode speedup, the latency speedup, and the acceptance rate.
    3. Watch two metrics: Looking at throughput alone is misleading; you must look at both the speedup and the acceptance rate. A task with speedup < 1 and a clearly low acceptance rate is not a good fit.
    4. Decide per scenario: Enable speculative decoding for high-acceptance tasks; disable it for low-acceptance tasks, or switch to a smaller draft step.
    5. Compare architectures: On the same hardware, compare “dense + speculative decoding” against “sparse MoE,” then choose based on combined throughput and latency.

    Here is an illustrative evaluation flow (pseudocode, showing the idea only and representing no specific tool):

    1. def evaluate(spec_step, tasks, base_model, draft_head):
    2. results = {}
    3. for task in tasks:
    4. base = measure(task, base_model, spec_step=0)
    5. spec = measure(task, base_model, spec_step=spec_step, draft=draft_head)
    6. results[task] = {
    7. "throughput_speedup": spec.tps / base.tps,
    8. "latency_speedup": base.latency / spec.latency,
    9. "accept_rate": spec.accept_rate,
    10. }
    11. return results
    12. # Evaluate with different draft steps to find each task's "sweet spot"
    13. for k in [0, 2, 3]:
    14. report = evaluate(k, benchmark_tasks, model, mtp_head)
    15. print(f"spec_step={k} -> {report}")

    The judgment criterion can be reduced to one sentence: a speedup above 1 is worth enabling; a speedup near or below 1 means you should turn it off or change strategy.

    6. Common Misconceptions

    • Misconception 1: “Speculative decoding is always faster.” Wrong. It is a probabilistic optimization, and it slows things down when the acceptance rate is low.
    • Misconception 2: “The longer the draft, the better.” Wrong. A longer draft means that if a mismatch occurs at a later position, everything guessed before it is wasted, amplifying the waste. Draft length needs to match the task’s acceptance rate.
    • Misconception 3: “Watching throughput alone is enough.” Not enough. You must look at end-to-end latency and the acceptance rate together, or you can easily be misled by a single local metric.

    Conclusion

    The value of speculative decoding (including multi-token prediction) is not that “flip a switch and it speeds up,” but that it is “applied to the right scenario.” Judging whether it pays off always comes back to a single variable: the acceptance rate. A high acceptance rate means a sharp drop in sequential rounds and meaningful throughput; a low acceptance rate means verification overhead spent for nothing, and slower with every attempt. In bandwidth-constrained environments like unified memory, sparsely activated MoE architectures often provide more stable overall performance. The truly professional approach is to abandon the obsession with a global switch and return to quantified evaluation that is per-task, per-architecture, and two-metric: measure the baseline first, sweep parameters second, and finally make dynamic, per-scenario decisions. Only then can inference acceleration move from “mystical tuning” to a reproducible, explainable engineering practice.