Core optimizations
Draft sources
Small LMs, prompt n-grams, Medusa heads, EAGLE and multi-token predictors. Pick for stack support and tokenizer match.
The draft can come from a second model, from the prompt itself, or from extra heads trained on the target. Pick based on stack support. vLLM, SGLang and TensorRT-LLM all ship some speculative modes. Check which draft types your version actually supports before promising latency wins.
| Source | Idea | Pros | Cons |
|---|---|---|---|
| Small LM | 1–7B draft beside 70B target | Flexible, classic | Extra weights, sync cost, need a similar training distribution |
| Prompt lookup / n-gram | Copy continuations from context | Almost free | Helps mostly when text repeats |
| Medusa | Extra decoding heads on the target | No second model | Train heads; depth limited |
| EAGLE | Draft from features / a lightweight head using target states | High acceptance | Implementation complexity |
| Multi-token prediction (MTP) | Models trained to predict several future tokens | Strong alignment with target | Needs model support |
Prefer draft checkpoints from the same family (e.g. 8B beside 70B of one line) or heads trained on the target's hidden states (EAGLE, Medusa, MTP) so the vocabulary and features match by construction. Same-tokenizer alignment is non-negotiable for separate draft models.
The big idea
A junior who trained in the same shop as the senior guesses the next sentence better than a stranger. Extra heads on the senior (Medusa, EAGLE, MTP) are even closer: they share the same brain state. The picture breaks when the "junior" uses a different tokenizer. The words look the same to you and different to the model, so acceptance collapses.
Walking through the choice
Small LM. Classic and flexible. You pay extra weights on the same GPU (or a sidecar) and a sync between draft and verify. Need a similar training distribution or α dies on domain shift.
Prompt lookup / n-gram. Almost free. Helps when the model is repeating or copying from context (code, RAG quotes). Useless on high-entropy chat.
Medusa. Extra decoding heads on the target. No second model to ship. You must train the heads, and depth is limited.
EAGLE. Drafts from target features with a lightweight head. Often high acceptance. More moving parts to implement and upgrade.
MTP. Models trained to predict several future tokens (DeepSeek-style heads). Strong alignment because the target was trained for it. Only works if the checkpoint has the heads.
Also budget KV growth. Accepting four tokens appends four KV positions in one round. Speculation does not shrink KV.
Ship speculation behind a flag and an SLO experiment. Operational checklist:
- Baseline TPOT/goodput without speculation at production concurrency.
- Enable a supported draft mode. Sweep
kin {2,3,4,5,8}. - Track acceptance rate by route (chat vs code vs JSON).
- Disable or route-select where
αis poor. - Re-run cost models — fewer GPUs for the same interactive SLO is the win, not a vanity tok/s chart.
Common mistakes
- Promising a draft mode the engine version does not ship.
- Pairing a 7B from another family with a 70B target and a different tokenizer.
- Using n-gram drafts on open-ended chat and concluding speculation "doesn't work."
Check yourself
- Which draft is almost free but only helps when text repeats? Answer: prompt lookup / n-gram.
- Why do EAGLE or MTP heads often beat a random small LM on α? Answer: they share the target's states or were trained to predict its future tokens, so vocab and features match.
Key takeaways
- Drafts are small LMs, n-grams, Medusa, EAGLE or native MTP heads.
- Same family or same hidden states beat a random small model.
- Check engine support before you promise a win.
- Raise α on your traffic. That is the real work.
Further learning
Fast Inference from Transformers via Speculative DecodingInference from large autoregressive models like Transformers is slow - decoding K tokens takes K serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive mo…arXiv.org
EAGLE: Speculative Sampling Requires Rethinking Feature UncertaintyAutoregressive decoding makes the inference of Large Language Models (LLMs) time-consuming. In this paper, we reconsider speculative sampling and derive two key observations. Firstly, autoregression at the feature (se…arXiv.org
Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding HeadsLarge Language Models (LLMs) employ auto-regressive decoding that requires sequential computation, with each step reliant on the previous one's output. This creates a bottleneck as each step necessitates moving the fu…arXiv.org
Next, see when speculation fights the batch.
Related
Speculative decoding
Draft-and-verify so one target forward accepts several tokens. Same output distribution. Real speedups when decode is memory-bound and acceptance stays high.
Speculative acceptance rate
Speedup is expected accepted tokens divided by draft-plus-verify cost. Sweep k. Measure alpha on your traffic.
Modern LLM architectures
Mixture of experts, GQA and MLA, long context, state space models and multimodal transformers.