esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

What Is Speculative Decoding?

How a small draft model guesses ahead while a big model checks, why answers come faster, and where the speed-up stops, for your AI interview.

In short

Speculative decoding speeds up a language model by letting a small, fast draft model guess several tokens ahead. The big model checks all the guesses in one pass and keeps the ones it agrees with, so the text comes out faster while the big model still makes the final call.

11 min readAdvancedCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

I explain speculative decoding as a way to make a language model faster. A big model writes one token at a time, which is slow. So a small, cheap draft model guesses the next few tokens, and the big model checks them all in one pass. It keeps the guesses it accepts and writes a replacement token at the first miss. The big model still makes the final call, so the output has the same odds for each word as before. It helps most when the server has spare room.

What is speculative decoding, in plain words?

A language model writes text one token at a time. A token is a word or a part of a word. Each new token needs one full run of the big model, and the runs happen one after another, so long answers are slow.

Speculative decoding guesses ahead. A small, cheap draft model proposes the next few tokens. The big model then checks them together, in one run, and keeps the ones it would have written too.

Think of a senior claims adjuster checking a junior's work. The junior races through the routine lines. The senior reads the whole batch in one go, keeps what is right, and fixes the first line that is wrong. Here is a realistic case: an insurance claims assistant writes a 300-token summary for an agent during a live call, and nine seconds of silence feels stuck.

Key words

Token
A word or a part of a word, the unit a model writes.
Draft model
The small, cheap model that guesses ahead.
Big model
The large model that makes the final call on every token.
Acceptance rate
The share of guesses the big model keeps. Higher means a bigger speed-up.

How does the guess-and-check loop work?

Each round has four moves. Read the chart from left to right.

One round of speculative decoding

Text so far

everything written up to now

Small draft model

guesses 4 tokens, fast and cheap

Big model

checks all 4 in one pass

Decide each guess

Keep the accepted guesses

guesses the big model accepts

Write the first miss

a replacement token from the big model

Text grows

about 3 new tokens per round

  1. 1The text so far goes to the draft model.
  2. 2Its four guesses go to the big model together.
  3. 3Guesses the big model accepts are kept.
  4. 4At the first miss, the big model writes a replacement token.
  5. 5The kept guesses join the text.
  6. 6The big model's token joins the text too.
Each round, a small draft model guesses four tokens and the big model checks them all in one pass. Guesses it agrees with are kept, and at the first miss it writes its own token. Either way the text grows.
  1. 1

    The draft guesses

    A small model proposes the next few tokens. Some tokens are easy to guess, and guessing is cheap, so this costs little time.

  2. 2

    The big model checks in one pass

    The big model scores every guessed token together, in a single run.

  3. 3

    Keep the accepted guesses

    Guesses the big model accepts stay in the text. A good draft keeps several in a row.

  4. 4

    Fix the first miss

    At the first guess the big model rejects, it writes a replacement token and the rest are dropped. If every guess is accepted, it adds one more token of its own.

Tip

The draft is only a helper. A wrong guess only wastes a little work. The answer stays right, because the big model checks every token.

Why is checking several tokens nearly as cheap as one?

Because the limit is usually memory, not maths. Google's own write-up says the bottleneck (the part that limits speed) in LLM inference (running a model to write its output) is usually memory. It also says the hardware has ample spare computing power while a model generates output. So there is spare room while the big model works through a token, and the extra guesses fit into it.

A 300-token reply, two ways (made-up numbers)

Plain: one pass per token

Big model pass

30 ms, writes one token

Draft and check

Draft 4, check 4

12 ms draft + 30 ms check

300 passes, 9 s

one token per 30 ms pass

100 rounds, 4.2 s

about 3 tokens per round

  1. 1Plain: 300 passes at 30 ms each, about 9 seconds.
  2. 2Draft and check: 100 rounds of 42 ms, about 4.2 seconds.
The same 300-token reply, with made-up numbers. Writing one token per pass takes about nine seconds. Drafting four tokens and checking them in one pass takes about four seconds, because each round yields three tokens.

Worked example, with made-up numbers. The big model takes 30 ms per pass, so the plain way needs 300 passes, about 9 seconds. The draft model guesses 4 tokens at 3 ms each, then the big model checks them in one 30 ms pass. On average it keeps 2 guesses and adds one token of its own, so each round gives 3 tokens. That is 100 rounds of 42 ms, about 4.2 seconds: a speed-up of about 2.1 times.

