Multi-Token Prediction for LLM Inference: How It Works and How to Apply It
This article explains why large language model inference is constrained by memory bandwidth rather than compute, and how multi-token prediction (MTP)—a practical form of speculative decoding—addresses that bottleneck. It covers the core draft-and-verify workflow, the acceptance mechanism that keeps output quality intact, and two key optimizations (target activation fusion and KV cache sharing). It also outlines how to evaluate and deploy these techniques, along with their practical limits, so developers can judge whether MTP is worthwhile for their workload.
Why LLM Inference Is Bottlenecked by Memory Bandwidth
To understand the value of multi-token prediction, you first need to see exactly where the bottleneck in LLM inference lies. During training, models are typically limited by compute. During autoregressive decoding, the situation is reversed.
A large model generates text token by token. For every new token it produces, it has to move all of the model weights from high-bandwidth memory (HBM) into the compute units to run a single forward pass. The key issue here is that the matrix operations for a single token are relatively small, yet the large weight matrices must be moved again and again. As a result, decoding is tightly constrained by memory bandwidth, and much of the GPU’s compute sits idle—a condition known as being memory-bound.
This means that no matter how much compute you have, generation speed cannot improve unless you can keep it fed. The essence of the problem is not that computation is slow, but that data movement is slow. Any effective acceleration approach must find ways to reduce the number of forward passes through the main model, or equivalently, to increase the number of tokens produced per forward pass.
The Core Idea of Speculative Decoding
Speculative decoding answers this with a division of labor based on “guess then verify”:
- A smaller, faster draft model speculates ahead about the several tokens the main model is likely to generate next;
- The larger target model then verifies those candidate tokens in parallel;
- Only the tokens the target model approves are accepted; the rejected ones are corrected by the target model.
The elegance of this approach is that the draft model’s guessing is cheap, while the target model’s cost of verifying multiple tokens is nearly the same as generating a single one—because verification can be done in a single parallel forward pass. As long as the draft hit rate is high enough, one expensive target-model call yields several tokens, which amortizes the memory-access overhead.
Multi-Token Prediction: From Single Guesses to Batch Proposals
Multi-Token Prediction (MTP) is a typical form that speculative decoding takes in practice. Its defining trait is that the draft model no longer probes one token at a time; instead, it predicts several future tokens in parallel at once and hands the resulting candidate sequence to the target model.
The flow can be abstracted into the following loop:
def speculative_generate(prefix, draft_model, target_model, gamma=4, max_new=256):outputs = []while len(outputs) < max_new:# 1. Draft model quickly guesses gamma candidate tokens autoregressivelydraft_tokens = draft_model.propose(prefix, gamma)# 2. Target model runs one parallel forward pass over "prefix + candidates" (single call)logits = target_model.forward(prefix + draft_tokens)# 3. Compare position by position, accept up to the first mismatchaccepted = 0for i, tok in enumerate(draft_tokens):if argmax(logits[i]) == tok:accepted += 1else:break# 4. Fill in one token from the target model's prediction at the rejected position (or the end)bonus = argmax(logits[accepted])new_tokens = draft_tokens[:accepted] + [bonus]outputs.extend(new_tokens)prefix = prefix + new_tokensreturn outputs
Because the draft model has fewer parameters and a lighter structure, it can predict several future tokens in less time than the target model takes to process a single token. The target model then runs all of those candidates through a single forward pass.
The Verification and Acceptance Mechanism: Why It Speeds Things Up Without Losing Quality
Understanding the acceptance rules is the key to understanding “lossless” quality. The target model’s verification logic splits into two cases:
- Full acceptance: If the target model agrees with all of the draft tokens, those tokens are all accepted at once. In addition, the target model’s forward pass also yields one extra token at its final position. In other words, a single round can advance the target model by multiple tokens, with the last one coming as a kind of “free bonus.”
- Partial acceptance: If the target model disagrees with the draft at some point, acceptance stops at the first mismatched token; the rejected position is replaced by the target model’s own prediction, and all draft tokens after it are discarded.
Why does this not degrade quality? Because every token in the final output is signed off by the target model. The draft model is only responsible for “speeding up the proposal” and has no final say. The accepted portion already agrees with the target model’s judgment, while the rejected portion is overwritten by the target model’s correct answer. The output distribution therefore stays consistent with the original target model, and generation quality does not drop when a draft model is introduced.
Key Optimization 1: Target Activation Fusion
A major pain point of naive speculative decoding is that the draft model “lacks information,” leading to a low hit rate. Target activation fusion was designed specifically to improve the accuracy of draft predictions.
Its core approach is to concatenate the embedding from the target model’s final layer with the draft model’s token embedding, then map this to the draft model’s hidden-layer dimension, so the draft model can also “see” information from the target model’s output when it predicts. This way, the draft model no longer works in isolation; it aligns its guesses with the semantic representation the target model has already formed.
In later rounds of multi-round prediction, the draft model’s own output from the previous round is also concatenated in, forming continuous context clues that further strengthen the coherence of predictions.
Key Optimization 2: KV Cache Reuse
If the draft model recomputed its attention cache from scratch each time, the memory-access savings gained from speculative decoding would be wasted again. KV cache sharing solves this problem by letting the draft model directly reuse the target model’s KV cache, avoiding redundant computation.
Concretely:
- Local attention layers reuse the target model’s most recent local KV cache;
- Global attention layers connect to the global KV cache of the target model’s final layer.
This “share rather than rebuild” strategy lets the draft model acquire the context state the target model has already computed at almost zero additional cost, saving both memory and compute. It keeps the speedup gains of the whole speculative decoding scheme from being eroded by internal overhead.
Engineering Practice: How to Evaluate and Deploy
In real engineering, whether to adopt multi-token prediction requires weighing benefits against costs:
- Check the acceptance rate: The higher the draft hit rate, the more pronounced the speedup. The acceptance rate is the primary metric for whether a scheme is worthwhile; it depends on the quality of the draft model, the effectiveness of target activation fusion, and the predictability of the specific task.
- Check the draft model’s overhead: A draft model that is too small may have an insufficient hit rate, while one that is too large slows down proposal speed, so you need to find a balance. The number of draft tokens (how many are predicted at once) should also be tuned to fit the business scenario.
- Check the workload characteristics: Speculative decoding yields the greatest gains during the memory-bound decoding phase; for scenarios that are already compute-bound, there is limited room for speedup.
- Check cache management: KV cache reuse can significantly reduce memory pressure, which is especially important for long-context scenarios.
On the deployment side, this kind of capability is typically integrated into mainstream inference frameworks as an inference acceleration module. It can rely on a container platform for elastic scaling, and monitoring, alerting, and logging services can be used to observe metrics such as acceptance rate, throughput, and latency for continuous tuning. General capabilities offered by cloud providers such as Baidu AI Cloud (for example, containerized deployment and observability toolchains) can also help teams roll out these optimizations more smoothly.
Applicability and Caveats
It is worth stressing that speculative decoding and multi-token prediction are “the icing on the cake” acceleration techniques, not a cure-all:
- The speedup ratio fluctuates with the task, the model, and draft quality; it can reach several times improvement in ideal scenarios, but the exact magnitude depends heavily on the acceptance rate;
- They do not change the model’s output distribution, so they introduce no new quality risk—but they also do not magically improve the model’s capabilities;
- The draft model itself consumes some memory and compute, which must be weighed in extremely resource-constrained environments.
Conclusion
Multi-token prediction represents one of the mainstream directions in LLM inference optimization today: using a lightweight draft model to “guess in parallel,” paired with the target model’s “single verification,” it transforms memory-bound autoregressive decoding from “one token at a time” into “multiple tokens at a time.” Combined with target activation fusion and KV cache reuse, this scheme achieves a substantial improvement in inference speed with almost no loss in generation quality. For developers, understanding the underlying “guess-and-verify” logic and acceptance mechanism matters more than merely tuning parameters—because only by grasping the essence of the bottleneck can you truly turn speedup gains into real results.
