Speculative Decoding
Chapter 18: Langevin Dynamics and Sampling — Speculative Decoding
From the book
Chapter 18: Langevin Dynamics and Sampling. In the chapter mind map this icon labels Speculative Decoding: Acceptance $1 - \mathrm{TV}(p, q)$. The discussion below is excerpted and lightly edited from § Speculative Decoding with a Draft Model in Mathematics for AI and Machine Learning.
A language model generates text one token at a time, and each token costs a forward pass of a large model with next-token distribution $p$. A much smaller draft model with distribution $q$ is cheap to run. Speculative decoding lets the draft propose tokens and the large model accept or replace them, in such a way that the output distribution is still exactly $p$. Write $\|p - q\|_{\mathrm{TV}} = \frac12 \sum_x |p(x) - q(x)|$ for the total variation distance and $(z)_+ = \max(z, 0)$.
What this drawing shows
What you see. Shows draft tokens accepted up to a verification point while later drafts stay unconfirmed, representing speculative decoding.
In the mind map. Chapter 18 — Speculative Decoding: Acceptance. See From the book above for definitions, figures, and worked examples.
Where to read next
Read the full definitions, figures, and worked examples in Chapter 18: Langevin Dynamics and Sampling — see the mind-map node Speculative Decoding: Acceptance.