AI & Machine Learning

Speculative decoding

Also known as: speculative sampling, assisted generation, draft-model decoding

Speculative decoding is a technique for making large AI models generate text faster.

A small, fast 'draft' model guesses the next several tokens, and the large model checks all of them in a single step, keeping the ones it agrees with. Because the large model has the final say, the output matches what it would have produced alone. While speculative decoding can make responses two to three times faster, the speed-up depends on how often the draft model guesses correctly.

Speculative decoding, explained at three levels

At home

Imagine a junior writer quickly drafting the next few words and a senior editor approving them all at once. If the draft is good, the work goes much faster. That's speculative decoding.

At work

Speculative decoding makes AI products feel faster and lets servers handle more requests, without changing answer quality.

Real-world examples

At home

Jerome noticed his AI coding assistant became much faster at filling in repetitive code. The provider had added speculative decoding, so predictable lines were confirmed in batches.

At work

Fatima runs AI infrastructure at a Montreal fintech startup. Enabling speculative decoding on their self-hosted model cut average response times noticeably without any change in output.

How it compares

featureSpeculative decodingModel Distillation
Output qualityIdentical to large modelSmaller model, some quality loss
Models neededLarge model plus a draftOnly the small model at runtime
Speed gainOften 2 to 3 timesLarger, but with trade-offs
CostStill runs the large modelCheaper to serve

Speculative decoding speeds up the same model. Distillation replaces it with a smaller one.

For analysts

If AI response times are hurting user experience, I'd ask whether speculative decoding is enabled before paying for bigger hardware. It's often a configuration change.

History & origin

Generating text one token at a time leaves GPUs underused, since each step waits for the last. In November 2022, Yaniv Leviathan, Matan Kalman, and Yossi Matias at Google published 'Fast Inference from Transformers via Speculative Decoding,' and a DeepMind team led by Charlie Chen independently described 'speculative sampling' in early 2023. Variants followed, including Medusa in 2024, which added extra prediction heads to the main model instead of a separate draft model, and EAGLE, which predicted at the feature level. Serving engines such as vLLM and TensorRT-LLM added support, and major AI providers use forms of it in production. In my view, speculative decoding is a rare free lunch in AI: faster answers with no loss in quality.