Multi-Token Prediction and Speculative Decoding: A Practical Guide to Faster LLM Inference
Multi-token prediction and speculative decoding can accelerate large language model inference by proposing several tokens cheaply and verifying them together with a target model. This article explains how the two concepts differ, the conditions required to preserve decoding behavior, and the engineering trade-offs involved in draft generation, KV cache management, performance evaluation, and deployment.
1. Why LLM Generation Needs New Acceleration Strategies
Autoregressive language models generate text by reading the existing context, predicting the next token, and appending that token to the context. Because each subsequent token depends on earlier results, generation has an inherent sequential dependency.
At low batch sizes, producing each token may require reading a substantial portion of the model’s weights from GPU memory. Compute units may not remain fully utilized, while weight transfers, cache accesses, and operator scheduling account for much of the execution time. These data-movement costs often become increasingly important as model size grows.
Inference is not always memory-bandwidth-bound, however. Long contexts, large batches, different quantization configurations, and hardware characteristics can all change the bottleneck. Acceleration should therefore begin with profiling rather than the assumption that every generation workload behaves the same way.
Multi-token prediction and speculative decoding offer an important approach: use a lower-cost mechanism to propose several upcoming tokens, then verify them together with the target model. The goal is to advance through more output positions during each expensive target-model execution.
2. Multi-Token Prediction and Speculative Decoding Are Different Concepts
Multi-Token Prediction: Proposing More Candidates
Multi-token prediction refers to a model or auxiliary prediction structure that predicts multiple future positions rather than focusing only on the immediate next token.
There are several ways to implement this capability, such as adding prediction structures for future positions or training a lightweight auxiliary network that uses features from the target model. Whether predictions are produced in parallel or over multiple rounds, and how information flows between positions, depends on the design.
Proposing multiple tokens at once does not mean that every token is generated independently and simultaneously. Nor does it imply that the candidate sequence naturally follows the target model’s generation distribution.
Speculative Decoding: Using Candidates Correctly
Speculative decoding is an inference execution method that typically consists of drafting and target-model verification.
The draft model proposes a candidate sequence at relatively low cost. The target model then determines which candidates can be accepted. The draft model may use an ordinary autoregressive architecture or a multi-token prediction structure.
The distinction is straightforward: multi-token prediction improves candidate generation, while speculative decoding defines how candidates enter the final output. Combining the two creates an end-to-end acceleration process.
3. How a Speculative Decoding Cycle Works
Starting from a confirmed context, the draft model proposes several consecutive candidate tokens. The target model then processes the context and candidate sequence, computing the conditional distributions for the relevant positions under causal attention.
The logical dependencies between tokens remain intact. However, because the candidate sequence is already available, the target model can evaluate multiple positions in one forward pass instead of requiring a separate full execution for each token.
Verification generally proceeds from the beginning of the candidate sequence:
- Candidates that consecutively meet the acceptance criteria can be added to the final output.
- At the first rejected position, the algorithm must produce a correction.
- Candidates after that position depend on an invalid prefix and cannot be used directly.
- If every candidate is accepted, common implementations can generate one additional token using the distribution computed by the target model.
Verifying candidates together does not eliminate context dependencies. Each position may depend only on the preceding context and candidate prefix, not on future positions.
4. What Is Required to Preserve Output Behavior?
Saying that “the target model makes the final decision” is not enough to establish that output quality remains unchanged. The decoding strategy and the correctness of the verification algorithm must also be specified.
Deterministic Decoding: Preserving Token Choices
Under a deterministic selection strategy, each draft candidate can be compared with the token the target model would choose for the corresponding prefix. The matching prefix is accepted, and the target model’s choice replaces the first mismatch.
This process can preserve the same token-selection path as direct target-model decoding if context handling, stopping conditions, numerical behavior, and constraints remain consistent. Real implementations must still check edge cases caused by numerical precision and differences in parallel execution.
Random Sampling: Acceptance Probabilities and Residual Correction
For random sampling, independently sampling once from each model and accepting only when the results match does not, by itself, preserve the target distribution.
Let the target distribution at a position be (p), the draft distribution be (q), and the proposed token be (x). In the standard exact speculative sampling framework, the acceptance probability is:
[
a(x) = \min\left(1, \frac{p(x)}{q(x)}\right)
]
If the candidate is rejected, the correction must be sampled from the normalized residual distribution proportional to:
[
\max(p - q, 0)
]
It should not be replaced arbitrarily with an ordinary sample from the target distribution.
Under the algorithm’s assumptions, this mechanism preserves the target distribution. It does not guarantee identical text across individual random runs. Additional candidate filtering, approximate probabilities, or inconsistent sampling transformations require renewed correctness checks; such implementations cannot automatically be described as lossless.
5. Three Ways to Improve Draft Acceptance
Use the Target Model’s Hidden States
The target model’s hidden states contain high-level representations of the current context. A draft network that uses these features does not have to reconstruct that understanding using only its own smaller parameter set.
One approach combines target hidden states with candidate token embeddings, then projects the result into the draft network’s hidden dimension. Subsequent predictions may also use states previously produced by the draft network.
This design can improve agreement between the draft and target models, but it also couples their architectures more tightly. Hidden-state dimensions, extraction points, and numerical distributions require adaptation. Target hidden states are not a universal interface that can be connected to any draft model without modification.
Reuse the Attention KV Cache
A key-value, or KV, cache stores attention keys and values for previous positions, avoiding repeated computation over the historical context. If the draft model can read a compatible target-model cache, it may reduce duplicate context processing and additional cache storage.
Cache sharing involves more than allowing two models to access the same memory. Attention-head configurations, tensor layouts, positional encodings, layer semantics, and numerical precision can all affect compatibility. Models with different attention windows also require a distinction between access to local history and access to the full history.
An implementation must explicitly define which states can be shared, which require adaptation, and which must remain separate.
Optimize Vocabulary Output Computation
Once the draft network becomes sufficiently lightweight, projecting its output over the full vocabulary can become a significant cost. Grouping, hierarchical computation, or candidate filtering may reduce the number of tokens requiring fine-grained computation.
For example, a system might first estimate which token groups are likely to contain useful candidates, then perform more detailed computation within those groups. This is a general optimization direction, not a required component of every multi-token prediction method.
If these techniques change the draft distribution, exact speculative sampling must use the actual draft probabilities for correction. If approximation is applied directly to the target distribution, its effect on output quality requires separate analysis.
6. Why Longer Drafts Are Not Always Faster
The benefit of speculative decoding depends on how many additional tokens are accepted relative to the cost of producing and verifying them.
A simplified relationship is:
[
\text{Average time per output token}
\approx
\frac{
\text{Drafting time} + \text{Verification time} + \text{State-management time}
}{
\text{Actual output tokens per cycle}
}
]
Increasing draft length may allow a verification pass to advance further, but it can also introduce several costs:
- Draft generation takes longer.
- The target model must verify more positions.
- Predictions for more distant positions may be less accurate.
- An early rejection wastes computation on later candidates.
- Temporary caches and intermediate states consume more memory.
The best draft length therefore depends on the workload. Longer drafts may be worth testing for predictable, formatted content. Outputs with more branching possibilities or greater randomness warrant a more cautious approach.
Some workloads can achieve substantial acceleration, but a speedup measured in one test should not be presented as a universal guarantee. Performance claims should disclose model size, hardware, concurrency, context length, output length, and sampling settings.
7. Cache Rollback Is a Critical Implementation Challenge
When the target model verifies candidates, it typically generates new KV cache entries for their positions. Once a candidate is rejected, states for subsequent positions cannot remain part of the valid history.
A reliable implementation should distinguish between a committed prefix and a temporary candidate region:
- Write states associated with draft candidates into temporary storage.
- Complete verification and determine the accepted prefix length.
- Commit only the states corresponding to the valid prefix.
- Discard temporary states for the rejected position and all subsequent positions.
- Update the context with the correction token, then begin the next cycle.
Removing text without updating the cache can allow invalid candidates to continue influencing future generation. Stop tokens, output-length limits, structured-output constraints, and request cancellation must all be handled within the same state-management logic.
8. Building a Credible Evaluation Process
Establish a Target-Model Baseline
Keep hardware, numerical precision, sampling strategy, and serving settings consistent. Without speculative decoding, measure:
- Time to first token.
- Time per output token during generation.
- Total completion time.
- GPU memory usage.
Draft-model loading, feature transfers, and initialization can affect the initial response. Measuring only steady-state generation speed is therefore insufficient.
Measure Both Acceptance Benefits and Execution Costs
At a minimum, record:
- Candidates proposed per cycle and the actual accepted prefix length.
- Time spent drafting, verifying, and managing caches.
- Throughput and tail latency at different concurrency levels.
- Performance across different input and output lengths.
- Additional memory used by the draft model and temporary caches.
Consecutive accepted-prefix length is often more informative than average per-position acceptance rate. The first rejection determines whether later candidates remain usable.
Validate Quality According to the Decoding Strategy
For deterministic decoding, compare output sequences with the baseline. For random sampling, combine algorithmic correctness checks with statistical evaluation; a small set of examples cannot establish that the distribution is preserved.
For structured generation, also verify format compliance, field completeness, and consistency with baseline constraint handling.
9. Deployment Recommendations and Practical Limits
Good candidates for initial evaluation include workloads with long outputs, expensive target-model decoding steps, strong agreement between the draft and target models, and significant weight-reading costs at low concurrency.
By contrast, the extra overhead may be difficult to recover for very short answers, already saturated large-batch inference, severely constrained GPU memory, or persistently low draft acceptance.
Deployment should include a fallback path. Validate correctness offline, then run limited-traffic tests. Continuously monitor accepted-prefix length, latency, and memory overhead. Fall back to direct target-model decoding when benefits are insufficient or state anomalies occur.
Dynamically adjusting draft length can provide further optimization, but it must not change the underlying verification and correction rules.
The central value of multi-token prediction and speculative decoding is not to bypass the target model. It is to make each target-model execution perform more useful work. Reliable acceleration requires coordination across candidate quality, verification algorithms, cache management, and runtime scheduling. Only when correctness, cost, and reproducible performance are established can algorithmic potential become dependable engineering value.
