Speculative Decoding

Layer 4 · Foundations

Speculative Decoding

Proving speculative decoding is exactly lossless, and modeling its expected speedup.

15 min read180 XP

Claim

  • Accepted/resampled tokens
  • Have distribution p (target model)
  • For every position, exactly

Proof idea

  • Decompose p as accept-mass + residual-mass
  • Rejection sampling recovers p exactly
  • True regardless of how good q is
What we're proving and how.

Claim: for any draft distribution and target distribution over the same support, the token produced by (a) sampling , (b) accepting with probability , and on rejection (c) sampling instead from the normalized residual , has distribution exactly — regardless of how good or bad is.