Multi-Token Prediction Draft Models: How Speculative Decoding Accelerates LLM Inference

    This article explains how speculative decoding turns an expensive full forward pass into one target-model verification plus several cheap drafts. It walks through the draft-and-verify loop with pseudocode, then covers the three design choices that decide how well a multi-token prediction draft model performs: target-activation conditioning, KV cache sharing, and efficient output projection. It also shows why the output stays lossless under both greedy and sampling decoding, where the gains disappear (large batches, exact-recall tasks, memory-constrained edge deployment), and which metrics and rollout practices to use in production.

    1. Why Single-Request Autoregressive Decoding Can’t Get Faster

    Break LLM inference apart and you get two kinds of computation with very different characteristics.

    The prefill phase. All prompt tokens go through the model at once. The matrix multiplications are large enough that arithmetic intensity is high and hardware utilization sits close to peak.

    The decode phase. To generate each new token, the model reads every weight in its entirety, while the actual computation touches only the current position. The whole phase is a long chain of tall, skinny matrix-vector multiplications with very low arithmetic intensity. On mainstream accelerators, single-request decoding is memory-bandwidth bound. Render-blocking CSS in a browser delays first paint; reading weights during decode is like loading every render-blocking resource serially — the GPU spends most of its time waiting on memory rather than computing.

    Two consequences follow:

    • In the decode phase, simply “swapping in a faster card” yields limited gains. What matters is how many tokens each weight read produces.
    • Within the memory-bound region, moving the weights for 1 token versus 5 tokens costs almost the same in bandwidth, and the extra compute is marginal too. In other words, “computing a few more positions” is nearly free.

    Speculative decoding is built on exactly this physical fact: trade a cheap guess for an expensive forward pass, and get “one read, many outputs.”

    2. The Core Pattern: Draft and Verify

    Typical speculative decoding is a draft-verify loop. The pseudocode below illustrates the logic only; it does not map to any specific product interface.

    1. def speculative_decode(draft, target, prefix_ids, K=5):
    2. """draft: lightweight draft model; target: main model; K: draft tokens per round"""
    3. # Prefill on the target model to get the KV cache and the last-layer hidden state
    4. kv_t, h_t = target.prefill(prefix_ids)
    5. kv_d = draft.prefill(prefix_ids, context=h_t) # the draft is conditioned on the target's output
    6. output = []
    7. for _ in range(max_rounds):
    8. # 1) The draft model quickly guesses K candidate tokens
    9. candidates, draft_hidden = draft.draft(kv_d, K=K, cond=h_t)
    10. # 2) One parallel forward pass over the K candidates + 1 stopping position
    11. logits = target.forward(candidates, kv=kv_t) # shape: [K + 1, vocab]
    12. # 3) Verification: take the longest matching prefix
    13. n = 0
    14. for i, tok in enumerate(candidates):
    15. if greedy_argmax(logits[i]) == tok: # greedy decoding
    16. n += 1
    17. else: # first divergence
    18. output.append(greedy_argmax(logits[i])) # replace with the target model's prediction
    19. break
    20. else:
    21. output.append(greedy_argmax(logits[K])) # all candidates accepted: bonus token
    22. # 4) Roll the KV cache back to the length actually consumed to keep the draft context consistent
    23. kv_t = rollback(kv_t, n + 1)
    24. h_t = logits[n]
    25. kv_d = draft.advance(kv_d, candidates[:n], n, h_t)
    26. return output

    Three points matter here:

    1. Parallel verification. A single forward pass on the target model produces full probability distributions at K+1 positions.
    2. Longest matching prefix. At the first position i that diverges, accept the first i draft tokens, substitute the target model’s own prediction at position i, and discard every remaining draft token.
    3. Bonus token. If all K candidates pass, the distribution at position K+1 has already been computed, so the target model’s own next token comes for free.

    Point 3 deserves emphasis: it is not an optimization, it is a precondition for speculative decoding to be correct. Every round requires at least one target forward pass — at startup, in the final rounds, and for the first verification — so anything above an average accepted length of 1 is a net gain. Without the bonus token, a final round could produce zero output, a wasted round. The design effectively protects the lower bound of lossless speedup.

    3. How the Draft Learns to Guess Well: Three Key Designs

    The efficiency of speculative decoding can be abstracted as:

    speedup ≈ average accepted length ÷ per-round overhead factor (how much more expensive draft plus verification are compared to a single ordinary decode step)

    This makes the optimization paths clearer:

    • The first three designs all work on the numerator: making the draft track what the target model actually intends.
    • The fourth works on the denominator: making the draft cheaper so overall decoding is faster, including on edge devices.

    3.1 Target Activation Conditioning: Letting the Draft See the Target’s Judgment

    An ordinary small model drafts independently. It can only rely on tokens already generated and has no sense of the target model’s internal intent. One effective approach is target activation conditioning: concatenate the embedding vector from the target model’s last-layer output — which encodes the target’s judgment about “what comes next” — with the draft model’s input embedding, then project it down to the draft’s hidden dimension as an extra conditioning input.

    The benefits:

    • The draft no longer guesses out of thin air. Conditioning on the target’s output space makes it naturally easier to align with the target.
    • Across multiple drafting rounds, later rounds can also concatenate the draft’s own output from the previous round, so all K candidates share one continuous hidden state sequence instead of predicting independently and in isolation.

    A caveat: the draft is still designed to produce a batch of candidates quickly, not to replicate the target. It is usually shallow, with far fewer layers and less width than the target. The value of conditioning is approaching the target’s choices at low cost, not replacing the target.

    3.2 KV Cache Sharing: So the Draft Doesn’t Chew Through the Long Context Again

    The draft model reads the context every round. If it recomputed its own KV cache from the prompt, the prefill cost would immediately cancel out the benefit of speculation.

    KV cache sharing lets the draft reuse the cache the target has already computed:

    • In the attention structures shared between draft and target, the local attention layers can reuse the target model’s most recent local KV cache, while the global attention layers can attach to the global KV cache from the target’s last layer.

    Two engineering points to watch:

    1. Structural alignment. Reuse requires both models to match on number of heads, head dimension, and positional encoding scheme. Otherwise you are limited to a projection mapping, or you have to disable sharing altogether.
    2. Cache maintenance. The target’s KV cache is truncated or refilled as tokens are accepted or rejected. The draft’s cache must advance and roll back in sync, or later rounds will read misaligned history. This is the easiest part to get wrong and the one that needs the most testing.

    3.3 Efficient Output Projection: The Hidden Bottleneck in Edge Decoding

    On edge devices or in memory-constrained deployments, models often favor a larger vocabulary — more languages, mixed scripts, more special tokens. Each decode step then performs a projection from the hidden vector against the full vocabulary matrix, of size hidden_size × vocab_size:

    • With hidden_size = 2048 and a vocabulary of 150,000, this layer holds roughly 300 million parameters and is one of the significant costs on the decode path.
    • For small models with only hundreds of millions to a few billion parameters in total, this single layer is especially expensive in relative terms.

    The idea behind efficient output projection (an Efficient Embedder) is coarse-to-fine tiered filtering:

    • First, cluster the vocabulary embeddings and score coarse candidate clusters using each cluster’s representative vector (centroid).
    • Then expand only the highest-scoring batch of clusters down to individual tokens, and finally normalize over the full-vocabulary logits.

    The computation drops from roughly vocab_size to number of clusters + clusters kept × average cluster size, and only when a token actually needs to be produced.

    Viewed through a retrieval lens, this is a classic coarse-rank/fine-rank structure: centroid approximation is essentially replacing a full vector index with a centroid index. Two tradeoffs follow:

    • Recall in the coarse filter determines whether the result stays lossless. If the true top-k tokens fall in clusters that were never expanded, the output changes.
    • It is best to run the centroid query in the same low precision, rather than comparing centroids against a high-precision “true vocabulary” pass, which only adds latency.

    The engineering recommendation is to first quantify agreement between coarse-filtered and full-vocabulary results on an offline evaluation set, then decide whether to enable it by default.

    4. Where Losslessness Comes From: Why the Output Doesn’t Change

    Speculative decoding gains speed by guessing, but the result does not depend on the guesses being accurate. As long as the target model gives its own distribution at each position, a worse draft only reduces the benefit — it never degrades the result.

    • Greedy decoding: compare position by position, and truncate with the target model’s output at the first mismatch. The final output is therefore identical to ordinary token-by-token decoding, apart from differences in floating-point accumulation order.
    • Sampling decoding: the standard approach is rejection sampling over the draft tokens. A rejected token is resampled from the residual distribution, corrected using the probabilities given by the draft model, which mathematically guarantees that the final distribution equals the target model’s.

    Target activation conditioning, KV cache sharing, and efficient output projection all act on the draft side or on the vocabulary projection side. They change the draft’s prediction quality or the candidate range, not the target model’s adjudication of the final token. As long as the target model’s verification and normalization logic stays intact, output quality does not degrade because of these three optimizations.

    What needs focused verification before deployment is whether these three designs have introduced draft distribution drift or target cache contamination. The most direct regression test is to compare greedy-decoding output token by token before and after toggling the feature on a fixed set of prompts, then compare distribution stability under sampling decoding.

    5. The Boundaries of the Gain: Speculative Decoding Is Not a Free Lunch

    Net benefit depends on the ratio of accepted length to the extra cost per round. Watch out for these cases:

    • Concurrency. At large batch sizes, decode is already approaching compute-bound. Running a draft model additionally for every request then competes for compute that should be serving target-model verification. Whether you get a speedup depends heavily on single-request throughput and cluster throughput, and must be established through load testing.
    • Task shape. Tasks that require exact verbatim recall, numerical reasoning, or highly structured output see more draft-target disagreement and typically have low accepted lengths. Templated, stylistically stable generation benefits far more.
    • The tradeoff in draft length K. Too small and the fixed per-round overhead isn’t amortized; too large and the rejected portion is wasted. In practice 3–8 is a common starting point, adjusted based on measured accepted-length distributions.
    • Edge constraints. The draft model itself consumes memory and compute. For memory-tight edge deployments, its cost belongs in the overall budget.

    The recommendation is to build a benefit matrix of task type × concurrency level before launch, and use measured data to decide whether to enable speculative decoding at a specific entry point rather than turning it on globally by default.

    6. Evaluation and Engineering Rollout

    Core Metrics

    • Average accepted length: tokens accepted per round, the most direct measure of draft quality.
    • Draft acceptance rate: the proportion of candidate tokens accepted, useful for telling whether the problem is “the draft is too weak” or “the verification logic is broken.”
    • Time to first token (TTFT) and time per output token (TPOT): speculative decoding mainly optimizes the latter, so track them separately.
    • Throughput and utilization: request-level throughput, accelerator utilization, and the draft model’s share of total time.
    • Quality consistency: output differences before and after toggling, plus distribution stability.

    Deployment Checklist

    1. Version alignment. The draft and target models must match strictly on vocabulary, tokenizer, and positional encoding. Rerun consistency tests whenever either side is upgraded.
    2. Cache correctness. Focus testing on KV cache sharing and rollback logic, covering long context, truncation, and multi-turn conversation.
    3. Gradual rollout. Enable by entry point or tenant. Validate accepted length at small traffic levels first, then ramp up.
    4. Observability. Fold accepted length and the draft’s share of decode time into standard monitoring and alerting. When accepted length stays below threshold, degrade automatically back to ordinary decoding.
    5. Shape matching. Load-test long-form generation, code completion, and structured output separately. Avoid covering every scenario with one global switch.

    7. Conclusion

    Speculative decoding and multi-token prediction are not about computing faster but about computing less, more intelligently: one expensive full forward pass becomes one target-model verification plus several cheap drafts. Target activation conditioning lets the draft see the target model’s intent, KV cache sharing spares the draft from recomputing the long context, and efficient output projection relieves the hidden cost of full-vocabulary projection at the edge. Together they form an optimization loop centered on a single metric: accepted length.

    For developers, what matters is not any specific toggle but the methodology: quantify the boundaries of the benefit first, validate quality with a gradual rollout, then let metrics drive tuning. Teams that call models through an API or through managed inference services such as those on Baidu AI Cloud typically get this kind of capability optimized on the service side; what matters for them is understanding where it applies and which metrics to watch, so they can make the right deployment choice for their own applications.