Speculative Decoding with Multi-Token Prediction Draft Models: Practical LLM Inference Acceleration

    Large language models generate text through autoregressive decoding, which becomes memory-bandwidth-bound in low-concurrency settings because each token requires reloading the entire set of model weights from GPU memory. This article explains how speculative decoding and multi-token prediction (MTP) draft models break the "one token at a time" bottleneck by pairing cheap speculative guesses with a single parallel verification from the target model, while keeping the output distribution identical to the original model. It walks through the core draft-and-verify workflow with pseudocode, three key engineering optimizations (target activations, KV cache sharing, and efficient embedders), the roughly 3x speedup and the scenarios where it pays off, and practical guidance for adopting these techniques in your own inference service.

    Introduction: Why Autoregressive Decoding Hits a Memory-Bandwidth Wall

    During text generation, mainstream large language models rely on autoregressive decoding: each forward pass produces a single new token, which is then appended back to the input sequence for the next prediction step. In low-concurrency or single-request inference, this “one token per step” serial paradigm exposes a structural bottleneck. Every token requires loading all of the model’s weights from GPU memory into the compute units exactly once, yet the amount of data actually participating in the matrix operations is very small. As a result, the compute units sit largely idle, and hardware performance is limited by memory bandwidth rather than compute throughput. In other words, inference in this regime is memory-bandwidth-bound rather than compute-bound.

    If a single weight load could “by the way” produce multiple tokens, the cost of memory access would be amortized significantly. This is exactly the problem that speculative decoding and multi-token prediction (MTP) aim to solve. The goal is clear: raise generation speed by several times while keeping the final output identical to that of the original model.

    The Core Idea of Speculative Decoding: Guess First, Verify Later

    The basic idea of speculative decoding can be summarized as “a cheap draft model guesses, an expensive target model verifies”:

    • Draft model: A lightweight auxiliary model with far fewer parameters than the main model, responsible for quickly “guessing” several candidate tokens that might come next. It can produce multiple candidates in parallel in a single forward pass, much faster than the target model generating them one at a time.
    • Target model: The original large model, responsible for running a single parallel verification over the candidate sequence produced by the draft model.

    The key point is that verification adds almost no extra cost. No matter how many candidate tokens are verified at once, the target model needs only a single forward pass to evaluate all candidate positions simultaneously, because the verification process is also memory-bandwidth-bound and the weights only need to be loaded once. When one forward pass can “confirm” multiple tokens, the average cost per token is amortized, delivering a substantial speedup.

    How Multi-Token Prediction (MTP) Draft Models Work

    A multi-token prediction draft model is precisely the lightweight auxiliary model that serves the paradigm above. Its defining trait is that it “predicts multiple subsequent tokens at once” rather than generating them one by one as a traditional draft model does. The workflow is as follows:

    1. Based on the current context, the draft model predicts multiple subsequent candidate tokens in parallel, forming a “draft sequence.”
    2. The target model receives the original context plus this draft sequence and, in a single forward pass, computes the true conditional probability distribution for every candidate position.
    3. The target model then checks position by position: starting from the first position, as long as the target model’s distribution endorses the draft token, the token is accepted; at the first mismatch, the target model replaces that position with its own prediction and discards all subsequent draft tokens.
    4. Because the final sequence is entirely governed by the target model, the output distribution matches the distribution of tokens generated directly by the target model. Therefore, generation quality is identical to the original model, and the speedup comes with no loss of accuracy.

    This process can be described with the following pseudocode:

    1. def speculative_generate(context, draft_model, target_model,
    2. num_draft_tokens, max_steps):
    3. output = list(context)
    4. while not is_finished(output) and step < max_steps:
    5. # 1. Draft model predicts multiple candidate tokens in parallel
    6. draft_tokens = draft_model.predict_next(
    7. output, num=num_draft_tokens)
    8. # 2. Target model runs a single parallel verification on [context + draft]
    9. target_probs = target_model.forward(
    10. output + draft_tokens) # a distribution at every position
    11. # 3. Verify from left to right, accepting up to the first mismatch
    12. accepted = 0
    13. for i, token in enumerate(draft_tokens):
    14. if target_model.accepts(target_probs[i], token):
    15. accepted += 1
    16. else:
    17. break
    18. # 4. Append the accepted draft tokens
    19. output.extend(draft_tokens[:accepted])
    20. # 5. Target model contributes one extra token
    21. # (regardless of full acceptance, the target model can emit a new token)
    22. bonus_token = target_model.sample_next(
    23. target_probs[accepted])
    24. output.append(bonus_token)
    25. step += 1
    26. return output

    The code reveals the core logic: accept as long a draft prefix as possible, then let the target model add one token. When the draft hit rate is high, a single loop iteration advances several positions; when the draft is poor, performance falls back to that of ordinary decoding without becoming worse. This “no-lose, only-gain” property is the fundamental reason speculative decoding is so widely adopted.

    Three Key Engineering Optimizations

    To make speculative decoding genuinely fast and end-to-end practical, the algorithmic framework alone is not enough; fine-grained optimizations in the engineering implementation often determine success or failure. The following optimizations are especially critical in practice.

    Target Activations: Making the Draft More Aware of the Target Model

    The draft model and the target model are two separate networks, and the draft model cannot see the target model’s internal representations, so it is prone to “guessing wrong.” An effective improvement is to introduce a target activation mechanism: concatenate the hidden states (hidden embedding) from the target model’s last layer with the draft model’s own token embeddings, then map the result to the draft model’s hidden layer dimension as its input.

    The benefit is that the draft model can leverage the target model’s “understanding” of the current context to make predictions, significantly improving the hit rate of candidate tokens. Across multiple rounds of draft prediction, later rounds also concatenate the draft model’s own output from the previous round, forming a coherent chain of predictions that makes the entire draft better aligned with the target model’s likely direction.

    KV Cache Sharing: Avoiding Redundant Computation

    Autoregressive generation relies on the KV cache to avoid recomputing the historical sequence. If the draft model and the target model each maintain their own cache, it incurs extra GPU memory overhead and wasted computation. KV cache sharing lets the draft model directly reuse the cache already built by the target model:

    • For local attention layers, the draft model reuses the target model’s most recent local KV cache.
    • For global attention layers, the draft model’s corresponding layer connects directly to the target model’s final layer’s global KV cache.

    Through this reuse, the draft model no longer needs to recompute historical keys and values, further compressing the overhead of the draft phase and bringing the overall speedup ratio closer to the theoretical upper bound.

    Efficient Embedder: Breaking the Full-Vocabulary Bottleneck on Device

    In on-device or resource-constrained environments, the model’s final language model head (LM Head) must perform a matrix multiplication over the full vocabulary, mapping hidden states into logits of the vocabulary-size dimension. When the vocabulary is large, the compute and memory-access cost of this step cannot be ignored.

    One optimization is a centroid/clustering approach: cluster the token embeddings, use each cluster’s representative vector (centroid) for coarse matching, and then perform fine-grained computation only within the candidate clusters, thereby avoiding a full dense matrix multiplication over the entire vocabulary. This “coarse filter, then fine compute” strategy can noticeably reduce the computational burden of the embedding and output layers with almost no impact on quality, making it especially friendly for on-device deployment.

    Speedup and Applicable Scenarios

    Combining the above techniques, the draft model can predict multiple subsequent tokens in less time than the target model takes to generate a single token, and the target model then verifies them in parallel, achieving an overall generation speedup of about 3x without sacrificing output quality. It is worth emphasizing that “about 3x” is an upper-bound reference value; the actual speedup depends on the quality of the draft model, the predictability of the task, and the specific hardware configuration.

    These techniques are best suited to the following scenarios:

    • Low-concurrency, single-request interactive generation: Such as intelligent coding assistants and conversational assistants, where the memory-bandwidth bottleneck is most pronounced and the speedup is most significant.
    • Strict output quality requirements: Because the target model governs the entire process, the output is identical to the original model, making it suitable for domains such as finance and healthcare where “quality compromises” are unacceptable.
    • On-device and edge deployment: Combined with optimizations such as an efficient embedder, it delivers a smoother generation experience on local devices.

    Note that in high-concurrency, large-batch throughput scenarios, inference often shifts from memory-bandwidth-bound to compute-bound, and the benefit of speculative decoding gets diluted. Therefore, whether to enable a draft model should be evaluated against the actual workload characteristics.

    Practical Implementation Advice

    For developers who want to introduce multi-token prediction and speculative decoding into their own inference service, the following implementation path is a useful reference:

    1. Establish a correctness baseline first: Ensure the draft model’s verification logic strictly follows the “target model governs” principle. Compare outputs before and after enabling the feature on fixed inputs, and confirm the distribution is consistent before discussing performance.
    2. Choose the right draft model size: A draft model that is too small lowers the hit rate, while one that is too large weakens the speedup benefit. It needs to be tuned based on the target model’s size and the hardware conditions.
    3. Make good use of runtime monitoring: With logging services and monitoring/alerting systems, collect metrics such as draft acceptance rate, tokens advanced per step, and end-to-end latency to continuously locate bottlenecks and optimize.
    4. Combine with elastic infrastructure: Deploy models with MTP enabled on a container platform, and use elastic scaling to dynamically adjust resources based on request volume, balancing latency and cost.

    Baidu AI Cloud provides general capability support across deployment, monitoring, and elastic scheduling in the areas of model inference acceleration and engineering implementation. Developers can incorporate these optimization techniques into their existing inference service architecture based on their own business scenarios.

    Conclusion

    Multi-token prediction draft models and speculative decoding essentially break the inefficient “one token at a time” paradigm of autoregressive decoding through “cheap guessing plus parallel verification.” They put the idle compute in memory-bandwidth-bound scenarios back to work, achieving a several-fold speedup without sacrificing output quality. Understanding draft generation, the acceptance strategy, and the three key optimizations—target activations, KV cache sharing, and efficient embedders—is an important foundation for building efficient large-model inference services. For applications that pursue low latency and a high-quality experience, these techniques are gradually moving from a “nice-to-have” to a “standard configuration.”