What Is Speculative Decoding?

What Is Speculative Decoding?

What Is Speculative Decoding?

Speculative decoding is a technique that makes large language models answer faster without changing what they say. It works by letting a small, quick model draft several words ahead, then asking the big model to check the whole draft in one pass. The big model keeps the words it agrees with and fixes the rest, so the answer comes out identical to what the big model would have written on its own, only sooner.

The trick matters because language models are slow in a specific way. A model writes one word at a time, and each word depends on the one before it, so it cannot simply do the work in parallel. Most of the time is spent loading the model’s weights from memory, not doing arithmetic. Speculative decoding attacks that bottleneck, and on many workloads it roughly doubles or triples the speed of text generation.

If you use a chatbot, a coding assistant, or any AI writing tool in 2027, you have probably benefited from speculative decoding without knowing it. This guide explains the idea in plain terms: how the draft-and-check loop works, what draft models are, where the speedups come from, and how it compares with other ways of making models faster.

Key takeaways

  • Speculative decoding pairs a small draft model with a large target model: the small model guesses ahead, and the large model verifies the guesses in one parallel pass.
  • Accepted guesses are free speed; rejected guesses are discarded and corrected, so the final text matches what the large model alone would have produced.
  • Typical speedups are around two to three times on ordinary text, with the biggest gains when the draft model predicts the target model well.
  • The technique changes speed, not quality: it does not make the model smarter, and a poor draft model can make generation slower, not faster.
  • It is now built into major inference engines and is one of the standard ways chatbots and coding assistants keep response times low.

What speculative decoding is

At its simplest, speculative decoding is a way of guessing ahead. A large language model generates text one token at a time, and a token is roughly a word or part of a word. Each step requires a full pass through the model, which means loading billions of parameters from memory. On modern hardware, that memory traffic is the bottleneck.

Speculative decoding breaks the one-token-at-a-time rule without breaking the result. A much smaller model, the draft model, quickly writes the next few tokens. Then the large model, the target model, examines all of them at once. Because checking several tokens in parallel costs little more than checking one, the large model can accept a run of correct guesses in a single pass and move several tokens ahead at once.

The key property is that the output is unchanged. The verification step uses the large model’s own probabilities, so any token the draft model got wrong is replaced with the token the large model would have chosen. Readers see the same text, the same quality, and the same quirks; they just see it sooner. If the basic idea of these models is new to you, our explainer on what a large language model is covers the one-token-at-a-time problem in more detail.

How speculative decoding works, step by step

The process runs as a loop. First, the draft model looks at the text so far and proposes a short block of tokens, usually between two and eight. It does this quickly because it is small: a draft model might have a few hundred million parameters where the target model has tens of billions.

Next, the target model runs a single forward pass over the prompt plus the draft block. In that one pass it computes what it would have produced at every position in the block. Then it walks through the draft from the start, accepting each token that matches its own choice, or that passes a sampling test when the model is generating creatively rather than greedily. The first token that fails is replaced with the target model’s own token, everything after it is thrown away, and the loop starts again from that point.

Close-up of hands typing on a laptop keyboard in a dim office at dusk
Every token a chatbot writes goes through the draft-and-check loop, so small speedups per token add up to a visibly faster reply.

The math is straightforward. If the draft model proposes five tokens and the target model accepts four of them on average, each large-model pass produces about five tokens instead of one. The draft model’s own passes cost time too, so the net speedup is smaller than the acceptance count suggests, but on typical text the result is still a two- to threefold improvement.

Draft models and the main variants

The draft model is the heart of the system, and there are several ways to build one. The simplest approach is to use a smaller model from the same family as the target, such as a one-billion-parameter model drafting for a seventy-billion-parameter one.

A second approach is to train a small prediction head that sits on top of the target model’s own layers, rather than using a separate model at all. These self-speculative designs, including methods like Medusa and EAGLE, reuse the target model’s internal representations to predict several tokens ahead. They avoid loading a second model into memory and often achieve the highest acceptance rates.

A third variant changes the verification rules rather than the drafter. Standard speculative decoding verifies greedily, accepting a token only if the target model would have chosen it. Speculative sampling accepts tokens probabilistically, which preserves the target model’s exact output distribution even when generation is random rather than deterministic. There are also tree-based variants that draft several possible continuations at once and verify them together, which raises the chance that at least one branch is accepted.

The benefits and the risks

The main benefit is latency: the time between sending a prompt and reading a complete answer falls sharply. The second benefit is cost. Because the large model does fewer passes, a server can handle more requests on the same hardware, which lowers the cost per answer.

