# Speculative Decoding Explained: How Draft Models Speed Up LLM Output

How a small model's guesses let a large model write several tokens per pass, and why the answer stays the same

Nov 9, 2026 · Inference · 12 min read · https://arclyx.ai/blog/speculative-decoding

## Summary

Speculative decoding is a way to make a large language model write its answer faster without changing the answer. A small, fast draft model guesses the next few tokens, and the large target model checks all of the guesses in one forward pass, keeping the ones it agrees with and replacing the first one it doesn't [Sources 1, 2].

A model normally spends one full pass per output token, so getting several tokens from one pass cuts the wait. The original papers reported decoding two to three times faster with the same outputs [Sources 1, 4]. This post shows how the draft-and-verify loop works, why the output stays the same, how much faster it gets, when it doesn't pay off, and a toy version you can run.

## Key Takeaways

- **It speeds up writing, not reading.** Speculative decoding works on decode, the one-token-at-a-time phase, by getting several tokens from each pass of the large model [Sources 2, 6].
- **The large model stays in charge.** Every guess is checked. The first one the target rejects is replaced and the guesses after it are thrown away, so at worst a pass still yields one token [Source 2].
- **The output doesn't change.** With the standard verification rule, the output follows the target model's own distribution at any temperature, up to hardware numerics [Sources 1, 4, 5].
- **Speedups depend on how often the guesses are right.** In a 2026 Google and UCSD test, a diffusion-style drafter averaged 3.13x more tokens per second, with math well ahead of chat; in an end-to-end vLLM test on another model it was 2.29x [Source 3].
- **It pays most when the server has spare compute.** vLLM aims it at medium-to-low traffic, memory-bound workloads [Source 5].
- **Measure it on your own prompts.** Acceptance rate, tokens per second and latency, with and without, tell you whether it's worth turning on.

## What is speculative decoding?

Speculative decoding is an inference technique where a cheap drafter proposes several next tokens and the expensive model verifies them all at once. When the guesses are right, the large model produces several tokens for the price of one pass; when they're wrong, it corrects them, so the result is what the large model would have written alone [Sources 1, 2].

Google researchers Yaniv Leviathan, Matan Kalman and Yossi Matias introduced it in "Fast Inference from Transformers via Speculative Decoding" (arXiv, November 2022; an ICML 2023 oral) [Sources 1, 6]. A DeepMind team published a closely related method, "speculative sampling", in February 2023 [Source 4]. Google says the technique now helps AI Overviews in Google Search produce results faster [Source 6].

## Why is LLM output slow in the first place?

Because a model writes one token at a time, and every token needs a full pass through the model. NVIDIA's introduction puts it this way: each token "requires a full forward pass, reloading weights, and synchronizing memory at every step" [Source 2]. The wait grows with the length of the answer.

The pass is limited by memory, not arithmetic. Each step has to read all of the model's weights, and accelerators can do far more operations than they can read bytes, so compute sits idle while the weights stream in [Source 6]. Speculative decoding spends that idle compute checking several guessed tokens in the same pass. Our guide to [LLM inference](https://arclyx.ai/blog/llm-inference-explained) explains prefill and decode in full, and the post on [LLM inference latency](https://arclyx.ai/blog/solving-llm-serving-latency-interference) covers why the two phases get in each other's way on a busy server.

## How does speculative decoding work?

Each round has three steps: the drafter guesses, the target checks every guess in one pass, and the round keeps the guesses up to the first mistake plus one token from the target. Then the next round starts from there.

1. **Draft.** The draft model proposes a short run of tokens, typically 3 to 12 [Source 2].
2. **Verify.** The target model scores every drafted position in one forward pass, plus one position beyond the last guess [Source 2].
3. **Accept or correct.** Going left to right, each guess is kept if the target agrees with it. At the first rejection, the target's own token goes in its place and the rest of the draft is discarded. If every guess is kept, the extra position gives one more token for free [Source 2].

