Speculative Decoding and MTP: Tuning Acceptance Rate and k for Local Inference

    Speculative decoding and multi-token prediction (MTP) are not an "on switch" for speed — they are latency optimizations whose payoff depends on the task, the acceptance rate, batch size, context length, and how well your framework implements them. This article explains how MTP relates to speculative decoding, how to read and reason about acceptance rate, which task types tend to regress, how to choose the draft length k per task, whether MoE makes sense on unified-memory machines, and how to benchmark before enabling anything in production.

    Bottom line up front: speculative decoding and multi-token prediction (MTP) are not a switch that makes inference faster once flipped. They are latency optimization techniques that depend on the task, the acceptance rate, batch size, context length, and the framework implementation. Single-stream code generation and structured output can benefit; concurrent serving, long context, open-ended reasoning, and math problems can produce negative speedups. The safe default is off in production: benchmark per task first, then roll out gradually.

    1. How speculative decoding and MTP relate

    Autoregressive decoding produces only one token per step, and the decode phase is usually memory-bandwidth bound. Speculative decoding first has a draft head or a small model quickly produce k candidate tokens, then lets the main model verify them in parallel and accept the longest matching prefix. MTP is a lightweight form of speculative decoding: the main model carries additional draft heads, and a single forward pass produces several candidate future tokens.

    One caveat: standard speculative decoding paired with rejection sampling yields output from the same distribution as the main model. Implementations that compare tokens directly typically match the main model’s greedy decoding results, and MTP-head drafters generally guarantee only the latter. So this is not unconditionally lossless — the distributions are simply aligned in different ways. On top of that, MTP heads are extra trained or added parameters that consume additional VRAM, and quantization formats plus platform support can change draft quality.

    2. How high should the acceptance rate be? Don’t guess — do the math

    You can read acceptance rate from your inference framework’s speculation metrics or logs. The common definition is “accepted draft tokens / proposed draft tokens,” tracked separately per task.

    Let the per-position acceptance probability be a and the draft length be k. Expected tokens generated per step is roughly:

    1. (1 - a^(k+1)) / (1 - a)

    If a speculative step costs about (1 + c) times a baseline step, the approximate speedup is:

    1. (1 - a^(k+1)) / ((1 - a) * (1 + c))

    Break-even is when that value exceeds 1.

    In practice, with k=4, a=0.82, and a low overhead of roughly c≈0.1, theoretical gains can reach several times. But local inference typically gives some of that back through sampling, scheduling, KV cache growth, and draft-head overhead, so a conservative estimate of about 2.4x is more realistic. If acceptance rate sits below 0.55 for extended periods, or if long context and concurrency push c up, gains can fall under 1 and turn into a slowdown. These formulas and empirical thresholds are for judgment only — they do not replace real numbers measured on your own machine.

    The final verdict is never the acceptance rate itself, but end-to-end throughput, time to first token, and P95/P99 latency. Acceptance rate is a diagnostic and tuning signal, nothing more.

    3. Which tasks slow down?

    Task differences are significant. Code, structured output, and summaries with stable formats have strong token patterns and usually high acceptance rates. Question answering, multilingual workloads, and some RAG pipelines sit in the middle and must be measured. Open-ended writing, role-play, math, and logical reasoning reject drafts more often and frequently end up slower.

    Three high-risk boundaries deserve particular attention:

    1. batch>1 or concurrent serving: verification often becomes compute-bound, and speculative decoding can reduce throughput. A latency optimization must not be treated as a throughput optimization.
    2. Long context: KV cache growth raises verification cost and erodes speculative gains.
    3. MTP heads consume extra VRAM or system memory, and different quantization formats and platform support affect draft quality.

    The following reflects task-level tendencies only, not a performance guarantee:

    Task type Acceptance-rate tendency Recommendation
    Code / structured output High Validate first, then enable
    Q&A / multilingual / RAG Medium Test on a small traffic slice
    Writing / math / reasoning Low Use with caution or disable

    4. How should you tune k? Route by task, don’t leave it globally on

    Start with small steps between k=3 and k=5. Larger k raises theoretical gains but also increases draft cost, verification cost, and tail-latency risk. Try 4 for code, 3 for structured output, 2 for chat; leave creative writing and reasoning off by default.

    1. profile = {
    2. "code": {"spec": True, "k": 4},
    3. "structured": {"spec": True, "k": 3},
    4. "summarize": {"spec": True, "k": 3},
    5. "rag": {"spec": True, "k": 3}, # roll out gradually based on historical acceptance rate
    6. "chat": {"spec": True, "k": 2},
    7. "creative": {"spec": False, "k": 2},
    8. "reasoning": {"spec": False, "k": 2},
    9. }
    10. def choose_spec_mode(task_type, p95_latency_budget, batch_size, context_len):
    11. cfg = profile.get(task_type, {"spec": False, "k": 2})
    12. # Under concurrent batching, verification often becomes compute-bound and
    13. # speculative decoding can lower throughput, so force it off
    14. if batch_size and batch_size > 1:
    15. return False, cfg["k"]
    16. # Long context increases KV cache and verification cost; disable when needed
    17. if context_len and context_len > 8192:
    18. return False, cfg["k"]
    19. if not cfg["spec"]:
    20. return False, cfg["k"]
    21. if p95_latency_budget is None:
    22. return True, cfg["k"]
    23. if p95_latency_budget < 300:
    24. return False, cfg["k"]
    25. return True, cfg["k"]

    If your framework supports it, maintain a “task — acceptance rate — throughput — latency” profile and make the decision dynamically at the gateway or the framework’s routing layer instead of enabling it globally.

    5. Unified memory: dense or MoE?

    On consumer devices where CPU and GPU share memory, MoE does not necessarily mean fewer parameters, but it activates only a subset of experts per token, so the actual compute per token can be lower. The applicable conditions should be limited to: single-stream decode that is throughput-limited, weights that fit entirely in memory, sufficient memory bandwidth, and good framework support for sparse operators and MoE routing. With high concurrency, tight VRAM, or poor framework support, MoE is not guaranteed to be faster.

    Don’t select on total parameter count alone. Compare per-token activated parameters, memory bandwidth consumption, KV cache, time to first token, decode throughput, quantization format, and framework maturity. The correct approach is to measure on the same machine with the same framework — not to assume bigger parameters are better, and not to assume all MoE is faster.

    6. How should you benchmark before shipping?

    Use end-to-end throughput, P50/P95/P99 latency, acceptance rate, and draft/verification cost as the core metrics. Run offline benchmarks on the target hardware first, then roll out to a small traffic slice. Keep the speculative path off by default in production and enable it only after validation, so users don’t experience a slowdown.

    Keep a unified script in regression, covering code, Q&A, RAG, writing, math, and reasoning tasks, so model or framework upgrades don’t silently regress performance. At cloud scale, container platforms can schedule instances, object storage can hold weights, and logging and monitoring can track acceptance rate and latency. These capabilities can be swapped for whatever your team’s infrastructure already uses — there’s no need to bind to a single product.

    FAQ

    Q1: How do MTP and speculative decoding relate?
    A: MTP is one draft implementation of speculative decoding. The main model’s extra draft heads generate candidates, which the main model then verifies.

    Q2: How is acceptance rate calculated?
    A: Read “accepted draft tokens / proposed draft tokens” from framework metrics or logs, track it per task, and judge it together with throughput and P95 latency.

    Q3: Should it be on by default locally?
    A: Not globally. High-scoring cases like code can be rolled out gradually; creative writing, math, reasoning, and concurrent workloads should default to off.

    Q4: What should k be?
    A: Test in small steps from 3 to 5. Use smaller k to target latency, and try larger k for single-stream throughput — but always watch tail latency.

    Q5: Why does it get slower the more I use it?
    A: Possible causes are an acceptance rate that is too low, batch concurrency, KV cache growth from long context, extra draft-head overhead, or unstable framework implementation.