Speculative decoding in vLLM: when it speeds up serving, and when it slows it down
Speculative decoding lets a cheap drafter guess the next few tokens and the big model check them in one pass. In vLLM it cuts time per output token at low to medium load and gains less as the batch fills the GPU. How to turn on MTP for Qwen3.8, EAGLE3 for gpt-oss-120b or n-gram lookup with --speculative-config, and how to measure whether it helps on your traffic. Checked against the vLLM 0.34.0 docs, 29 November 2026.
Lium team7 min read
vllm
llm-inference
speculative-decoding

Short answer: speculative decoding makes each user see tokens faster when your server is lightly or moderately loaded, and it gains less as the server gets busy. Turn it on when you care about latency for a few users at a time (chat, agents, coding tools). Measure it before you keep it when you run large batches for throughput. Pick the drafter in this order: the model's own MTP head if it has one (Qwen3.8 does), a published EAGLE3 head for your model (gpt-oss-120b has one from NVIDIA), and n-gram lookup when outputs repeat the prompt. The output does not change: vLLM checks every drafted token against the big model.
Everything below is checked against the vLLM speculative decoding guide and its pages on MTP, EAGLE, n-gram and acceptance metrics (stable docs for vLLM 0.34.0), the vLLM recipe for Qwen3.8-27B and the model cards on Hugging Face, all read 29 November 2026.
How it works
A normal decoder runs the whole model once per output token. At small batch sizes that pass is limited by reading the weights from GPU memory, not by arithmetic, so the GPU has compute to spare.
Speculative decoding spends that spare compute. A cheap drafter proposes the next k tokens. The target model then scores all k in one forward pass, keeps the longest run it agrees with, and adds one token of its own. When the guesses are good, one pass of the big model yields several tokens instead of one.
The method comes from two papers of 2022 and 2023: Leviathan et al., "Fast Inference from Transformers via Speculative Decoding" and Chen et al., "Accelerating Large Language Model Decoding with Speculative Sampling". Both use a rejection sampling rule that keeps the target model's output distribution exactly.
The vLLM guide states the goal in the same terms: to "reduce inter-token latency under medium-to-low QPS (queries per second), memory-bound workloads".
How many tokens one pass buys
Leviathan et al. give the expected number of tokens per target pass as (1 - α^(k+1)) / (1 - α), where α is the chance that a drafted token is accepted and k is the number of drafted tokens. Two examples with k = 4, from that formula:
- α = 0.6: about 2.3 tokens per pass.
- α = 0.8: about 3.4 tokens per pass.
That is not the speedup. The drafter costs time too, and every rejected token was computed for nothing. A higher k only pays off when α is high, which is why the published settings differ so much: the vLLM MTP guide suggests starting at 1, the Qwen3.8 recipe uses 3, and NVIDIA's EAGLE3 head for gpt-oss-120b uses 7.
When it slows serving down
The spare compute that speculation uses runs out as the batch grows. With many requests in flight, the GPU is already busy with arithmetic, and verifying k extra tokens per request competes with real work. Rejected tokens then cost throughput.
The vLLM guide's method table says the same thing qualitatively:
The guide adds that "real gains depend on your model family, traffic pattern, hardware, and sampling settings". The kind of text matters too. NVIDIA's card for the gpt-oss-120b EAGLE3 head reports an average acceptance length of 2.95 tokens per step on SPEED-Bench (7 drafted tokens, temperature 0), from 2.31 on roleplay to 3.50 on math. Three cases where we would expect little or a loss, from the mechanism above:
- Large batches for offline throughput. The GPU has no idle compute to spend.
- Creative, high-temperature output. Drafts get rejected more often, so α drops.
- A drafter that is too big. Its own passes eat the time the target saves.
Does it change the output?
No, within floating point. The guide says speculative decoding in vLLM is "theoretically lossless up to the precision limits of hardware numerics", and its tests check that greedy decoding with speculation matches greedy decoding without it.
Two caveats from the same section: vLLM does not guarantee stable logprobs, and a different batch size can change results slightly. Both apply to vLLM with or without speculation.
Turn it on
All methods use one flag,
--speculative-config, with a JSON object. method picks the drafter, num_speculative_tokens is k, and model names the drafter's weights where it needs any.MTP: the model's own drafter
Some models are trained with extra multi-token prediction (MTP) layers that guess the following tokens. Qwen3.8-27B is one: its model card lists MTP "trained with multiple steps", and its
config.json has mtp_num_hidden_layers: 1. There is nothing extra to download. The vLLM recipe adds MTP to its FP8 command like this:bash
vllm serve Qwen/Qwen3.8-27B-FP8 --reasoning-parser qwen3 \
--speculative-config '{"method": "mtp", "num_speculative_tokens": 3}'The recipe measured an MTP acceptance rate of 0.771 for the FP8 build (77% of drafted tokens kept), from the vLLM acceptance counters described below. The MTP guide's advice is to start with a small value such as 1 and raise it while acceptance stays high.
EAGLE3: a trained draft head
EAGLE (Li et al., 2024) trains a small head on the target model's own hidden states, so it drafts better than an unrelated small model at a fraction of the cost. You need a head trained for your exact target. For gpt-oss-120b, NVIDIA publishes gpt-oss-120b-Eagle3-v3, and its card gives this command:
bash
vllm serve openai/gpt-oss-120b \
--speculative-config '{"method": "eagle3", "num_speculative_tokens": 7,
"model": "nvidia/gpt-oss-120b-Eagle3-v3"}'N-gram lookup
The drafter copies the tokens that followed the same n-gram earlier in the prompt. It needs no extra model or memory. It helps when the answer repeats the input: editing code, answering from a retrieved document, summarizing. It works with any model:
bash
vllm serve Qwen/Qwen3.8-27B-FP8 --reasoning-parser qwen3 \
--speculative-config '{"method": "ngram", "num_speculative_tokens": 4, "prompt_lookup_max": 4}'prompt_lookup_max is the longest n-gram it matches; prompt_lookup_min sets the shortest.A separate draft model
"method": "draft_model" with a small model of the same family in model also works. The drafter must share the target's tokenizer, and its weights and KV cache take GPU memory. For a model that ships MTP or has an EAGLE3 head, try those first. If startup fails with a KV cache error, see why vLLM runs out of memory.Measure it on your own traffic
Do not keep speculation on faith. Run the same load with and without it and compare time per output token and total throughput.
Acceptance. With speculation on, the server exports Prometheus counters at
/metrics. Read them with curl -s http://127.0.0.1:8000/metrics | grep spec_decode_num. The three that matter:text
vllm:spec_decode_num_drafts_total # drafting steps
vllm:spec_decode_num_draft_tokens_total # tokens proposed
vllm:spec_decode_num_accepted_tokens_total # tokens the target keptAccepted divided by drafted tokens is your acceptance rate. Accepted tokens divided by drafting steps, plus one for the target's own token, is the average number of tokens each pass produced. If that stays close to 1, the drafter is not earning its cost: lower
num_speculative_tokens or try another method. The Qwen3.8 recipe makes the same point: throughput alone cannot tell a working drafter from one that loaded and was ignored. For per-request numbers, start the server with --per-request-spec-decode-metrics summary (experimental in 0.34.0).Latency and throughput.
vllm bench serve replays a load against a running server. Run it once against a server with speculation and once without, at the load you expect:bash
vllm bench serve --model Qwen/Qwen3.8-27B-FP8 --dataset-name random \
--random-input-len 1024 --random-output-len 256 \
--num-prompts 200 --max-concurrency 4Repeat with a higher
--max-concurrency (or a --request-rate) to find where the gain ends. Random token prompts give the n-gram drafter nothing to copy, so check the final choice on a sample of your real prompts too.Running the test on Lium
OpenAI's model card says gpt-oss-120b runs on a single 80 GB GPU such as the H100. The EAGLE3 head adds its own weights on top, so leave headroom with a shorter
--max-model-len, or use an H200 or B200; NVIDIA lists the B200 as its test hardware for the head. The Qwen3.8 recipe serves the FP8 build on four GPUs for the largest KV cache, and quantized builds on one.Serve an open LLM with vLLM on a single Lium GPU walks through starting a pod with
lium up and running vllm serve. Add --speculative-config to that command and run the benchmark above from the pod. Pods bill by the second, so an A/B test of an hour costs only that hour. Live supply for each card is on lium.io/stats.Checklist
- Know your load: speculation helps most at low to medium concurrency.
- Use the model's MTP head if it has one, then a published EAGLE3 head, then n-gram if outputs repeat the prompt.
- Keep
num_speculative_tokenssmall at first and raise it only while the acceptance counters stay high. - Compare
vllm bench servewith and without speculation at your real concurrency. - Turn it off where it does not win: it never changes the answer, only the speed.
Run it on Lium
Get new posts by e-mail: Subscribe to the Lium newsletter


