Visual walkthrough — Speculative decoding
Prerequisite ideas we lean on: 3.1.2-Transformer-architecture (what "the model outputs a probability for the next word" means) and 5.3.2-Knowledge-distillation (how the draft model is made to agree with the target).
Step 1 — A probability distribution is a set of bar heights
WHAT. When a language model reads "The capital of France is", it does not output one word. It outputs a number for every possible next word — how likely that word is. Those numbers are all positive and add up to . We call this collection a distribution.
We write for the height of the bar over word in the target (big, correct) model. We write for the same word's bar height in the draft (small, fast) model.
WHY these letters. = the distribution we are allowed to call correct (the expensive model we actually want). = the distribution we can sample from cheaply. The whole game is: sample from , but end up with samples that look like they came from .
PICTURE. Look at the two rows of bars. Same words on the x-axis, different heights. The target (red) is what truth looks like; the draft (black) is our cheap guess. They disagree — that disagreement is the entire problem.

Step 2 — Sampling from overshoots and undershoots
WHAT. If we just keep every word the draft proposes, our output distribution is , not . Compare the two heights word by word and one of two things is true:
- : the draft proposes this word too often (its bar is taller than truth).
- : the draft proposes this word too rarely (its bar is shorter than truth).
WHY this split matters. These two cases need opposite fixes. Where the draft is too eager we must throw some proposals away. Where the draft is too shy we must manufacture extra proposals. Every later step is just one of these two repairs.
PICTURE. The red curve is , the black curve is . Shade where black pokes above red (draft too eager — overshoot) and where red pokes above black (draft too shy — undershoot). Those two shaded regions must have exactly equal area, because both curves sum to .

Step 3 — The accept rule fixes the overshoot
WHAT. After the draft hands us a word , we accept it with probability
WHY this exact formula. We want the kept proposals of word to have height exactly . The draft delivers word with height . So we must keep a fraction of them: The is only there because a probability cannot exceed : when (undershoot) the ratio is bigger than , so we clip it to — meaning keep all of them, we can never keep more than the draft gave us. That leftover deficit is Step 4's job.
PICTURE. Take the black draft bars. Over each word, chop them down to the red line if the red line is lower (overshoot fixed). Where red is above black, keep the whole black bar — you still fall short of red. The kept (shaded) region now hugs , the lower of the two curves.

Step 4 — Rejection buys us a second draw from the deficit
WHAT. Accepting gives us the shaded lower curve . Truth is . The gap left over, word by word, is Whenever we reject, we throw the proposed word away and instead sample a fresh word from exactly this leftover shape:
WHY this shape. The numerator is precisely the red undershoot region from Step 2 — the words truth wanted but the draft under-supplied. The denominator is just its total area, dividing so the new bars sum to (a legal distribution). We only reach this branch on a rejection, and rejections happen exactly often enough to fill the gap — that is what Step 5 verifies.
PICTURE. The red curve minus the already-accepted grey region leaves a sliver — the accent-red patch sitting over the undershoot words. That sliver, rescaled to area , is the distribution we resample from. Notice it lives only where : rejection never resamples a word the draft was already over-supplying.

Step 5 — Add the two branches: the heights become exactly
WHAT. For any word , there are exactly two ways it can end up as our output:
- The draft proposed and we accepted it — contributes (Step 3).
- We rejected whatever was proposed, then resampled from the sliver — contributes .
Add them:
WHY it collapses. Look at the identity for any two numbers:
- If : , , sum .
- If : , , sum .
Either way the sum is . With this is for every word, in both the overshoot and undershoot case. The draft cancels out completely.
PICTURE. Stack the grey accepted region and the red resampled sliver on top of each other. Overshoot words: fully covered by grey alone. Undershoot words: grey (up to ) plus red sliver (the rest up to ). The two colours together trace the red target curve exactly — no gaps, no overhang.

Step 6 — Degenerate cases, so nothing surprises you
WHAT / WHY / PICTURE, three edge scenarios in one figure:
- Perfect draft, . Overshoot and undershoot vanish. everywhere — every token accepted, zero rejections. Maximum speed, and Step 5 trivially gives .
- Draft never proposes the truth's favourite word ( where ). That word can only ever arrive through the resample branch: keeps it in the sliver. The rule still reaches it — just always via rejection. Nothing truth wants is unreachable.
- Draft is confident garbage ( tall where ). Then , so — almost always rejected. We fall back to resampling from 's sliver, which here is essentially itself. Correct output, no speedup — exactly the "worst case = normal decoding" promise.

The one-picture summary
Everything above compressed into a single stacked bar over one word: the black draft bar , chopped to by the accept test (kept, grey), topped by the red resample sliver — the two pieces summing to the red target line .

Recall Feynman retelling — say it back in plain words
The big model is slow but right; the small model is fast but sloppy. We let the small model blurt out a word. Then we hold its guess up against the big model's own opinion for that word. If the big model likes the word at least as much as the small model did, we keep it. If the big model likes it less, we flip a biased coin — keep it only with probability (big's liking ÷ small's liking) — and if the coin says no, we throw the word out and instead pick a fresh word from a special leftover pile. That pile contains exactly the words the big model wanted more than the small model offered, and nothing else. Add up "words we kept" plus "words we pulled from the leftover pile," and by a tiny algebra fact — — you land exactly on the big model's own distribution. The small model has cancelled out. So we get the big model's answers, but most of the time for the price of the small model's speed. A hopeless small model doesn't corrupt the answer — it just makes us throw more words away, so we run slower, never wronger.
Recall Check yourself
Where does a word with but come from? ::: Only from the resample branch — the accept branch needs the draft to propose it, which it never does; the sliver carries it. Why is there a instead of just ? ::: Because in undershoot regions, and you cannot keep a larger fraction of proposals than you were given; you cap at "keep all of them." What does a perfect draft do to the acceptance rate? ::: Makes it everywhere — nothing is ever rejected, maximum speedup.