Speculative Decoding: Speed Up LLM Inference Without Upgrading Your GPU
Speculative decoding accelerates large language model inference by letting a small draft model propose tokens and a larger target model verify them in one forward pass. This article explains why decoding is memory-bandwidth-bound, how speculative decoding works, the key metric of average acceptance length, and the engineering considerations for deploying it without changing GPUs or degrading output quality.
Why Large Language Model Inference Often Stalls During Token-by-Token Output
A typical inference request can be divided into two distinct phases: prefill and decode.
After the user sends a prompt, the model enters the prefill phase. It processes the entire input at once, computing attention and building the KV cache. This phase handles many tokens in parallel and is primarily limited by compute throughput. GPU floating-point capability matters here.
The real bottleneck appears in the decode phase. When the model generates tokens one by one, each step produces only one token. To produce the next token, the GPU must read the large model weights and the existing KV cache from GPU memory into compute units, perform the calculation, and write new key/value data back to the cache. Then, to generate the token after that, the same “read weights — compute — write cache” cycle repeats.
This is where the problem lies. A medium or large model’s weights can be tens or even hundreds of gigabytes, and this data must be moved for every generated token. At this point, generation speed is no longer determined by the number of GPU compute units, but by GPU memory bandwidth and data movement efficiency. Compute units often sit idle while waiting for data, which is why decode becomes “loading the model to produce itself” token by token.
Speculative decoding offers a straightforward idea: if the bottleneck is the target model repeatedly moving its full weights, let a smaller and faster draft model handle some easily predictable work and reduce the number of expensive full-model inference steps.
How Speculative Decoding Works: Propose First, Verify Once
The core idea of speculative decoding can be summarized as: the small model guesses first, and the large model verifies efficiently.
The process works as follows:
- A small, fast draft model uses the current context to predict several candidate tokens, for example four tokens at a time.
- The target model, meaning the large model originally expected to run, performs one forward pass over these candidate tokens and obtains its own probability distributions for those positions.
- The target model compares each candidate token with its distribution. Candidate tokens that are consistent with the target model’s distribution are accepted directly. If a token does not match, it is rejected, later candidates are discarded, and the target model generates a correction token.
For example, suppose the user input is “The cat”. The draft model might propose “sat on my lap”. The target model only needs one forward pass to verify the sequence. If “sat” and “on” fit its distribution, they can be accepted. If “my” does not fit, it is rejected, the remaining candidates are discarded, and the target model supplies the correct token. Previously, the target model might need three or four rounds to advance through these positions; now those advances can potentially be compressed into one verification step.
From an engineering perspective, the logic can be expressed as pseudocode:
def speculative_decode(context, draft_model, target_model, gamma=4):# 1. The draft model proposes gamma candidate tokens.drafts, draft_probs = draft_model.propose(context, gamma)# 2. The target model performs one forward pass to get distributions for each position.target_probs = target_model.forward(context + drafts)# 3. Verify position by position, accepting while comparing.accepted = []for i, tok in enumerate(drafts):if rand() < min(1, target_probs[i][tok] / draft_probs[i][tok]):accepted.append(tok) # Accept this candidate.else:# Reject and resample a correction token from the target model distribution.accepted.append(target_model.sample(target_probs[i]))breakreturn context + accepted
The key point is that verifying candidates is much cheaper than letting the target model run multiple independent steps. The draft model is small, so generating candidates is relatively inexpensive, while the target model’s full weights only need to be read once to advance multiple positions.
The Key Metric: Average Acceptance Length
Speculative decoding may seem like a free lunch, but the speedup is not fixed. The core metric that determines the benefit is average acceptance length: the average number of draft tokens accepted by the target model per round.
- If the draft model proposes four tokens and three are accepted, one expensive target-model computation advances multiple positions, producing a clear benefit.
- If the draft model frequently guesses wrong, the target model must keep rejecting and correcting tokens. The extra verification and comparison overhead may slow down generation overall.
In essence, speculative decoding trades “extra computation from a small model plus one target-model verification” for “fewer target-model steps.” Whether this trade is worthwhile depends on whether the draft acceptance rate can consistently exceed the verification overhead.
In practice, factors that affect average acceptance length include:
- Alignment between the draft model and target model: they are best drawn from the same family, or distilled and sharing the same vocabulary. The closer their distributions, the higher the acceptance rate.
- Task predictability: repetitive, formatted, or code-completion tasks often have stronger local patterns and higher draft acceptance rates. Highly open-ended creative tasks usually see lower acceptance lengths.
- Draft length (gamma): predicting more tokens increases the potential speedup in ideal cases, but if later guesses are wrong, earlier accepted tokens may also be wasted. Draft length should be tuned for the workload rather than simply increased.
Engineering Considerations and Ecosystem Support
For a single request, speculative decoding can provide close to several-fold speedups in generation. Even in server-side scenarios with increasing concurrent requests, it can still improve throughput significantly because it merges multiple expensive full forward passes into one verification step. Notably, this does not require upgrading GPUs or further compressing the model; the change happens only in how tokens are generated.
Mainstream inference frameworks are gradually adopting speculative decoding and developing multiple implementation paths. Some use a separate draft model, while others use variants such as multi-head self-speculation or retrieval/prefix reuse that do not require an extra small model, reducing deployment complexity.
For teams that want to deploy speculative decoding in their own environments, the following engineering considerations are important:
- Memory and compute budget: although the draft model is small, it still consumes GPU memory and inference resources. Evaluate whether the benefit outweighs the cost.
- Monitoring and observability: track metrics such as average acceptance length, per-token latency, and throughput through monitoring and alerting systems to determine whether tuning is effective.
- Elastic scaling and scheduling: combine with container platforms to scale inference instances elastically and maintain stable speculative decoding benefits under high concurrency.
- Data and cache management: the correctness of the KV cache directly affects the accept/reject logic. Ensure consistent and efficient cache reads and writes.
Summary
Speculative decoding provides a cost-effective path to faster local LLM inference. It does not depend on hardware upgrades and does not sacrifice output quality, because the final distribution is governed by the target model. Instead, it bypasses the memory-bandwidth bottleneck of the decode phase through “draft proposals plus centralized verification.”
The key to using this technique well is not to make the draft as long as possible, but to balance the draft acceptance rate, or average acceptance length, against verification cost. With appropriate draft model selection, draft length tuning, and a complete monitoring system, developers can significantly improve local LLM inference without upgrading their GPUs.
