All glossary terms

Efficiency

Speculative decoding

A cheap draft model proposes several tokens and the main model verifies them in one pass, so a step can emit more than one token while the wording stays exact.

Normal decode produces one token per forward pass, which is slow because every pass pays the full cost of reading the model. Speculative decoding notices that the pass is mostly a memory read, not math: a batch of 8 positions through the same weights costs nearly the same time as 1 position. So let a small draft model guess the next few tokens, then verify all of them through the big model in one pass.

Verification is the part that keeps the output honest. The big model scores every drafted token in that one pass; a token that matches what the big model would have preferred is accepted, the first mismatch ends the block, and the corrected token plus one extra replaces the rejected tail. The published guarantee is that the output distribution matches plain decoding of the big model: it is the same text you would have gotten, just reached faster.

The gain has a ceiling: acceptance rate times draft length, minus the cost of running the draft and the extra memory traffic of verification. It pays most when there is bandwidth headroom, which is why it is a favorite interview question for serving roles: the right answer is about where the idle bandwidth is, not about the draft model being clever.

Practical details worth being able to name: the draft must be genuinely cheap relative to the target; long draft blocks waste more when acceptance is low; and tree-shaped proposals (several candidate continuations verified at once) raise the expected accepted tokens per pass at the cost of more complex verification.

A worked example

A large model decodes alone at 24 tokens per second. A small draft proposes 3 tokens per step, and 70 percent of draft tokens get accepted. The draft is cheap enough that its cost is folded into the final numbers below.

  1. Expected tokens accepted per verify step, bonus token included: 1 + 0.7 + 0.7^2 + 0.7^3 = 2.53.
  2. Theoretical ceiling: 24 x 2.53 = about 61 tokens per second.
  3. Real runs give back a share for the draft pass and the wider verify batch: a realistic gain with a small draft is 1.5x to 2x, so 24 becomes roughly 40.

Speculation converts idle memory bandwidth into throughput, and the text is unchanged - every proposal passes through the real model before it ships.

Where this shows up

Test yourself

Related terms