Speculation decoding: how to align the draft with precision correction
Speculation decoding uses cheaper draft models to produce multiple tokens, which are then validated by target model batches.
Learning objectives and first steps2 objectives . 1 first fix
Try to do it after reading
- Explanatory speculative decoding: mechanisms and prerequisites proposed in the draft for precise corrections
- Positioning the mechanism ' s fault limits with fixed examples
Suggested first
- Conditions for sampling and acceptance of rejection
Issues and mechanisms
Speculation decoding uses cheaper draft models to produce multiple tokens, which are then validated by target model batches. If the re-sampling rules are accepted and rejected correctly, the target distribution can be maintained while reducing the number of lines called by expensive target models. The core is not to make the large model ' s draft simple judgement seem reasonable, but to comply with probabilities correction; The deletion of the correction step changes the output distribution.
For a draft item x, the acceptance rate can be described as one and p(x) divided by the smaller of q(x) when the probability of the draft is q and the target probability p is known. Re-sampling after rejection from surplus quality beyond the target draft and continuing as algorithms. The closer the drafts approach the target, the more acceptances are generally accepted, but the actual acceleration depends on the cost of the drafts, the amount of authentication batches, memory and dispatch.
A concrete example
Synthesis of two distributions q = [0.8, 0.2], p = [0.6, 0.4]. The draft proposed a acceptance rate of 0.75 for the first and one for the second. The acceptance quality is 0.6 and 0.2, respectively, and the remaining denial quality is 0.2 to be added to the second and the ultimate goal is restored [0.6 and 0.4]. If all drafts are accepted directly, the result remains q, not the target distribution; These two examples allow for independent scrutiny of the need for correction.
Borders and checks
The zero probability item of the draft would not be proposed in the draft, but the remaining sampling would still need to properly cover the target quality. Temperatures, cut-offs and verbs must be treated according to compatible definitions. The mathematical distribution does not mean that every random output is word for word; Real floating points and achievement differences are subject to tolerance and distribution tests.
A method of verification
The verification algorithms can first list the proposed and rejected paths in two and three discrete distributions, calculating whether the final mass is accurately returned to the target distribution, rather than simply comparing sampling frequencies. The probability of adding a draft is zero and the target is positive, checking if the remaining samples are covered. Performance assessments are made separately to record the cost of drafts, the length of acceptance and the number of target calls; The correct distribution of mathematics and the actual acceleration are two independent acceptances that cannot be substituted for each other.
Check understanding
The draft is fast, but the acceptance rate is low. Is there any acceleration?
Not necessarily. The draft and the certified costs may be used in excess of the goal of savings and the first, ingestion and total time should be measured under the same conditions of generation.
Is maintaining target distribution equal to the same sentence per output?
No, it's not. (a) The same distribution of permitted different random samples; The word-for-word consistency also relies on random numerical coupling and practical realization, and the probability conclusion cannot be expressed as the same for all run-by tracks.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.