AI Glossary

Speculative Decoding

Speculative decoding drafts future tokens with a cheaper proposal process and checks them with a target model. Accepting several draft tokens from one target-model pass can reduce sequential generation work.

· Updated · Chain of Thought

AI InfrastructureModel Architecture

A draft model proposes a short continuation. The target model computes the distributions needed to verify those positions in one pass. The procedure accepts a prefix; at the first rejection it discards the rejected token and everything after it, then generates a replacement. Later proposals depend on the rejected context and cannot simply be kept.

For example, in greedy decoding the draft proposes A, B, C. If A and B match the target’s choices but C does not, keep A and B and use the target’s choice D at that position. This illustrates greedy verification, not the stochastic acceptance rule. The original exact sampling algorithm uses probability-based acceptance and a corrected replacement distribution to preserve the target’s sampling distribution.

Measure total runtime, including drafting and verification. Low acceptance or extra overhead can erase a speedup. Speculation changes the computation path; it does not improve the target’s evidence or spend test-time compute exploring better answers.

Keep the prefix; discard the rejected suffixA draft proposes A, B, C and E. One target-model verification pass accepts A and B, rejects C and discards E because E depended on C. The target’s replacement is D, so the emitted sequence is A B D. The next drafting round starts from that accepted and corrected prefix. Keep the prefix; discard the rejected suffixIllustrative greedy verification; tokens A, B, C and E are placeholders 1. Draft proposalABCE2. One target pass computes distributions to verify the draft positionsA: acceptB: acceptC: rejectReplace with DE: discardDepends on C3. Emit A B D; start the next draft from this corrected prefix.Total latency includes drafting and verification. Acceptance alone is not a speedup.
A greedy teaching example. Exact stochastic speculative sampling uses probability-based acceptance and a corrected replacement distribution; this diagram is not that sampling rule. Download the image

Sources

Go deeper