How Speculative Decoding Raises LLM Inference Speed from 40 to 120 Tokens/s
Speculative decoding speeds up large language model inference by having a small draft model propose several candidate tokens, which a larger target model then verifies in a single pass. This article explains why standard autoregressive decoding is slow, how the draft-and-verify workflow operates, and which factors determine real-world gains. These factors include draft length, acceptance rate, context length, KV cache management, and sampling settings. It also covers how to measure tokens/s correctly.
When running large language models, a common metric is how many tokens the model can generate per second. For large models, each decoding step usually requires a full forward pass, and generation speed is often limited by memory bandwidth, compute resources, context length, and the decoding strategy. Increasing generation speed without noticeably sacrificing output quality has become an important direction in inference system optimization.
One representative approach is speculative decoding, which can be summarized as “a small model drafts, a large model verifies.” Its core idea does not reduce the computation the large model needs. Instead, it lets the large model verify several candidate tokens at once, which reduces the overhead of generating tokens one at a time in sequence.
1. Why Traditional Autoregressive Generation Is Limited
Large language models usually generate text autoregressively. Given a context, the model predicts the next token. It then appends that token to the context, predicts the following token, and repeats the loop.
The process can be abstracted as follows:
Existing context -> predict token 1Existing context + token 1 -> predict token 2Existing context + token 1 + token 2 -> predict token 3
This process has strong dependencies. Each token must wait for the previous token to be determined. As a result, even on hardware with high parallel compute capacity, the decoding stage remains largely serial.
In practice, each step also incurs the following overhead:
- Scheduling compute tasks;
- Reading model weights;
- Accessing and updating the key-value (KV) cache;
- Running attention computation;
- Computing the output layer and sampling;
- Passing results to the next decoding round.
For large models, each step is often limited by memory access and memory bandwidth rather than raw compute. Even when generating one token at a time, reading model weights and cache data can be costly.
2. How the Speculative Decoding Workflow Works
Speculative decoding introduces a smaller, faster draft model. The draft model does not make the final decision about the output. Instead, it quickly predicts a short sequence of candidate tokens based on the current context.
Assuming a draft length of 5, the process works roughly as follows:
Current context↓Draft model generates token 1, token 2, token 3, token 4, token 5 in sequence↓Target model verifies these 5 candidate tokens in one pass↓Accept the consecutive correct part↓Determine subsequent content again, starting from the first mismatched position
The key point is that the draft model generates multiple tokens quickly. The target model then verifies them in parallel, computing probabilities for multiple positions in one pass. Compared with calling the target model once for each token, verification can significantly reduce the number of serial target model calls.
Speculative decoding does not accept draft results unconditionally. The target model remains the final judge. A candidate token is accepted only if it conforms to the target model’s sampling rules. If a mismatch occurs at some position, the system typically regenerates from that position using the target model. Depending on the implementation, the system then decides whether subsequent candidates can be reused.
Because of this, the approach generally does not change the target model’s theoretical output distribution. Actual results, however, still depend on the sampling strategy, random number handling, correction of the candidate distribution, and implementation details.
3. Why Speed Can Improve Significantly
Speculative decoding’s performance gains come mainly from two sources.
1. Fewer Serial Calls to the Target Model
Traditional decoding may require the target model to run many times in sequence to produce an output of a fixed length. Speculative decoding instead tries to verify multiple candidate tokens in a single target model pass.
For example, if the draft model proposes 4 candidate tokens and the target model accepts 3 on average, each main verification pass advances roughly 3 tokens. Even after accounting for rejections, resampling, and edge cases, the total number of target model calls can still decrease.
2. Using the Parallel Capacity of the Verification Stage
When the target model generates a single token, decoding is largely serial. When it verifies a known sequence of candidate tokens, the computations at different positions can proceed in parallel to a degree. This pattern fits matrix operations and hardware parallelism more naturally.
Speculative decoding therefore converts part of the serial generation process into a candidate verification process that better suits parallel execution.
The benchmark cited here, a rise from about 40 tokens/s to nearly 120 tokens/s, reflects a specific combination of hardware, software environment, model pair, task type, and implementation optimizations. It should not be treated as a fixed result for all devices and scenarios.
4. Key Factors Affecting Real-World Speed
1. How Well the Draft and Target Models Match
In general, the closer the draft model is to the target model, the higher the probability that candidate tokens are accepted. However, a draft model that is too large may improve prediction quality but raises the drafting cost. A draft model that is too small generates candidates quickly, but its acceptance rate may drop.
Engineers need to balance the following costs:
Draft cost + target model verification cost + rework cost on failure
The configuration with the lowest total cost is the most reasonable choice. A smaller draft model is not always better, and a longer candidate sequence is not always better either.
2. Candidate Token Length
The number of tokens drafted per round directly affects the gain.
Short candidates let the target model advance only a few tokens per verification, which leaves limited room for improvement. Long candidates can produce more incorrect guesses, leading to more failed verifications and rework. They may also increase the cost of cache management and scheduling.
A better approach is
