Speculative Decoding: Speed Up LLM Inference Without Upgrading Your GPU
Speculative decoding pairs a small draft model with a large target model to generate multiple tokens per verification pass. This article explains why LLM decode is often limited by memory bandwidth rather than compute, how speculative decoding works, how to read average acceptance length, how to choose a draft model and draft length, and how to deploy it reliably with monitoring and a fallback plan.
Why LLM generation often feels like squeezing out toothpaste, one word at a time
On the same machine, with the same model and the same prompt, long-form generation often comes out one token at a time. Many people’s first reaction is that the hardware isn’t powerful enough, so they wonder whether it’s time for a new GPU. Yet in many setups, generation speed barely improves even when the GPU still has compute headroom. That suggests the bottleneck in the decoding stage of LLM inference is often not just compute.
Speculative decoding is one optimization approach worth a closer look. It introduces a smaller, faster draft model that first generates several candidate tokens, which the main model then validates together in a single forward pass. When the draft model’s output distribution is reasonably close to the target model’s and the acceptance rate is high, this can often deliver a noticeable speedup. Real-world gains depend on the model, hardware, and concurrency, so always measure them.
Understand the bottleneck first: Prefill and Decode behave differently
LLM inference is usually split into two stages. Their computational characteristics are different, so the right optimization focus differs too.
| Stage | Main task | Compute profile | Primary bottleneck | Key metrics | Fit for speculative decoding |
|---|---|---|---|---|---|
| Prefill | Process the user prompt and build the KV cache | Compute-intensive; processes many tokens at once | GPU compute, matrix-operation efficiency | Time to first token, overall throughput | Usually not the main target |
| Decode | Generate one token per step | Memory-access-intensive; repeatedly reads weights and KV cache | Memory bandwidth, data-movement efficiency | tokens/s, generation latency | Primary stage where speculative decoding helps |
During decode, every generated token requires reading the model weights and the existing KV cache, then writing the new key/value data back into the cache. When the weights are tens or even hundreds of gigabytes, every token adds significant data-movement pressure. So even if the GPU’s compute units are still idle, generation speed can be capped by memory bandwidth.
This is also the root cause of the “word-by-word toothpaste” behavior: decode advances only one position at a time, hardware utilization stays low, and the bottleneck lies more in data movement than in raw compute.
The core idea: the small model answers first, the big model grades
The basic flow of speculative decoding can be summed up as: the draft model answers first, and the target model grades.
A simplified pseudocode version:
Input: target model M, draft model D, draft length K, sampling parametersProcess:1. Draft model D generates K candidate tokens from the current context;2. Target model M runs a single forward pass over "existing prefix + K candidate tokens";3. Using the target model's probability distribution and the sampling parameters,validate the K candidate tokens;4. Accept the longest valid prefix, and optionally append one corrective tokengenerated by the target model after the rejected position;5. If no stop condition is met, continue to the next round.
Here is a simple example. The user inputs “The cat”, and the draft model might guess “sat on my lap”. The target model then checks these candidate positions with a single forward pass. If the first few candidates match the target model’s distribution, they are accepted in a batch. If one doesn’t match, everything from that position onward is rejected, and the target model generates one corrective token.
Previously, the target model might need several consecutive autoregressive rounds, reading the full weights every time. Now, the draft model supplies candidates first, giving the target model a chance to advance several tokens in a single verification pass. Because the draft model is usually smaller, generating the candidates is relatively cheap, so the overall process can speed up.
Why verifying several tokens doesn’t necessarily slow things down much
A key point about speculative decoding: verifying K tokens can cost about as much as generating 1 token.
That holds under certain conditions, though. It mainly applies when the workload is memory-bandwidth-bound, runs at low concurrency, and uses short verification sequences. In those scenarios, the target model’s main cost is moving weights from VRAM to the compute units, not the extra computation from K new candidates. As long as the candidate tokens are formed into a sequence and verified in parallel, the extra compute can be small relative to the weight movement.
Change the scenario and the conclusion can change, too:
- Under high-concurrency batching, the GPU’s compute may already be saturated, so the extra computation from verifying multiple tokens becomes more noticeable;
- The draft model’s candidate generation itself consumes compute, VRAM, and time;
- With long verification sequences, the cost of attention and the KV cache can rise.
So “verification costs about the same as generating one token” shouldn’t be read as a universal promise. Use real measurements to decide. Speculative decoding can often deliver a clear speedup when the draft and target models’ distributions are reasonably close and the acceptance rate is high, but actual gains depend on the model, hardware, and concurrency.
Key metric: how to read average acceptance length
One of the most important metrics for evaluating speculative decoding is average acceptance length: the average number of draft tokens the target model accepts per round.
Suppose the draft model generates 4 tokens in one pass and 3 are accepted. That round has advanced several positions, which is a good sign. If the draft model guesses wrong frequently, the target model must keep rejecting and correcting. The extra verification overhead can then eat into the gains, or even slow things down.
FAQ
What average acceptance length is reasonable?
There is no fixed threshold. Results vary widely across models, tasks, sampling settings, and hardware. In practice, focus more on end-to-end metrics such as tokens/s, time to first token, VRAM usage, and throughput under concurrency. If enabling speculative decoding raises average acceptance length clearly above 1 and improves tokens/s, the approach is usually working. If it stays near 1 or fluctuates heavily, reconsider the draft model or adjust the draft length.
How do you choose a draft model?
Start by favoring a model that shares the target model’s tokenizer, comes from a similar domain, and is small enough with low latency. Models from the same family, using the same tokenization scheme, and fine-tuned or distilled through alignment are usually closer to the target model’s distribution, which can lead to a higher acceptance rate. But “small” is not the only criterion. A draft model that is too weak produces lower-quality candidates, which adds wasted verification work.
When should you avoid speculative decoding?
Be cautious in the following situations:
- High concurrency with the GPU’s compute already saturated, where the benefits may shrink;
- Tight VRAM with no room left to load the draft model;
- Draft and target models using inconsistent sampling parameters;
- An unstable inference framework implementation, or one that can’t guarantee correct verification logic;
- Latency-critical workloads that can’t absorb the extra overhead of draft generation and scheduling.
A longer draft isn’t always better
Draft length is the number of candidate tokens generated per drafting step. Many developers assume a longer draft is always better, but there’s usually an optimal range that needs tuning.
If the draft is too short, each round advances too few tokens to make full use of a verification pass. If the draft is too long, later candidates are increasingly likely to be rejected, and those doomed candidates waste the draft model’s compute. They can also increase the overhead from longer verification sequences.
A common starting point is to test with 4 or 8, then adjust gradually based on average acceptance length, tokens/s, VRAM usage, and concurrency behavior. The optimal draft length depends on:
- How closely the draft and target models’ distributions align;
- The task type, such as code generation, text summarization, or dialogue;
- The hardware’s bandwidth and compute configuration;
- The number of concurrent requests;
- Sampling parameters such as temperature and top-p.
On output consistency, one point is worth emphasizing. With identical sampling parameters and random seed, and consistent target-distribution implementations, standard speculative decoding can preserve the output distribution. Different frameworks may differ in numerical or scheduling details, though. So under a standard implementation and consistent sampling settings, speculative decoding can help preserve quality. In practice, you still need to watch for risks such as the draft model’s extra VRAM usage, draft generation latency, and sampling inconsistencies. Don’t read it as an unconditional “no quality loss” guarantee.
Putting it into practice: a deployment checklist and minimal validation steps
To deploy speculative decoding in a real inference framework, follow this checklist.
Pre-launch checklist
- Confirm the tokenizers match. The draft and target models should ideally share the same tokenizer. Otherwise, combining candidate tokens and the verification logic can get complicated.
- Measure the draft model’s resource cost. Track VRAM usage, draft generation latency, and the impact on batch processing.
- Start with a draft length of 4 or 8. Don’t set it too high from the outset.
- Set up monitoring. Track at least tokens/s, time to first token, average acceptance length, peak VRAM usage, and concurrency level.
- Prepare a fallback. Switch back to standard decoding if acceptance length drops too low, VRAM runs short, or latency behaves abnormally.
- Plan your concurrency strategy. Validate the gains at low concurrency first, then increase it gradually while watching throughput and stability.
Minimal validation steps
Step 1: Establish a baseline with single requests at low concurrency. Record the tokens/s, latency, and VRAM usage of standard decoding.
Step 2: Enable speculative decoding with a draft length of 4 or 8. Observe average acceptance length, tokens/s, and the extra VRAM used.
Step 3: If the gains aren’t obvious, check whether the draft model shares the target model’s tokenizer and comes from a matching domain. You can also try a smaller or more suitable draft model, or adjust the draft length.
Step 4: Increase concurrency gradually. Watch for VRAM bottlenecks, scheduling jitter, or throughput drops. If compute is saturated at high concurrency, reevaluate whether to keep speculative decoding enabled.
Scope and takeaways
Speculative decoding targets a common bottleneck in LLM decode: limited memory bandwidth. With a small model answering first and a large model grading, it turns token-by-token generation into a verification process that can potentially advance multiple tokens at once. It requires neither a new GPU nor a compressed main model, but its value depends on the specific model, hardware, concurrency, and framework implementation.
For developers who want to run LLMs more affordably on-premises or in the cloud, speculative decoding is an optimization worth trying. Still, it isn’t a switch that speeds things up under all conditions. It’s an engineering approach that needs measurement, tuning, and a fallback mechanism. Understand average acceptance length, set a sensible draft length, keep an eye on VRAM and concurrency limits, and measure the actual gains. Only then can it reliably deliver value in real workloads. For further reading, see the paper Fast Inference from Transformers via Speculative Decoding and the documentation of major inference frameworks.
