Speculative Decoding: Accelerating Large Model Inference Without New Hardware
Speculative decoding (also called speculative sampling) is a technique that speeds up large language model inference by changing how tokens are generated rather than reducing model size or upgrading hardware. This article explains why autoregressive decoding is inherently slow, how a small draft model proposes candidate tokens for a larger target model to verify in a single pass, and why this can cut down on serial target-model calls. It covers average acceptance length as the key metric, how to choose a draft model, why output quality is preserved, which workloads benefit most, when gains are limited, key engineering optimizations, evaluation metrics, common misconceptions, and a step-by-step adoption path. Readers will learn how to evaluate and apply speculative decoding as part of a broader inference optimization strategy.
Speculative Decoding: Accelerating Large Model Inference Without New Hardware
1. The Problem: Why LLM Inference Often Stalls on “Generating One Token at a Time”
When running large models locally, many developers hit a familiar symptom: on the same device, with the same model and the same input, output quality stays roughly the same, but generation is painfully slow. The model isn’t failing to run — its responses just trickle out one token at a time.
This isn’t simply because the model is “too big.” It follows directly from how large model inference works.
LLM inference is usually divided into two phases:
Prefill phase
After the user submits a prompt, the model first processes the entire input to build the context representation and produce the key state caches needed for subsequent decoding. This phase typically handles many tokens at once, involves a large amount of computation, and therefore leans heavily on compute capacity.Decode phase
Once the model starts generating a response, it usually produces just one token at a time. After generating the current token, it must read the existing weights and context cache, then compute the next token. This process repeats until generation finishes.
What actually hurts the experience is usually not the first phase, but the decode phase.
In the decode phase, generating each token requires reading a large number of model weights and reading and writing the existing key-value cache. As the context grows, the cache keeps expanding. At this point, the factor limiting generation speed may no longer be whether there are enough compute units, but whether data can be moved fast enough.
Put differently, the model must continually move large volumes of data from GPU memory into the compute units, compute, and write it back. This process is inherently serial: the next token depends on the result of the previous one, so it’s hard to parallelize all the steps the way you would with an ordinary batched workload.
This creates a core tension in local LLM inference:
The model wants to generate multiple tokens faster, but traditional decoding can only confirm one token per step.
It’s against this backdrop that speculative decoding becomes a valuable optimization idea.
2. The Core Idea: Let a Draft Model Guess, Then Let the Target Model Verify
Speculative decoding, also called speculative sampling, doesn’t aim to reduce the number of parameters or directly change model quality. Its goal is to change the way tokens are generated.
The basic flow can be summarized as:
- A smaller, faster model first generates several candidate tokens;
- The original large model checks those candidates in a single pass;
- If the candidates match the large model’s probability distribution, they are accepted;
- Where a candidate doesn’t match, the remaining candidates are discarded, and the large model regenerates the correct token.
You can think of it like an exam:
- Traditional approach: the teacher glances at every single word the student writes before allowing the next one;
- Speculative decoding: the student writes several candidate answers in a row, and the teacher grades them all at the end, correcting only the wrong parts.
If most of the student’s answers are correct, the teacher can confirm several words in one go; if there are many errors, the teacher re-corrects them. Whether the overall approach pays off depends on the balance between draft quality and verification cost.
In common implementations, the process can often be simplified to pseudocode like this:
# Pseudocode: one speculative decoding iterationdraft_tokens = draft_model.propose(context, k=5)scores = target_model.evaluate(context, draft_tokens)accepted = accept_prefix(scores)context.extend(accepted)if len(accepted) < len(draft_tokens):corrected_token = target_model.sample(corrected_distribution)context.append(corrected_token)yield accepted
The key points here are:
- The draft model is responsible for quickly proposing candidate answers;
- The target model verifies, in a single pass, whether those candidates are reliable;
- The final output is still determined by the target model’s probability distribution.
So under an ideal implementation, speculative decoding doesn’t simply change output quality — it reduces the number of serial calls to the target model through more efficient scheduling.
3. Why Speculative Decoding Speeds Up Local Inference
To understand the value of speculative decoding, you first need to understand the cost structure of the decode phase.
Suppose the target model has billions or even hundreds of billions of parameters. Generating each token may, in principle, require reading a large number of weights. Even if the system reduces overhead through caching, kernel optimization, and parallel mechanisms, per-token generation still incurs noticeable repeated-read costs.
Speculative decoding tries to change this.
Under the traditional approach, generating 5 consecutive tokens might require the target model to run 5 forward passes. Dependencies exist between each pass, so it’s hard to fully parallelize them.
With speculative decoding, the draft model first generates 5 candidate tokens in one shot. The target model can then verify these candidates together. If the first several tokens are accepted, the whole round can advance multiple positions at once.
This means:
Work that originally required multiple serial calls to the large model may be compressed into a single verification call.
If the target model can verify 4 or more candidate tokens per pass and most of them are accepted, generation efficiency can improve noticeably.
However, this speedup isn’t unconditional. It depends on two core factors:
- Whether the draft model is fast enough;
- Whether the candidate tokens the draft model produces are easy for the target model to accept.
If the draft model is very fast but its candidates are often wrong, the target model has to reject and correct frequently, and the extra computation may cancel out the gains. Conversely, if the draft model’s distribution is close to the target model’s and the acceptance rate is high, speculative decoding can bring substantial improvement.
4. Average Acceptance Length: The Key Metric for Gauging Speculative Decoding
To evaluate whether speculative decoding is effective, you can’t just look at whether the draft model generated more tokens. You need a more direct metric:
Average acceptance length.
Average acceptance length usually indicates how many draft tokens the target model accepts per round on average.
For example:
- The draft model generates 5 tokens in one round;
- The target model accepts 3 of them;
- Then the effective advance for that round is 3.
Observing multiple rounds over time gives you the average acceptance length. This metric is far more meaningful than simply looking at “how many tokens the draft generated.”
That’s because the benefit of speculative decoding doesn’t come from the number of tokens the draft model generates — it comes from the number that are actually accepted after the target model verifies them.
You can think of it as a kind of “hit rate”:
- The higher the draft model’s hit rate, the more worthwhile speculative decoding is;
- The lower the draft model’s hit rate, the more noticeable the extra overhead;
- When the acceptance rate is too low, you may even see a negative optimization.
This is also why “writing a longer draft doesn’t necessarily mean faster.”
If the draft model generates many tokens at once but the target model accepts only the first few, all the remaining candidates are discarded. The computation the draft model spent generating those candidates didn’t translate into actual output.
For this reason, engineering practice usually doesn’t increase draft length without limit, but adjusts it dynamically based on the acceptance rate.
5. Choosing a Draft Model: Not Necessarily Smaller, Not Necessarily Bigger
Choosing the draft model is critical in speculative decoding.
An ideal draft model typically has the following characteristics:
Noticeably faster inference than the target model
The whole point of the draft model is to propose candidates quickly. If it’s slow too, it defeats the purpose.A semantic distribution as close as possible to the target model
The draft model doesn’t need to be identical to the target model, but it should produce reasonable candidates under the same task, the same domain, and the same language style.A compatible vocabulary, or one that can be aligned through mapping
In engineering, the output spaces of the draft model and target model need to be aligned. If the vocabularies differ too much, conversion costs rise and the acceptance rate may drop.Good stability in the target scenario
For example, if the main task is code generation, the draft model should ideally be familiar with code structure; if the main task is Chinese conversation, the draft model should perform steadily on Chinese corpora and expression patterns.
Note that a bigger draft model isn’t necessarily better.
A larger draft model may produce higher-quality candidates, but its compute cost is also higher. If the draft model is close in size to the target model, the gains from speculative decoding may be canceled out.
Likewise, a smaller draft model isn’t necessarily better either.
An overly small draft model may be very fast, but if candidate quality is too poor, the target model will reject frequently, driving the average acceptance length too low.
So choosing a draft model sensibly is essentially about finding a balance among several variables:
- Draft model speed;
- Draft model quality;
- Target model verification cost;
- Average acceptance length;
- The current hardware’s GPU memory bandwidth;
- The number of concurrent requests;
- Task randomness;
- Context length.
In real deployments, teams usually benchmark a few candidate draft models rather than specifying one purely from experience.
6. Why Speculative Decoding Preserves Output Quality
Many people worry: if the draft model generates content first and the target model checks it afterward, won’t output quality suffer?
In the standard speculative decoding design, the final output doesn’t simply take the draft model’s results — the target model decides whether to accept them.
A common flow is:
- The draft model generates a sequence of candidate tokens;
- The target model runs a forward pass over the candidate sequence;
- The system compares each candidate token against the target model’s probability distribution, one by one;
- Starting from the first position that doesn’t match, the remaining candidate tokens are discarded;
- The target model resamples a corrected token at that position;
- The final context keeps only the accepted portion and the corrected portion.
So the key to speculative decoding isn’t “replacing the target model with the draft model,” but rather:
Using the draft model to propose a likely-correct path in advance, then letting the target model confirm it in one pass.
If implemented correctly, the target model remains the final decision-maker. The draft model is just an auxiliary mechanism that improves the efficiency of each step.
That said, implementations can differ in the details. For example:
- Whether strict acceptance is used;
- Whether resampling happens at the rejection point;
- Whether temperature parameters are kept consistent;
- Whether different sampling strategies are handled compatibly;
- Whether any approximate optimizations exist.
So in engineering practice, you shouldn’t just look at “whether speculative decoding is used” — you also need to check whether a given implementation actually matches the intended goal.
For scenarios that require strictly reproducing the target model’s output, you should use the standard algorithm and test it thoroughly. For applications that prioritize throughput and latency, you can choose different strategies depending on what the business can accept.
7. Which Scenarios Benefit from Speculative Decoding
Speculative decoding doesn’t deliver equal gains for every task. It’s best suited to the following scenarios:
1. A large target model with a clearly smaller draft model
When the target model is far larger than the draft model, verification cost is relatively fixed while the draft model’s generation cost is low. In this case, speculative decoding is more likely to pay off.
2. Content with some degree of predictability
If the text is structurally stable, semantically coherent, and rich in repetitive patterns, the draft model can more easily produce reasonable candidates.
For example:
- Code completion;
- Structured text generation;
- Fixed-template writing;
- Log analysis;
- Q&A dialogue;
- Text summarization;
- Common sentence patterns in translation tasks.
These tasks usually have strong local coherence, so the draft model is more likely to “guess correctly.”
3. Latency-sensitive single requests
When a user is waiting for real-time output, reducing per-token latency matters a lot. Speculative decoding lets each round advance more tokens, shortening the overall wait.
4. Limited resources for local or edge inference
On local or edge devices, changing hardware is expensive. If the target model is already fixed and you can’t easily swap the GPU or expand GPU memory, optimizing the token generation path with speculative decoding is a relatively low-cost direction to try.
8. When the Gains May Be Limited
Speculative decoding is valuable, but it isn’t a universal fix. Be cautious in the following cases:
1. Too large a gap between the draft and target models
If the draft model’s candidates diverge too much from the target model’s distribution, the acceptance rate will be low. The target model then has to correct frequently, and the extra overhead may outweigh the benefits.
2. Highly random tasks
If generation depends heavily on on-the-fly reasoning and results are hard to predict, the draft model may often guess wrong.
For example:
- Highly random creative writing;
- Open-domain free-form conversation;
- Tasks requiring complex logical reasoning;
- Tasks where results depend heavily on real-time user input.
In these scenarios, the acceptance rate may be unstable.
3. Already-long context
Long context increases the target model’s verification compute. If verification cost rises significantly while the draft model’s gains don’t scale accordingly, the speedup can be eroded.
4. Already-high concurrency pressure
Under high concurrency, the bottleneck may shift from single-request latency to overall throughput, batching efficiency, and resource scheduling. Whether speculative decoding helps here needs to be assessed holistically across throughput, latency, and resource usage.
5. When the hardware bottleneck isn’t in the decode phase
If the bottleneck comes from GPU memory capacity, network transfer, data pre-processing, or post-processing, then optimizing only the token generation method may yield limited gains.
9. Key Optimization Points in Engineering
Making speculative decoding work in practice isn’t as simple as plugging in a draft model. The engineering implementation needs to account for many details.
1. Dynamically adjusting draft length
A fixed draft length isn’t always optimal.
If the acceptance rate is high, you can increase the draft length appropriately; if the acceptance rate drops, you should reduce the number of drafts to avoid wasted computation.
Common strategies include:
- Adjusting dynamically based on historical acceptance rates;
- Setting different draft lengths for different task types;
- Reducing draft length under high concurrency to lessen resource contention;
- Choosing a more aggressive draft strategy in low-latency scenarios.
2. Keeping sampling parameters consistent
Sampling parameters between the draft model and the target model should be kept as consistent as possible, for example:
- Temperature;
- Maximum generation length;
- Stopping conditions;
- Special token handling;
- Random seed strategy.
If parameters are inconsistent, candidate tokens may not match the target model’s distribution, lowering the acceptance rate.
3. Reusing cache and context
Speculative decoding involves interaction between the draft model and the target model. Engineering should reuse existing caches as much as possible to reduce redundant computation.
For example:
- Avoid rebuilding the full context on every verification;
- Feed the cache of already-accepted tokens directly into the next round;
- Apply the necessary state isolation for draft model generation results;
- Avoid inconsistent cache pollution between the draft and target models.
4. Monitoring acceptance rate and resource usage
After going live, don’t just look at “whether it got faster.” Keep observing:
- Average acceptance length;
- Draft model latency;
- Target model verification latency;
- Average per-token latency;
- Per-round throughput;
- Changes in GPU memory usage;
- Stability under concurrent requests;
- Whether output quality shows anomalies.
If the acceptance rate stays low over time, re-examine the choice of draft model, the fit with the task type, and the sampling parameter configuration.
5. Working together with batching strategies
In inference services, single-request latency and overall throughput are often not the same goal.
Speculative decoding is valuable for interactive single-request scenarios, but in high-concurrency services you also need to consider:
- Request batching;
- Batching windows;
- Scheduling fairness;
- Resource isolation between different requests;
- Prioritization of long versus short requests;
- Parallel scheduling of the draft and target models.
So speculative decoding is better suited as part of an inference optimization system rather than an isolated speedup technique.
10. Which Metrics to Focus On When Evaluating Performance
If you want to assess whether speculative decoding is worth adopting in a specific project, it’s recommended to track at least the following metrics.
1. Time to first token
How long after sending a request the user sees the first output.
This metric affects the interactive experience. Note that different implementations may run the draft model in advance or let it affect first-token output, which can lead to different results, so it needs to be measured separately.
2. Average per-token latency
During generation, how long it takes to produce one token on average.
This is one of the core metrics for measuring generation speed.
3. Overall generation time
For a fixed input and a fixed output length, compare total time before and after optimization.
This kind of test is closer to the real user experience.
4. Average acceptance length
Observe the average number of candidate tokens the target model accepts from the draft model.
This is an important basis for judging whether the speculative decoding strategy is reasonable.
5. Throughput change
Under concurrent requests, whether the number of requests or tokens the system completes per second increases.
For server-side deployments, throughput often matters more than single-request latency.
6. Change in resource usage
Including:
- GPU memory usage;
- Compute utilization;
- Cache usage;
- Scheduling overhead;
- Extra memory pressure introduced by the draft model.
If speed improves but resource consumption rises significantly, you also need to weigh the overall cost-effectiveness.
7. Output quality stability
Although the goal of speculative decoding is to preserve the target model’s output logic, in practice you still need to compare results before and after optimization for anomalies like abnormal repetition, semantic breaks, or format corruption.
11. Common Misconceptions
Misconception 1: The stronger the draft model, the better
The draft model isn’t better just because it’s bigger. Its goal is to raise the acceptance rate while keeping compute cost low. If the draft model itself is heavy, the gains from speculative decoding are weakened.
Misconception 2: More draft tokens is always better
Too many drafts can lead to large numbers of rejected candidates. What really matters is the average acceptance length, not the total number of candidate tokens.
Misconception 3: Speculative decoding noticeably changes output quality
In standard implementations, the final output is still decided by the target model. The draft model only proposes candidates; the target model judges whether to accept them.
Misconception 4: All models get the same speedup
Different model sizes, architectures, context lengths, sampling strategies, and task types all affect the gains. The effect of speculative decoding needs to be tested for the specific scenario.
Misconception 5: If it runs locally, it must speed up significantly
Local inference bottlenecks may come from hardware, GPU memory, cache, scheduling, or the application layer. Speculative decoding can only optimize part of the pipeline — it can’t replace a full performance analysis.
Misconception 6: Speculative decoding is always more worthwhile than direct generation
If the draft model quality is insufficient, the acceptance rate is too low, or target model verification cost is too high, speculative decoding can actually produce negative gains.
12. How to Gradually Adopt Speculative Decoding
If you want to introduce speculative decoding into a real project, you can follow this path.
Step 1: Establish a baseline
First, run without speculative decoding and record the model’s baseline performance in the target scenario:
- Fixed input and output;
- Fixed sampling parameters;
- Record latency;
- Record throughput;
- Record resource usage;
- Record output quality samples.
Without a baseline, you can’t tell whether an optimization is truly effective.
Step 2: Select candidate draft models
Choose several draft models based on the task type and compare their:
- Inference speed;
- Output consistency with the target model;
- Average acceptance length;
- GPU memory usage;
- Compatibility with the existing inference pipeline.
Step 3: Integrate on a small scale
First integrate speculative decoding in a test environment and observe whether output is normal and whether performance improves.
Focus on verifying:
- Whether the target sampling strategy is supported;
- Whether stop tokens are handled correctly;
- Whether multi-turn conversation context is handled correctly;
- Whether there are format errors;
- Whether abnormal repetition appears.
Step 4: Tune draft length and sampling parameters
Adjust the draft length based on acceptance rate results.
Typically, observe:
- Whether acceptance can be pushed higher when the acceptance rate is high;
- Whether the draft length should be shortened when the acceptance rate is low;
- Whether different input types need different strategies;
- Whether draft size should be reduced under high concurrency.
Step 5: Roll out gradually
Don’t release to everyone at once. Ramp up gradually by proportion while monitoring:
- Latency;
- Error rate;
- User feedback;
- Resource consumption;
- Output quality;
- Concurrency stability.
Step 6: Keep tuning
Speculative decoding isn’t a one-time configuration but an ongoing tuning process. As model versions, prompt patterns, user tasks, and hardware load change, the optimal strategy may change too.
13. Its Relationship With Other Inference Optimization Methods
Speculative decoding isn’t the only way to accelerate large models. In real systems, it’s usually used together with other optimization methods.
1. Model quantization
Reducing parameter precision lowers GPU memory usage and data movement costs. Quantization can be combined with speculative decoding, but you need to watch the impact of precision on output quality.
2. Cache reuse
Properly managing the context cache can reduce redundant computation. Speculative decoding also relies on caching, so the quality of cache design directly affects the overall result.
3. Batching and scheduling
In concurrent scenarios, batching can improve overall throughput. When combining speculative decoding with batching, make sure the draft model’s computation doesn’t slow down the overall scheduling.
4. Request routing
Different tasks can take different strategies. For example, structured tasks can use a higher draft length, while open-ended tasks can use a lower draft length or a more conservative strategy.
5. Monitoring and observability
The gains from speculative decoding aren’t self-evident and must be tracked through metrics. Common monitoring targets include:
- Acceptance rate;
- Latency percentiles;
- Throughput changes;
- Error rate;
- Resource utilization;
- Cache hit rate;
- Request queue time.
When deploying in the cloud, you can also combine general capabilities like container platforms, logging services, and monitoring/alerting to continuously observe and schedule the inference service.
14. The Essence of Speculative Decoding From a Technical Perspective
Speculative decoding doesn’t simply “compress” a large model into a small one, nor does it just increase GPU compute. It changes the execution method of the generation process itself.
Traditional autoregressive decoding emphasizes that every step must depend on the result of the previous step, which makes it inherently serial.
Speculative decoding, by introducing a faster but potentially less precise candidate generator, moves part of the exploration work ahead and parallelizes it, then lets the target model verify it in one pass.
Its essence can be summarized as:
Trading low-cost guessing for high-value verification, and replacing multiple serial generation steps with parallel verification.
If the guesses are accurate enough, this can significantly reduce the number of target model calls; if the guesses aren’t accurate enough, it produces extra overhead.
So the engineering value of speculative decoding isn’t some fixed speedup factor, but the fact that it opens up a new optimization space:
- It doesn’t change the target model itself;
- It doesn’t necessarily depend on hardware upgrades;
- It can be tuned through draft model quality;
- It can be tuned through draft length;
- It can be combined with sampling strategy tuning;
- It can be applied flexibly across different deployment environments.
15. Summary
Slow local LLM inference often isn’t because the model can’t run, but because the decode phase must continually read weights and the context cache in a serial fashion. By introducing a draft model, speculative decoding lets the system propose multiple candidate tokens first, then have the target model verify them in a single pass, creating a chance to reduce repeated target model calls.
The core advantages of this approach are:
- No need to change hardware;
- No need to compress the target model;
- No change to the overall model choice;
- Improved efficiency through the way tokens are generated;
- In suitable scenarios, noticeable improvement in both generation latency and throughput.
But speculative decoding isn’t automatically effective just because it’s turned on. You need to consider the draft model quality, average acceptance length, draft length, sampling parameters, context length, concurrency pressure, and hardware resource usage together.
For developers planning to deploy large models locally or in the cloud, speculative decoding is worth adding to the performance optimization toolbox. It offers a relatively independent optimization path: even if you can’t swap GPUs, expand GPU memory, or retrain the model for now, you can still try to improve the inference experience through a smarter token generation method.
Truly effective optimization is rarely a single-point trick — it’s usually a systematic evaluation centered on the target scenario. That’s exactly where the value of speculative decoding lies: it turns “generating one token at a time” into “guess first, then verify,” transforming an originally highly serial decode process into a more efficient process of verification and advancement.
