Speculative Decoding: Exact Sampling With a Draft Model
An interactive live film: drag the draft distribution q as 3D bars and watch the accepted mass min(p, q) plus the residual (p - q)+ rebuild the target p exactly, with 2000 simulated tokens and the acceptance rate 1 - TV(p, q) updating live.
Narration
Here are six tokens. The blue bars at the back are the large model's next token distribution p. The orange bars in the middle are the draft model's distribution q.
The draft proposes a token from q, and we accept it with probability the minimum of one and p over q. So the accepted mass at each token is the minimum of p and q: the green part of each middle bar. The red part on top is rejected.
The rest of the narration is in the book's Companion.
More from Chapter 18
Interactive1:22Langevin Sampling: Drift Uphill, Kick at RandomChapter 18
Preview1:24Metropolis-Hastings: A Random Walk That SamplesChapter 18
Preview1:42MALA: Removing Discretization Bias with Accept-RejectChapter 18
Preview1:40Underdamped Langevin and HMC: Momentum-Driven ExplorationChapter 18
Preview1:29Langevin Dynamics and SGLD: Sampling vs OptimizationChapter 18