Speculative Decoding: Faster LLM Inference Without Hardware Upgrades
Speculative decoding offers a way to accelerate large language model inference without replacing GPUs or quantizing or pruning the target model. This article explains the memory-bound decode bottleneck, how a small draft model proposes candidate tokens that the target model verifies in a single forward pass, why the method can preserve output quality, and how average acceptance length affects real-world speedups. It also covers draft model selection, workload fit, parameter tuning, and combining speculative decoding with other inference optimizations.
Faster Inference Without New Hardware: How Speculative Decoding Speeds Up LLMs
A recent public technical demonstration attracted attention in the developer community: running the same target LLM on the same GPU, and adding only a small “draft model,” improved single-request generation speed by nearly 4x in some test scenarios. Even as concurrent requests continued to rise, overall throughput still maintained roughly 2x growth. No GPU was replaced, and no quantization or pruning was applied to the model itself—only the token generation method changed.
The technique is called Speculative Decoding. Mainstream open-source inference frameworks and inference engines have gradually incorporated it as a standard capability, making the draft model an important part of local LLM deployment. This article starts from the underlying bottleneck and systematically explains the principles, key metrics, and engineering practices of speculative decoding.
1. The Bottleneck: Why LLMs Keep “Moving Themselves” One Token at a Time
To understand why speculative decoding works, it is necessary to first clarify where LLM inference is slow.
A complete inference process is usually divided into two stages:
1. Prefill
After the user submits a prompt, the model processes the entire input in parallel at once, completes attention computation, and builds the KV Cache. This stage processes a large number of tokens in one pass. It is a compute-intensive task, GPU compute utilization is high, and overall efficiency is not low.
2. Decode
Once the model begins generating the answer token by token, each inference step can produce only one token. To generate that single token, the GPU must:
- Read tens or even hundreds of gigabytes of model weights from memory in full;
- Read the existing KV Cache;
- Complete the forward computation and write the newly generated key-value data back to the cache.
When the next token arrives, the same process repeats exactly. In other words, every time the model outputs one token, it must “move” all weights across memory bandwidth once. At this point, the core factor determining speed is no longer how many compute units the GPU has, but memory bandwidth and data movement speed—a large amount of compute capacity sits idle. This is known as a memory-bound scenario.
This is exactly where speculative decoding enters: since every step already pays the cost of reading the full weights once, can a single forward computation produce multiple tokens?
2. Core Idea: Let a Small Model Draft, and the Large Model Review
The speculative decoding approach is clever: introduce a draft model with far fewer parameters than the target model, let it quickly generate several candidate tokens in succession at very low cost, and then have the target model verify those candidates in a batch with one forward computation.
A simple example helps. After the user inputs “The cat”:
- The draft model quickly guesses that the continuation is “sat on my lap”;
- The target model performs one parallel forward computation over these candidate positions and checks their probability distributions one by one;
- The first two tokens, “sat” and “on,” match the target model’s output and are accepted directly. The third token is rejected, and the candidates after it are discarded. The target model generates a corrected token;
- The accepted tokens and the corrected token are written into the KV Cache together, and the process moves to the next round.
Work that would originally have required three or four serial rounds in the target model is now compressed into one verification round. Because the draft model is small, the cost of generating candidates is far lower than the cost of repeatedly reading the full weights in the target model. The industry commonly summarizes this as: the assistant model proposes candidates, and the main model verifies them in a batch.
A key mathematical guarantee is this: as long as the verification strategy is designed properly—for example, using the classic rejection-sampling correction mechanism—the output distribution of speculative decoding is mathematically equivalent to the token-by-token output distribution of the original model. In other words, the speedup does not come at the expense of output quality. This is not approximate compression; it is lossless acceleration.
3. Average Acceptance Length: The Metric That Determines Success
Speculative decoding looks like a free lunch, but actual speedups depend heavily on one core metric: average acceptance length, meaning the average number of draft tokens accepted by the target model per round.
- Suppose the draft model predicts 4 tokens at a time and 3 are accepted. That means one large-model computation advances 4 positions, a significant gain.
- If the draft model guesses wrong frequently, the target model can only keep rejecting and correcting. The draft model’s own inference cost then becomes pure overhead. In extreme cases, the result can even be slower than ordinary decoding.
The main factors affecting average acceptance length include:
| Factor | How It Affects Acceptance |
|---|---|
| Distribution alignment between draft and target models | The more aligned they are, the higher the acceptance rate. Small models from the same family with the same vocabulary usually work best. |
| Draft length (number of candidate tokens per round) | Too short provides insufficient gain; too long means later candidates are more likely to be rejected, and verification cost rises with length. |
| Predictability of generated content | Highly deterministic content such as code, templated text, and formatted output has very high acceptance rates; open-ended creative writing is relatively lower. |
| Sampling temperature | Lower temperatures sharpen the distribution and make guessing easier; higher temperatures increase randomness and reduce acceptance rates. |
This also explains why “more drafting does not necessarily mean faster speed”: draft length is a hyperparameter that must be tuned through measurement. Common values range from 3 to 8, and the best point varies by task.
4. Engineering Practices: How to Use Speculative Decoding Well
1. Draft model selection
Prefer small versions from the same family as the target model that share the same vocabulary, since they offer the highest distribution alignment. If no ready-made small version exists, consider distilling a dedicated draft model from the target model, or using the target model’s own shallow layers as a “self-speculative” approach.
2. Workload fit
Speculative decoding delivers its greatest value in low-concurrency, memory-bound scenarios—typically local single-user inference and edge device deployment. When concurrency is very high and GPU compute is already fully utilized, batching itself has already amortized the cost of weight reads, so the marginal benefit of speculative decoding decreases. However, demonstration data shows that considerable throughput improvements can still be achieved under high concurrency, so it is worth measuring in practice.
3. Parameter tuning
- Start draft length at around 4, and adjust gradually while monitoring average acceptance length;
- Set parameters separately for different task types, such as code generation, dialogue, and long-form writing;
- Use monitoring and alerting systems to continuously observe changes in end-to-end latency, acceptance rate, and throughput.
4. Combine with other optimizations
Speculative decoding does not conflict with quantization, KV Cache optimization, continuous batching, or other techniques; they can be used together. For example, in cloud inference services, models can be hosted on container platforms, with log services and monitoring/alerting used for long-term observation of acceptance rates and latency distributions, forming a closed loop of deployment, observation, and tuning. For enterprise applications, model services and inference acceleration capabilities offered by cloud providers such as Baidu AI Cloud can also provide ready-to-use paths for adopting such optimizations.
5. Conclusion
The essence of speculative decoding is to transform the decode stage of LLM inference from “moving the full weights once per step” into “moving them once and producing multiple steps of output,” precisely targeting the core bottleneck of memory-bound inference. It does not require more expensive GPUs and does not sacrifice output quality. Through the division of labor in which a small model drafts and a large model reviews, it can multiply inference speed.
For developers, understanding a few key levers—average acceptance length, draft model alignment, and draft length tuning—makes it possible to achieve real benefits from this technique in practical business scenarios. As mainstream inference frameworks continue to integrate it, speculative decoding is moving from a frontier trick to a standard configuration for LLM inference, and it is worth deep study by every engineer focused on inference performance.