There are limits, though. Speculative decoding only helps when the draft model is often right. On tasks where the target model’s next token is hard to predict, such as unusual code, rare names, or highly creative writing, the acceptance rate drops and the extra drafting work can make generation slower than running the large model alone.

Another risk is subtle: the technique is sometimes presented as a quality improvement, which it is not. It does not make the model smarter, more accurate, or less likely to invent facts. It makes the same model faster. The underlying trade-offs come from how these models learn, and our guide to what machine learning is explains the training process that makes a model’s next-token predictions predictable enough for drafting to work.

Where speculative decoding is used in 2027

The most visible use is in chatbots. When a chat service answers in a smooth stream of words, speculative decoding is often the reason the stream keeps up with reading speed. Coding assistants are a second major use: code is unusually predictable, with repeated patterns and boilerplate, so draft models achieve high acceptance rates and suggestions appear almost as fast as the developer types.

It is also used in on-device AI. Phones and laptops have limited memory bandwidth, which is exactly the bottleneck speculative decoding relieves, so a small draft model paired with a medium-sized target model can make on-device chat usable without a network connection.

There are also less obvious uses. Real-time translation, voice assistants, and agents that call tools in sequence all benefit from faster token generation, because each step of a multi-step task depends on the previous one finishing.

Speculative decoding vs other ways to speed up language models

Speculative decoding is one of several speed techniques, and they solve different problems. Quantization shrinks the model itself, using fewer bits per weight, which reduces memory traffic. Caching, especially key-value caching, avoids recomputing attention for tokens already processed, which speeds up long conversations.

Other approaches trade quality for speed and are not equivalent. Pruning removes weights from the model, and distillation trains a smaller model to imitate a larger one; both change the output. Speculative decoding is unusual in guaranteeing identical output, which is why it is the first speed technique most providers enable. The table below summarises the comparison.

Speed techniques for language models at a glance
Technique What it changes Output identical?
Speculative decoding Fewer large-model passes Yes
Quantization Smaller weights, less memory traffic Almost, small differences
Key-value caching Reuses past computation Yes
Pruning Removes model weights No
Distillation Replaces model with a smaller one No

A production system in 2027 typically combines all three, because each method attacks a different part of the latency problem. For readers interested in the wider field, our explainer on what generative AI is puts these speed tricks in the context of how the models generate text in the first place.

Checklist: judging speculative decoding claims honestly

Use these checks before believing a speed claim about any AI product.

  • Check whether the speedup was measured against the same model and hardware, or against a slower baseline that flatters the result.
  • Ask for the acceptance rate: a claimed threefold speedup needs most draft tokens to be accepted, not just a few.
  • Confirm the output is unchanged, or ask how much quality was traded for the speed gain.
  • Check whether the numbers come from easy, predictable text or from the hard, varied prompts your own use involves.
  • Ask what hardware the test ran on, since memory bandwidth decides how much speculative decoding can help.
  • Remember that latency is only one number: cost per request and output quality matter just as much.

Frequently asked questions

Does speculative decoding change what the model writes?

No. The verification step guarantees the output matches what the large model would have produced on its own. It changes how fast the text appears, not the text itself.

How much faster is speculative decoding?

Typically two to three times faster on ordinary text, though the exact figure depends on the draft model, the task, and the hardware. Highly predictable text such as code can go faster; unusual or creative text gains less.

Can speculative decoding make generation slower?

Yes, when the draft model rarely guesses correctly. Every rejected draft wastes the time spent generating it, so a poor draft model on hard text can cost more time than it saves.

Do I need a special model to use speculative decoding?

You need a draft model that predicts the target model well, usually a smaller model from the same family or a trained prediction head. Major inference engines include draft models for popular targets, so in practice it is often a setting rather than a project.

Does speculative decoding work on phones and laptops?

Yes, and it is especially useful there, because mobile hardware has limited memory bandwidth. A small draft model paired with a medium target model can make on-device chat noticeably faster.

Is speculative decoding the same as quantization?

No. Quantization shrinks the model’s weights to reduce memory traffic, while speculative decoding reduces the number of passes the large model makes. The two techniques are complementary and are often used together.

The bottom line

Speculative decoding is a simple idea with an outsized effect: let a small model guess ahead, let the big model check the guesses in one pass, and keep only the guesses the big model agrees with. The result is the same text, delivered two to three times faster, with no loss of quality. It works because language models are limited by memory traffic, not by arithmetic, and guessing ahead is a cheap way to use the arithmetic that would otherwise sit idle.

As models keep growing, the systems that win will be the ones that generate the same answers faster and cheaper. Speculative decoding is one of the clearest examples of that trend, and it is now part of the standard toolkit for anyone serving a large language model in 2027.

on this page