How speculative decoding speeds up generation
Autoregressive decoding runs the large target model once per token, and each run is limited mostly by memory bandwidth, not arithmetic. Speculative decoding lets a small draft model propose gamma tokens, then the target model scores all of them in one parallel forward pass. Drafted tokens are accepted left to right with a rejection sampling rule that keeps the output distribution identical to the target model, so quality does not change.
Every step yields at least one token, because when a draft token is rejected the target model samples a corrected token in its place. When all gamma drafts are accepted, the step yields gamma + 1 tokens. The calculator turns three numbers into an expected speedup: the acceptance rate alpha, the draft length gamma, and the cost coefficient c, which is the time for one draft forward pass divided by the time for one target forward pass.