AI GLOSSARY · AI CONCEPTS
Speculative decoding
Definition
Speculative decoding aims to accelerate language-model generation by proposing candidate tokens cheaply and checking them together with the target model. A smaller draft model is one setup; other methods propose candidates without a separate model.
Also called: speculative sampling, draft model decoding, speculative decoding LLM.
In plain language
A large language model writes text one small piece at a time, called a token, and each piece needs a full pass through a big, slow model. In the original two-model setup, a cheap helper guesses the next few pieces. The big model then checks all the guesses in one go and keeps the ones it agrees with. It is like a junior colleague drafting a sentence that a senior editor approves or corrects. The limit is that a poor helper wastes effort and can make things slower, and the gain depends on your hardware and workload. A separate helper can require extra memory; ngram proposals need no separate draft model.
Technical definition
Leviathan, Kalman and Matias (arXiv, submitted 30 November 2022) describe decoding K tokens with a large autoregressive model as K serial model runs. Their method runs the large model in parallel over the outputs of a more efficient approximation model, with a sampling method designed to leave the output distribution unchanged. Hugging Face's May 2023 assisted-generation post describes a greedy shared-tokenizer setup: the main model checks candidates in one forward pass and discards the suffix after the first mismatch. This is a particular historical setup, not a method-wide tokenizer requirement. Current Transformers documentation supports different-tokenizer assistance, and vLLM documents ngram proposals without a separate draft model.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
local-model-sizing 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill works out whether an open-weight language model will run on a given GPU, Mac or PC, with a script that computes weight, KV-cache and overhead memory per quantization.
- Why it exercises the concept
- A draft model is a second model that also needs memory. This skill sizes one model at a time, so use it for each model separately. The catalogue has no skill that configures speculative decoding.
Guide · Illustrative, not executed
Self-Hosting an AI Agent: What You Take On
- What you see
- A guide on what you own when an agent runs on your machine: model memory, network exposure, file access and vetting skills.
- Why it exercises the concept
- Speculative decoding is something you configure when you run the model server yourself, where memory is your own concern. The guide covers the surrounding decisions, not this feature.
Skill by Skill Almanac · Illustrative, not executed
llm-eval-test-sets 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill builds and validates an eval dataset for any LLM feature, with a checker for duplicates, missing graders, imbalance and leakage.
- Why it exercises the concept
- vLLM's documentation says some methods are not distribution preserving and that gains depend on your setup. A fixed eval set lets you compare outputs before and after. The skill does not measure speed itself.
How it shows up when you use agents
Speculative decoding sits inside the model server, not in your prompt or your agent. If you use a hosted service through Claude Code, Codex or Cursor, the provider decides whether to use it and you see just the response time. It becomes your decision when you run a model yourself with a server such as vLLM, where the documentation lists it as a way to reduce inter-token latency.
Agents make this relevant because a coding session produces many model calls in a row, and waiting for each reply adds up. A faster generation step can shorten the loop. That is a reason to try it, not a promise: the vLLM page says real gains depend on your model family, traffic pattern, hardware and sampling settings.
What breaks when it is misunderstood: people enable it and assume the output is unchanged. The standard method is designed to preserve the output distribution, but vLLM notes that floating-point errors may cause slight variations, and that one listed method relaxes verification and is not distribution preserving. A weak draft model can also slow generation down, as Hugging Face notes.
Next action: read your server's documentation for the method you pick, check the selected proposal method's model and tokenizer requirements, and measure speed and answer quality on your own prompts before relying on it. See Inference and Large language model.
Common confusions
- Speculative decoding versus a smaller model. A smaller model replaces the large one and may give different answers. In speculative decoding the large model still checks the proposals.
- Same distribution versus identical text every run. The original paper's method aims to keep the output distribution unchanged. That is different from byte-identical text each run, and vLLM says it does not currently guarantee stable token logprobs.
- Speculative decoding versus quantization. Quantization changes how a model's numbers are stored. Speculative decoding changes how tokens are produced and checked. They are separate techniques.
- Myth. "A draft model makes generation faster." Hugging Face says a weak assistant adds cost with little benefit, and measuring on your own workload is the safer habit.
Related terms
Terms that mention Speculative decoding
More in AI concepts
Sources
- Fast Inference from Transformers via Speculative Decoding — Leviathan, Kalman and Matias, arXiv (accessed 2026-11-24)
- Assisted Generation: a new direction toward low-latency text generation, Hugging Face (accessed 2026-11-24)
- Speculative Decoding, vLLM documentation (accessed 2026-11-24)
- Text generation: assistant and tokenizer parameters, Official documentation (accessed 2026-11-25)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.
Review record
Last verified
Drafted by Claude (original draft) and OpenAI Codex (targeted revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .
Change log (5)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : Targeted batch-09 source repairs: corrected required family, implementation or example scope. Independent affected review pending; no publication approval.
- : First version.
- : Verifier pass: corrected claims flagged by verifier against cited sources.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.