Python
# Made-up numbers for one 300-token reply: the big model takes 30 ms per pass,
# the draft model 3 ms per guess, and each round guesses 4 tokens.
TOKENS = 300
BIG_MS = 30
DRAFT_MS = 3
GUESSES = 4
KEPT = 2  # guesses the big model keeps, on average

normal_ms = TOKENS * BIG_MS
# Each check also gives one token of the big model's own, so a round adds KEPT + 1.
tokens_per_round = KEPT + 1
rounds = TOKENS // tokens_per_round
round_ms = GUESSES * DRAFT_MS + BIG_MS
spec_ms = rounds * round_ms

print(f"Normal: {normal_ms} ms")
print(f"Speculative: {rounds} rounds x {round_ms} ms = {spec_ms} ms")
print(f"Speed-up: {normal_ms / spec_ms:.1f}x")

Output

Normal: 9000 ms
Speculative: 100 rounds x 42 ms = 4200 ms
Speed-up: 2.1x

Does the output stay the same?

In theory, yes. The big model still tests every token, and a guess is only kept when it passes that test, so the output keeps the same odds for each word as the big model alone. The papers say so directly, and so do the people who run it in production.

  • “an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel.”

    Leviathan, Kalman and Matias, 2022 paper

  • “The algorithm speeds up generation from autoregressive models by computing several tokens in parallel, without affecting output quality; in fact, the method guarantees an identical output distribution.”

    Google Research, 2024 write-up

  • “Speculative decoding sampling is theoretically lossless up to the precision limits of hardware numerics.”

    vLLM documentation

The papers also measured the gain on their own test setups. Leviathan and colleagues reported 2X to 3X on T5-XXL, a large research model from Google, with identical outputs. Chen and colleagues reported a 2 to 2.5 times speed-up on Chinchilla, a 70 billion parameter model (a parameter is one of the learned numbers inside a model), without changing the model. Google says it uses the method in AI Overviews in Google Search.

Tip

Say the honest limit. Hardware maths can nudge results slightly, and the vLLM docs say so (vLLM is an open-source server for running models). Say the same odds, up to rounding on the hardware. Do not promise identical text every time.

Where does it help, and where does it stop?

It helps most when one user waits on a long reply and the hardware has spare room. The vLLM docs describe the aim as lower latency for memory-bound work (work held back by how fast memory can be read) at low to medium request rates. A separate draft model needs its own memory and work, and simpler guessers give only modest gains at peak traffic.

  • Helps

    Long replies, spare room

    A user waits on one long answer while the hardware has idle capacity.

  • Weaker

    Busy peak traffic

    Many requests share the hardware, so there is less spare room and the gain shrinks.

  • Weaker

    Poor guesses

    Free-form writing is hard to guess, so the big model rejects more drafts and the gain falls.

Tip

Measure before you ship. Track the acceptance rate and the time per answer on real traffic. A draft that is rarely kept can cost more time than it saves.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a small model guesses, and a big model checks in one pass.
  • Why it is faster: checking several tokens costs about one pass, because memory is the limit.
  • Why the output stays the same: the big model keeps the final say, with a rounding caveat.
  • When it helps: long replies, spare capacity and a draft that often matches.
  • When it doesn't: busy peaks, poor guesses and the extra memory for the draft.
  • A plan to measure acceptance and time per answer on real traffic before rollout.

Common traps

  • Trap"The small model writes the answer, and the big one just approves it."

    BetterThe big model decides every token. The draft only proposes, and a wrong guess is thrown away.

  • Trap"It makes the model smaller, so it gets less accurate."

    BetterNothing shrinks. The same big model runs, and the draft is a separate helper.

  • Trap"It always makes things faster."

    BetterOnly with spare capacity and good guesses. At peak load and with poor drafts, the gain shrinks.

Can you spot the mistake?

Spot the mistake

A team adds a draft model to its claims summariser. Which plan is sound?

Quick check

Your summariser gets no faster at peak hours, even with speculative decoding on. What is the likeliest reason?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q316TTFT vs tokens/sec vs total latency?12 min
  2. Q317The latency vs throughput trade-off?10 min
  3. Q320Serving engines (vLLM, SGLang, TensorRT-LLM, llama.cpp)?11 min
  4. Q322What is model routing (cascades)?12 min
  5. Q327GPU basics: why does memory bandwidth limit decoding?11 min

Last updated on 27 November 2026

Building an AI feature that has to answer faster?

I design and build AI products and agents, including the speed and cost side. Book a short call and tell me what your users wait for.