LLM Kitchen
Explanations

Part V · Putting it together

Ch 14. Guessing ahead

One token per pass

A model writes one token per pass, and each pass reads every one of its weights from memory, which takes most of the time.[1] But one pass can check many tokens at once: it predicts what comes next after every position, and reading a few more tokens costs a big model about the same as reading one.

A model writes one token per pass through all its blocks (Ch 11), and each pass has to read every weight from memory. For a big model, most of the time goes into that reading, not the arithmetic.[1][1] So a big model writing 30 tokens reads all its weights 30 times, even for the easy ones, like the next number in “one, two, three”.

Here is the trick that helps. In one pass, a transformer doesn’t only predict the token after the last one: it predicts the next token after every position at once. That is how it reads a whole prompt in one go. Reading a few more tokens costs a big model about as much as reading one, because the weights are read once either way.

Guess, then check

So let a small, fast model guess the next few tokens, and let the big model check them all in one pass. It keeps the guesses up to the first one it disagrees with, and puts its own token there. This is .[1][2] Below, GPT-2 small guesses four tokens at a time for GPT-2 medium:

So let a small, fast model guess. It writes the next few tokens on its own, cheaply. Then the big model reads the text plus all the guesses in one pass, and at each position it compares its own top token with the guess. It keeps the guesses up to the first one it disagrees with, swaps that one for its own token, and drops the rest. If every guess matches, it adds one more token of its own. This is .[1][1][2][2] Below, GPT-2 small (124 million weights) guesses four tokens at a time for GPT-2 medium (355 million). Both use the same tokens, which the trick needs:

Step through

A small model guesses, a big one checks

Recorded · GPT-2 small and GPT-2 medium

The cat sat on the floor, staring

Pass 1: GPT-2 small guesses 4 tokens, GPT-2 medium checks them all at once

  1. ·floor kept
  2. , kept
  3. ·and wrong
  4. ·the dropped
  5. ·staring GPT-2 medium's own

The first 2 guesses match. At the first wrong one, GPT-2 medium writes ·staring instead and drops the rest: 3 tokens from one pass.

3 tokens in 1 pass of GPT-2 medium; without the drafter, 3 passes.

Step 1 of 7 or use ← → keys

Pass 1 of 7

Every pass still adds at least one token. For “The cat sat on the”, GPT-2 medium wrote 30 tokens in 7 passes instead of 30. And the text is exactly what the big model would have written alone, because it checks every token.

Every pass of the big model adds at least one token, its own, so it is never slower in passes than writing alone. When the guesses are good it adds up to five. For “The cat sat on the”, GPT-2 medium wrote 30 tokens in 7 passes instead of 30. Counting (“six, seven, eight, …”) is easy for the small model too: 7 passes. “The capital of France is” took 9, because two of the small model’s first guesses were wrong.

And the text is the same, token for token, as GPT-2 medium writing alone. The big model checks every token and only keeps a guess that is exactly what it would have picked. The drafter only changes how many passes it takes. When the model samples instead of always picking the top token (Ch 2), a slightly different rule accepts or replaces each guess at random so that every token still comes out with exactly the big model’s probabilities.[1][1][2][2]

The rules, written down

When sampling, the big model’s probabilities are p and the drafter’s are q. A guessed token x is kept with chance

min⁡(1,p(x)q(x))

and if it’s rejected, the replacement is drawn from max⁡(0,p−q), rescaled to add up to 1. Tokens the drafter overrates are sometimes thrown back, tokens it underrates are made up for in the replacement, and every token comes out with exactly the chance p gives it.[1][2]

How much this saves depends on how often guesses are kept. If each guess is kept with chance α, independently, and the drafter guesses k tokens, a pass of the big model adds on average

1−αk+11−α

tokens, between 1 and k+1.[1] With α=0.8 and k=4, that’s about 3.4. The cat run above averaged about 4.3 of a possible 5.

In real models

On real hardware this makes big models write about two to three times faster, with identical text.[1][2] Some model families ship their own small guessers, like Google’s Gemma 4 models with -assistant in the name.[3]

On real hardware this makes big models write about two to three times faster with identical output.[1][1][2][2] Some model families ship their own small drafters. Google’s Gemma 4 models have matching drafters named with -assistant, from 78 million to half a billion weights, and the model card reports up to three times faster writing.[3][3] They guess several tokens ahead for their big model, which is why the card calls them multi-token prediction drafters.

Recipe card

Recap

  • A big model spends most of each pass reading its weights, and one pass can check many tokens.
  • In speculative decoding, a small model guesses a few tokens and the big model checks them all at once, keeping the ones it agrees with.
  • Each pass adds at least one token, and the text is exactly what the big model would write alone.
  • Real systems report writing about two to three times faster; Gemma 4 ships drafters named -assistant.
  • A guess is kept with chance min⁡(1,p/q); a pass adds (1−αk+1)/(1−α) tokens on average.

Next question: bigger, smaller, or faster, a base model is still just continuing text. How does it become an assistant that answers questions?

Sources

  1. Yaniv Leviathan et al. (2023). Fast Inference from Transformers via Speculative Decoding. ICML.
  2. Charlie Chen et al. (2023). Accelerating Large Language Model Decoding with Speculative Sampling. arXiv.
  3. Google DeepMind (2026). Gemma 4 MTP drafter model card (google/gemma-4-E2B-it-assistant). Hugging Face. Accessed October 23, 2026.

Sources

  1. Yaniv Leviathan et al. (2023). Fast Inference from Transformers via Speculative Decoding. ICML.
  2. Charlie Chen et al. (2023). Accelerating Large Language Model Decoding with Speculative Sampling. arXiv.
  3. Google DeepMind (2026). Gemma 4 MTP drafter model card (google/gemma-4-E2B-it-assistant). Hugging Face. Accessed October 23, 2026.

Sources

  1. Yaniv Leviathan et al. (2023). Fast Inference from Transformers via Speculative Decoding. ICML.
  2. Charlie Chen et al. (2023). Accelerating Large Language Model Decoding with Speculative Sampling. arXiv.
  3. Google DeepMind (2026). Gemma 4 MTP drafter model card (google/gemma-4-E2B-it-assistant). Hugging Face. Accessed October 23, 2026.