The static method
The straightforward method, based on Leviathan et al., uses a static value of the speculation lookahead and involves generating a constant number of candidate tokens at each speculative iteration. [1]
The heuristic-based approach
Alternatively, a heuristic-based approach adjusts the number of candidate tokens for the next iteration based on the acceptance rate of the current iteration. [2]
What happens to candidate tokens
If all speculative tokens are correct, the number of candidate tokens increases; otherwise, it decreases. [3]
Sources
- The Hugging Face source says: The straightforward method, based on Leviathan et al., uses a static value of the speculation lookahead and involves generating a constant number of candidate tokens at each speculative iteration. Faster Assisted Generation with Dynamic Speculation
- The Hugging Face source says: Alternatively, a heuristic-based approach adjusts the number of candidate tokens for the next iteration based on the acceptance rate of the current iteration. Faster Assisted Generation with Dynamic Speculation
- The Hugging Face source says: If all speculative tokens are correct, the number of candidate tokens increases; otherwise, it decreases. Faster Assisted Generation with Dynamic Speculation