With greedy decoding (temperature 0), "agrees" simply means the guess is the target's top token. With sampling, a guess is kept with probability min(1, p/q), where p is the target's probability for that token and q is the draft's; on a rejection, the replacement is sampled from what the target wanted and the draft didn't already cover [Sources 1, 4]. That rule is what keeps the output distribution exactly the target's.

### A worked round

Here is the toy below run with greedy decoding. The target model would write "the cat sat on the cat sat on". The draft model is wrong in one place: after "the" it prefers "mat".

| Round | Draft guesses | Target keeps | Target's correction | Tokens written |
| --- | --- | --- | --- | --- |
| 1 | the mat . . | the | cat (instead of mat) | 2 |
| 2 | sat on the mat | sat on the | cat (instead of mat) | 4 |
| 3 | sat on the mat | sat on the | cat (instead of mat) | 4, of which 2 are needed |

Eight tokens took three passes of the target model instead of eight, and the text is identical. Seven of the twelve guesses were accepted.

## What does speculative decoding look like in code?

The program below simulates it with two lookup tables standing in for the models, so it runs anywhere: Python 3.10 or later, standard library only. The loop that scores the target's positions would be one parallel forward pass on a real server, so it counts as one pass. It runs greedy decoding first, then compares 50,000 sampled outputs with and without speculation.

```python
import random
from collections import Counter

# Two toy "models": each maps the last token to next-token probabilities.
TARGET = {  # the big model we want output from
    None: {"the": 0.9, "a": 0.1},
    "the": {"cat": 0.6, "mat": 0.4},
    "a": {"cat": 0.5, "mat": 0.5},
    "cat": {"sat": 0.8, ".": 0.2},
    "sat": {"on": 0.9, ".": 0.1},
    "on": {"the": 0.7, "a": 0.3},
    "mat": {".": 1.0},
    ".": {".": 1.0},
}
DRAFT = {  # the small model: often right, sometimes not
    None: {"the": 0.8, "a": 0.2},
    "the": {"mat": 0.6, "cat": 0.4},
    "a": {"cat": 0.5, "mat": 0.5},
    "cat": {"sat": 0.9, ".": 0.1},
    "sat": {"on": 0.7, ".": 0.3},
    "on": {"the": 0.9, "a": 0.1},
    "mat": {".": 1.0},
    ".": {".": 1.0},
}


def next_probs(model, tokens, greedy):
    probs = model[tokens[-1] if tokens else None]
    if greedy:  # temperature 0: all probability on the top token
        return {max(probs, key=probs.get): 1.0}
    return probs


def sample(probs, rng):
    r, total = rng.random(), 0.0
    for token, p in probs.items():
        total += p
        if r < total:
            return token
    return token


def generate(n, rng, k=4, greedy=False, speculative=True, model=TARGET):
    """Return (tokens, target passes, drafted tokens, accepted drafts)."""
    out, passes, drafted, accepted = [], 0, 0, 0
    while len(out) < n:
        if not speculative:  # plain decoding: one target pass per token
            out.append(sample(next_probs(model, out, greedy), rng))
            passes += 1
            continue
        # 1. The draft model guesses k tokens, one at a time (cheap).
        guesses, qs = [], []
        for _ in range(k):
            q = next_probs(DRAFT, out + guesses, greedy)
            guesses.append(sample(q, rng))
            qs.append(q)
        drafted += k
        # 2. The target scores all k positions plus one more. On a real
        #    server this is one forward pass, so it counts once.
        ps = [next_probs(TARGET, out + guesses[:i], greedy) for i in range(k + 1)]
        passes += 1
        # 3. Keep each guess with probability min(1, p/q); on the first
        #    rejection, resample from what the target wanted and stop.
        for i, token in enumerate(guesses):
            p, q = ps[i].get(token, 0.0), qs[i][token]
            if rng.random() < min(1.0, p / q):
                out.append(token)
                accepted += 1
                continue
            residual = {t: max(0.0, ps[i].get(t, 0.0) - qs[i].get(t, 0.0)) for t in ps[i]}
            norm = sum(residual.values())
            out.append(sample({t: v / norm for t, v in residual.items()}, rng))
            break
        else:  # every guess accepted: the target's extra position is free
            out.append(sample(ps[k], rng))
    return out[:n], passes, drafted, accepted


# Greedy (temperature 0): the output matches the target's own, in fewer passes.
plain, plain_passes, _, _ = generate(8, random.Random(0), greedy=True, speculative=False)
spec, spec_passes, drafted, accepted = generate(8, random.Random(0), greedy=True)
print(" ".join(plain), "|", plain_passes, "target passes")
print(" ".join(spec), "|", spec_passes, "target passes")
print("same output:", plain == spec, "| drafts accepted:", accepted, "of", drafted)

# Sampling (temperature above 0): the distribution of outputs matches too.
runs = 50_000
rng = random.Random(1)
plain_counts = Counter(tuple(generate(4, rng, speculative=False)[0]) for _ in range(runs))
spec_counts, passes, tokens = Counter(), 0, 0
for _ in range(runs):
    out, p, _, _ = generate(4, rng)
    spec_counts[tuple(out)] += 1
    passes += p
    tokens += len(out)
draft_counts = Counter(tuple(generate(4, rng, speculative=False, model=DRAFT)[0]) for _ in range(runs))


def gap(a, b):  # total variation distance: 0 means the same distribution
    return sum(abs(a[s] - b[s]) for s in a | b) / (2 * runs)


print(f"tokens per target pass: {tokens / passes:.2f}")
print(f"gap, speculative vs target alone: {gap(spec_counts, plain_counts):.3f}")
print(f"gap, draft alone vs target alone: {gap(draft_counts, plain_counts):.3f}")

# Output:
# the cat sat on the cat sat on | 8 target passes
# the cat sat on the cat sat on | 3 target passes
# same output: True | drafts accepted: 7 of 12
# tokens per target pass: 2.99
# gap, speculative vs target alone: 0.005
# gap, draft alone vs target alone: 0.261
```

