In this article
Preserving the target distribution requires both a probability-based acceptance rule and the appropriate correction after rejection; agreement checking alone is insufficient.
A draft model can propose several tokens that a target model evaluates together. The subtle part of speculative sampling is not merely checking whether the target likes those tokens. Acceptance and correction must be designed so the final sample follows the intended target distribution under the algorithm’s assumptions.
The draft proposes under its own probabilities
The draft samples a candidate continuation from its distribution conditioned on the current prefix and earlier draft choices. The target computes corresponding conditional probabilities for the proposed positions. These are distinct distributions, even when their most likely token agrees. A fast draft can differ substantially in how much mass it assigns to alternatives. The algorithm must account for those probabilities rather than treating every proposed token as equally likely or substituting a simple semantic approval of the generated phrase.
Acceptance uses the target-to-draft ratio
For a proposed token with draft probability q and target probability p, the classical speculative-sampling acceptance probability uses the smaller of unity and p divided by q, under the formulation’s conditions. This corrects for tokens overrepresented by the draft. A target-favored token can be accepted with certainty, while an overproposed token is accepted only sometimes. The rule is probabilistic, not the same as keeping a token whenever it belongs to the target’s top candidates. The exact transformed distributions must match the declared decoding policy.
A rejection needs residual sampling
When a proposal is rejected, simply drawing again from the original target distribution would generally be the wrong correction for the mass already handled by acceptance. The classical method samples from an appropriately normalized positive residual of target minus draft probabilities at that position. Later unverified draft tokens are discarded because their prefix no longer applies. This residual step is central to the distribution-preservation argument. It is different from choosing the target’s largest logit after every disagreement, which would implement another decoding procedure.
Correctness and acceleration are separate observations
The paper establishes a sampling construction under its assumptions; a serving implementation must reproduce the relevant probability transformations and prefix bookkeeping. Validate a small synthetic vocabulary statistically and inspect rejection handling before measuring runtime. Acceptance rate, draft cost, verification cost and workload determine practical acceleration. Mathematical distribution preservation does not promise a universal speedup or bitwise identical random sequences to ordinary decoding. It identifies the target law of the output, while numerical implementation and performance require their own checks.
Primary research and implementation references
Related engineering context
Reproducible inference stacks: preserving a GPU pilot’s result; A GPU inference benchmark you can trust.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.