Clarifications
Hi Weilin,
Thank you for your interest and careful reading of our work! We want to clarify a few things:
1. **Medusa speedup:** The 6x for Medusa in HuggingFace is an upper bound, since 6 tokens could be maximally accepted if things would work perfectly with zero overhead. We don’t report a concrete number because [1] did not opensource their model and only ran it in (yet) another optimised framework and on different hardware, resulting in the 1.9x number we report. We mark it with an asterisk for these reasons. We thus don’t recommend comparing things directly using the 6x number.
2. **Reversing speedups:** We agree that at first it seems counter-intuitive that the trend reverses for the 70B target case, where Eagle speedups become worse in *gpt-fast*, while judge-decoding becomes faster. The driving factor in these speedup numbers is the discrepancy between draft and target speed, which changes in surprising ways when switching between frameworks.
**In short:** 405B/8B latency gap reduces when compiling, while the gap of 70B/8B increases when compiling, thus leading to the reversed speedups.
We will explain in more detail below:
- **8B/405B**: 405B is extremely slow in HF, leading thus to a large discrepancy to 8B even without compiling (in contrast to the 8B/70B setup). As a consequence our approach enjoys large speedups since we have a large discrepancy between target and draft. When compiling, both 8B and 405B become significantly faster in isolation (as expected). However, 405B enjoys even more speedup than 8B (we’re not entirely sure why but HF is probably not optimised for this size) , which thus leads to a **reduction** in terms of the speedup ratio, since the discrepancy between 8B and 405B is smaller now. Medusa or Eagle heads on the other hand don’t become much faster due to compilation since they’re very small models to begin with and not much overhead needs to be removed. In their cases, only the target model becomes significantly faster, reducing thus speedup numbers. This is consistent with results reported in Eagle [2], where speedup numbers reduced from 2.8x to 1.5x when compiling and quantising. [1] also finds a speedup of 1.9x in case of Medusa when compiling, which most likely is smaller than the one in HF.
- **8B/70B**: In HF, counter-intuitively, the latency gap between 70B and 8B is small. This is because both models are bottlenecked by CPU instructions at very small batch sizes. This is why SD and JD enjoy little speedups here; the draft is simply too slow compared to the target, as observed in many previous works for standard SD as well. This issue does not apply for Eagle; the very small module on top does run faster than the target even in HF and it thus dominates in this regime. When compiling the models, CPU-bound issues are removed and 8B runs significantly faster than 70B, leading to a **larger** latency gap. This leads to an improvement in the speedup numbers both for our JD approach and standard SD as well. This is consistent with results reported in the repo *gpt-fast* (https://github.com/pytorch-labs/gpt-fast), where 70B can be sped up by 2x using 8B as target, in contrast to the usual results that report 1.4x when using HF in this scenario (see e.g. [5]). Recall that in case of 405B, the target improved significantly more due to compilation than 8B did, which is why speedup numbers went down in this case. For Eagle on the other hand, again, compilation mainly benefits the target since the draft was already fast, leading thus to a reduction in speedup. Similarly, [1] find a speedup of 1.45x for Medusa for 70B, which again most likely is significantly smaller than speedups in HF (e.g. [3] reports a speedup of 2.83x in case of Vicuna-13B, there is unfortunately no larger model reported).
3. **Medusa for 70b**: This is a good point but we’re not aware of a publicly available version for Medusa in case of the 70B version. The same work by NVIDIA [1] that we cite for the 405B version does show speedup numbers also for 70B, which roughly are 1.45x when compiled. As expected based on prior work, the speedup is worse compared to our results for Eagle. We’re happy to further include this number too if this is helpful.
Thank you for pointing out the useful baseline from [4]. We hope to include it in the next version of our paper.
We’re happy to rectify any mistake if there are better known speedup numbers when compiling!
[1] https://developer.nvidia.com/blog/low-latency-inference-chapter-1-up-to-1-9x-higher-llama-3-1-performance-with-medusa-on-nvidia-hgx-h200-with-nvlink-switch/
[2] *EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty*, Li et al., 2024
[3] *MEDUSA: Simple LLM Inference Acceleration Framework with Multiple
Decoding Heads*, Can et al., 2024
[4] *Fast inference from transformers via speculative decoding*, Leviathan et al., 2023
[5] EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees, Li et al., 2024