The last two lines are the point. Sampled with speculation, the outputs differ from the target's own by 0.005, which is sampling noise from 50,000 runs; trusting the draft alone would be off by 0.261. Speculation made about three tokens per target pass and left the distribution where it was. On a real model the gain is smaller, because drafting isn't free and a real draft disagrees more often.

## Is speculative decoding lossless?

Yes, in its standard form. The original paper describes it as sampling faster "without any changes to the outputs" [Source 1], and DeepMind's version "preserves the distribution of the target model within hardware numerics" [Source 4]. vLLM tests that greedy output with speculation matches greedy output without it [Source 5].

"Within hardware numerics" is the one catch. vLLM notes that floating-point differences and changes in batch size can shift output probabilities slightly, so a run with speculation may not match a run without it token for token, the same way two ordinary runs may not [Source 5].

### Does speculative decoding reduce accuracy?

Not with the standard verification rule, because the target model still decides every token. Some variants relax the rule to accept more guesses: vLLM's docs list one, FLy, that "deliberately relaxes verification and is not distribution preserving" [Source 5]. If quality matters more than the last bit of speed, check which verification your engine uses.

## What kinds of drafters are there?

The drafter doesn't have to be a separate model. Anything that can guess the next tokens cheaply will do: a smaller model, a lookup in the prompt, extra heads on the target itself or a diffusion-style block drafter. The families trade setup effort for how often the guesses land.

