Speculative decoding
On this page
A language model normally produces one token per pass through its weights. On a GB10 machine a pass is limited by how fast the weights can be read from memory, so the direct way to go faster is to get more than one token out of each pass. That is what speculation does, and it is where most of veloGB10's decode speed comes from.
How it works
- A small, cheap predictor drafts the next few tokens.
- The full model checks all of them in a single pass.
- The engine keeps the drafted tokens up to the first one the model disagrees with, and continues from there.
When the draft is right, one pass yields several tokens. When it is wrong, nothing is lost but the cost of the draft: the model's own token is used.
What it does to the output
- At temperature 0 (greedy), the output is bitwise identical to decoding without speculation. The engine's matrix kernels run the same instruction sequence for a normal step and for a check of several drafted tokens, so the checked result is the same number, not a close one. This is tested on every release.
- With sampling, the output follows the same distribution as sampling without speculation. Individual runs differ, as sampled runs always do.
Speculation is a speed feature. It is not an approximation of the model.
Where the draft comes from
| Source | What it is |
|---|---|
| Built-in MTP head | A multi-token prediction head that ships inside the model pack. Nothing to set up. |
| Replacement MTP heads | Alternative heads for the same model, such as the DotH and HermiHg heads for Qwen3.8-Flash-Next, published as separate packs. |
| A drafter model | A separate small model (DFlash, DFlash 2, DSpark) passed with --spec-source and --draft-dir. Used where a model has no head, or where a drafter is accepted more often. |
The benchmarks measure each model with each source available for it, so you can see which is fastest before choosing.
It adjusts itself
With --mtp=auto the engine measures, while serving, how many drafted tokens are being accepted and what a draft round costs. It picks the draft depth that pays best for the current text and turns speculation off for stretches where it does not pay, then tries again later in the same request. Code is easier to draft than prose, so code decodes faster; the benchmark pages report the two separately for that reason.
How to read acceptance figures
Two numbers describe how well speculation is working:
- Accepted: the share of drafted tokens the model kept.
- Depth: how many tokens were accepted per round on average.
GET /metrics reports both for a running server, so you can check on your own traffic that speculation is engaged and paying.
Limits
- Several requests at once share the machine, and speculation and batching compete for the same passes. What happens above one request differs by model family; the setup guides say what to expect.
- A drafter is a second model in memory. Its size is listed on its Hugging Face card.