Speculative decoding, explained simply
Speculative decoding explained simply: how a small draft model speeds up LLM output without changing it, and when the speedup is real or fake.
Updated
Speculative decoding makes a large language model generate text faster without changing what it writes. A small, fast draft model guesses the next few tokens, and the large model checks all of those guesses in one pass. When the guesses are right, several tokens arrive for the cost of one check.
Why normal generation is slow
A large model writes one token at a time. Each new token needs a full pass through the model’s weights, and much of that time goes to moving those weights through memory rather than to arithmetic. Ten tokens cost roughly ten passes, one after another, so long answers feel slow.
Checking is cheaper than writing. If the model is handed five candidate tokens, it can score all five positions in one pass, because the whole candidate sequence is already known. Speculative decoding uses that gap. The expensive pass verifies several tokens instead of producing only one.
How the draft and check work
Here is a worked example with made-up tokens, to show the mechanics. It is an illustration, not a measurement.
- The draft model proposes four tokens to continue the text “Invoice total is”:
$,1,,and240. - The target model runs once over the prompt plus those four tokens. At each position it computes the token it would have chosen itself. Suppose those choices are
$,1,,and250. - The first three draft tokens match, so they are accepted. At the fourth position the draft said
240and the target says250. The system keeps250, discards the rest of the draft, and starts the next round from there.
That one target pass produced four tokens instead of one.
With the standard method, the accepted text has the same distribution the large model would produce alone. When sampling is on, the check uses a probability test rather than exact matching, and rejected positions are resampled so the output still follows the large model. That is the point buyers should understand: the method is exact by design. It does not trade quality for speed the way aggressive compression can.
When the speedup is real
The gain depends on how often the draft guesses right. When the draft agrees with the large model most of the time, several tokens are accepted per pass and generation speeds up. When agreement is rare, the draft work is wasted, and the result can be slower than normal decoding.
Take a job that pulls a fixed set of fields out of invoices. Most output tokens are field names, punctuation and repeated layout, which the draft can predict, so agreement tends to be high. A free-form summary of the same invoices gives the draft far fewer correct guesses, and the speedup shrinks.
Several things push agreement up:
- Predictable text, such as code, fixed-format JSON, forms and templated replies.
- A draft model that behaves like the target. A generic small model often guesses differently from the large one.
- Short drafts when the output is hard to predict. Long drafts only pay off when most guesses land.
It helps least on open-ended creative writing, where many continuations are equally likely and the draft is often wrong.
Common mistakes
- Judging by one good prompt. Agreement varies a lot between inputs. Run a spread of real documents and report the range, not the best case.
- Testing one user, then shipping to a busy server. A method that speeds up a single request can add overhead when many requests share the hardware. Test at the concurrency you will actually run.
- Forgetting the draft’s memory. The draft model occupies memory and competes with the KV cache for headroom, so a setup that fits on a test run can fail at real context lengths.
- Picking the biggest draft. A stronger draft agrees more often but takes longer per guess. The net gain can shrink or disappear.
- Skipping output checks. The standard method is exact by design, but serving settings can still shift results. Compare outputs on your own test set after you turn it on.
Speculative decoding vs. a smaller model
These are different tradeoffs. A smaller model is cheaper and faster on every token, but its quality is limited to what that model can do alone. Speculative decoding keeps the large model’s output and makes the same model faster. It does not shrink the weights, so it does not reduce the memory the large model needs. You still host both models, and the draft takes memory too.
For a fixed task with a predictable output shape, a smaller model trained on that task can be a better fit than either approach. Test both on your own data before you choose. Naming a technique is not a reason to use it.
One setup worth testing is stacking the two, with a smaller model serving as the draft. That adds a second model to run. Check whether the combined setup beats each option alone, because the extra memory and scheduling can erase the gain.
What to measure before you adopt it
Speed numbers only mean something under a stated load, so compare like with like. Work through this list on the same prompts and settings for each run:
- Tokens per second for one request, and across many requests at once. See tokens per second, explained and throughput vs latency.
- Output quality on your own test set. Keep the prompts, seeds and settings identical between runs.
- Memory headroom with the draft model loaded, since it competes with the KV cache.
- Cost per document, not just speed. Convert your measured throughput into a per-job figure with the LLM cost calculator.
Report the spread across inputs, not one number. Our own tier results are measured on one task at a stated load, and they do not measure this technique. For the methodology and full numbers, see full results.
If one high-volume task is running on a frontier API and you want to know whether a trained model would be faster and cheaper, start with the free audit or book a call. We map your AI calls from your code and invoices, then test a trained model against the current one on your data before anything is deployed. To see how we pick a model for a job, start at Own Weights.
Questions
Does speculative decoding change the output of an LLM?
With the standard method, no. The accepted text follows the same distribution the large model would produce alone, so quality is not traded for speed. Check your own outputs after you turn it on, because serving settings can still shift results.
Is speculative decoding the same as quantization?
No. Quantization stores the weights at lower precision, which changes the model's numbers and can cost accuracy. Speculative decoding leaves the weights alone and changes how tokens are generated, so it does not shrink the model.
Do I need a special model to use speculative decoding?
You need a draft model that uses the same vocabulary and behaves like the large model. A draft that agrees with the target more often gives a bigger speedup. Confirm that the serving stack you run supports it before you plan around it.