| Drafter | How it guesses | Notes |
| --- | --- | --- |
| Draft model | A smaller model, often a distilled version of the target [Source 2] | Needs a separate draft model [Source 5] |
| N-gram | Matches the latest tokens against text already in the prompt (vLLM's settings call it prompt lookup) [Source 5] | No extra model; vLLM calls it lightweight and easy to enable [Source 5] |
| EAGLE | A light drafting head on the target's own hidden states; EAGLE-3 reads several of its layers [Source 2] | No second model to train and run [Source 2] |
| MTP (multi-token prediction) | The model is trained to predict several future tokens at once, with extra heads [Source 2] | Best when the target model has native MTP support [Source 5] |
| Diffusion-style block drafter (DFlash) | Fills in a whole block of draft tokens in one pass instead of one at a time [Source 3] | Drafting cost barely grows with the number of guesses [Source 3] |

### Is MTP the same as speculative decoding?

No. MTP is one way to draft. A model trained with multi-token prediction proposes several tokens at once from its own extra heads, and the main model then keeps the longest prefix it agrees with [Source 2]. The verification is the same as with a separate draft model; only the source of the guesses changes.

## How much faster is speculative decoding?

Typically two to three times on decode in the published results, but it depends on the drafter, the hardware and how predictable the text is. The 2022 paper reported 2x to 3x on T5-XXL with identical outputs [Source 1], and DeepMind 2x to 2.5x on its 70-billion-parameter Chinchilla model [Source 4].

The most recent large result is from Google and UCSD, published on 4 May 2026, with DFlash on Google TPU v5p [Source 3]:

| Test | Setup | Result |
| --- | --- | --- |
| Standalone benchmark, no serving layer | Qwen3-4B target, greedy decoding | 3.13x more tokens per second on average |
| Math (math500) | Same | 8.02 to 1.40 ms per token, about 5.7x |
| Code (MBPP) | Same | 9.81 to 3.48 ms per token, about 2.8x |
| Code (HumanEval) | Same | Over 3.5x |
| End-to-end serving in vLLM | Llama-3.1-8B-Instruct target | 2.29x, against 1.30x for EAGLE-3 |

These are the team's own numbers on one setup. Two details from the same post explain the spread. Math and code gain most and conversation least, because structured text is easier to predict. And on the TPU, checking 1,024 guessed tokens cost almost the same as checking 16, so the team found that guessing better was worth 2 to 3 times more than guessing more [Source 3].

## When does speculative decoding not help?

When there's no idle compute to spend, or when the guesses are usually wrong. Speculative decoding trades spare compute for fewer sequential steps, so a busy server, a weak drafter or hard-to-predict text each shrink the gain, and a separate draft model also costs memory.

- **Busy servers.** vLLM aims speculative decoding at "medium-to-low QPS (queries per second), memory-bound workloads", and its own table rates the model-based methods (draft model, EAGLE, MTP) lower at high traffic than at low [Source 5]. A full batch already keeps the compute busy.
- **Bad guesses.** If every guess is rejected, a pass yields only the one token the target writes itself [Source 2], and the time spent drafting is lost. Google's post describes the same limit: time spent guessing eats into time saved by verification [Source 3].
- **Hard-to-predict text.** Open-ended chat gains less than math and code [Source 3].
- **Memory.** The draft-model method needs a separate draft model [Source 5], and it has to fit on the same hardware as the target.
- **Hosted APIs.** It's a serving technique, turned on in the engine that runs the model, such as vLLM, SGLang or TensorRT-LLM [Source 2]. If you call a provider's API, how the model is served is the provider's choice.

## How do you try speculative decoding in vLLM?

vLLM takes a `--speculative-config` JSON object when you start the server. Its common keys are `method` (for example `draft_model` or `ngram`), `model` for a draft model, and `num_speculative_tokens`, how many tokens to guess per round; Python accepts the same keys through `LLM(..., speculative_config={...})` [Source 5]. Draft models need a vLLM newer than 0.10.0 [Source 5].

Then measure on your own traffic, not a benchmark's:

| Step | What to measure |
| --- | --- |
| 1. Baseline | Tokens per second, time to first token and p95 latency with the target alone |
| 2. Add a drafter | The same prompts at the same load, with speculation on |
| 3. Acceptance | The share of drafted tokens the target keeps (vLLM reports it per request) [Source 5] |
| 4. Output | Greedy outputs against the baseline; expect matches apart from the numerics noted above |
| 5. Load | Repeat at your busiest hour, where the gain is smallest |

A low acceptance rate means the drafter is wasting its work: try fewer tokens per round or a drafter closer to your target model.

## What does speculative decoding mean for AI agents?

An agent's run is a chain of model calls, and each step waits for its answer to be written before the next can start. Decode time adds up across every step, so a faster decode shortens the whole run, and standard speculative decoding does it without changing what the model would have decided.

If you serve your own models for agents, it shortens each step without changing the output, which a smaller or quantized model can't promise. If you call a hosted API, you can't switch it on, but you can still choose a faster model and shorter answers; our post on [how much an AI agent costs to run](https://arclyx.ai/blog/the-inference-cost-trap) shows where the tokens go. Either way, measure whole runs rather than single calls. Arclyx records every agent run step by step, with its tokens (and its cost on paid plans), and charts each agent's runs by duration, tokens or price, as the [AI agent observability](https://arclyx.ai/product/observability) page shows. To see what those runs look like on real jobs, browse the [Arclyx agents](https://arclyx.ai/agents).

## Conclusion

Speculative decoding lets a cheap drafter guess and an expensive model check, so the expensive model writes several tokens per pass instead of one. With the standard verification rule the output is the target model's own, up to hardware numerics. The gain depends on how often the guesses land and on spare compute: large for predictable text on a lightly loaded server, small on a busy one. Measure acceptance rate and latency on your own prompts before you rely on a published speedup.

## Sources

1. Yaniv Leviathan, Matan Kalman and Yossi Matias (Google), *Fast Inference from Transformers via Speculative Decoding* (arXiv, 30 November 2022; ICML 2023 oral). [https://arxiv.org/abs/2211.17192](https://arxiv.org/abs/2211.17192)
2. NVIDIA — Jamie Li, Chenhan Yu and Hao Guo, *An Introduction to Speculative Decoding for Reducing Latency in AI Inference* (17 September 2025). [https://developer.nvidia.com/blog/an-introduction-to-speculative-decoding-for-reducing-latency-in-ai-inference/](https://developer.nvidia.com/blog/an-introduction-to-speculative-decoding-for-reducing-latency-in-ai-inference/)
3. Google Developers Blog — Weiren Yu, Yarong Mu and Lihao Ran (Google), Zhaoxiang Feng, Yiming Zhao and Hao Zhang (UCSD), *Supercharging LLM inference on Google TPUs: Achieving 3X speedups with diffusion-style speculative decoding* (4 May 2026). [https://developers.googleblog.com/supercharging-llm-inference-on-google-tpus-achieving-3x-speedups-with-diffusion-style-speculative-decoding/](https://developers.googleblog.com/supercharging-llm-inference-on-google-tpus-achieving-3x-speedups-with-diffusion-style-speculative-decoding/)
4. Charlie Chen, Sebastian Borgeaud, Geoffrey Irving, Jean-Baptiste Lespiau, Laurent Sifre and John Jumper (DeepMind), *Accelerating Large Language Model Decoding with Speculative Sampling* (arXiv, 2 February 2023). [https://arxiv.org/abs/2302.01318](https://arxiv.org/abs/2302.01318)
5. vLLM — *Speculative Decoding* (vLLM docs, latest, checked 27 November 2026). [https://docs.vllm.ai/en/latest/features/speculative_decoding/](https://docs.vllm.ai/en/latest/features/speculative_decoding/)
6. Google Research — Yaniv Leviathan, Matan Kalman and Yossi Matias, *Looking back at speculative decoding* (6 December 2024). [https://research.google/blog/looking-back-at-speculative-decoding/](https://research.google/blog/looking-back-at-speculative-decoding/)
