Performance Highlights
Please see below for the huge improvements on throughput for LLaMA-Instruct 3.1 8B tested on MT bench that can be achieved via EAGLE3 decoding. For further details please see the EAGLE3 paper.| Method | Throughput (tokens/s) |
|---|---|
| SGLang (w/o speculative, 1x H100) | 158.34 tokens/s |
| SGLang + EAGLE-2 (1x H100) | 244.10 tokens/s |
| SGLang + EAGLE-3 (1x H100) | 373.25 tokens/s |
EAGLE Decoding
To enable EAGLE speculative decoding the following parameters are relevant:speculative_draft_model_path: Specifies draft model. This parameter is required.speculative_num_steps: Depth of autoregressive drafting. Increases speculation range but risks rejection cascades. Default is 5.speculative_eagle_topk: Branching factor per step. Improves candidate diversity, will lead to higher acceptance rate, but more lead to higher memory/compute consumption. Default is 4.speculative_num_draft_tokens: Maximum parallel verification capacity. Allows deeper tree evaluation but will lead to higher GPU memory usage. Default is 8.
--cuda-graph-max-bs to be a small value for faster engine startup. For your own workloads, please tune the above parameters together with --cuda-graph-max-bs, --max-running-requests, --mem-fraction-static for the best performance.
EAGLE-2 decoding
You can enable EAGLE-2 decoding by setting--speculative-algorithm EAGLE and choosing an appropriate model.
EAGLE-2 Decoding with torch.compile
You can also enable torch.compile for further optimizations and optionally set --torch-compile-max-bs:
EAGLE-2 Decoding via Frequency-Ranked Speculative Sampling
By employing a truncated high-frequency token vocabulary in the draft model, Eagle speculative decoding reduceslm_head computational overhead while accelerating the pipeline without quality degradation. For more details, checkout the paper.
In our implementation, set --speculative-token-map to enable the optimization. You can get the high-frequency token in FR-Spec from this model. Or you can obtain high-frequency token by directly downloading these token from this repo.
Thanks for the contribution from Weilin Zhao and Zhousx.
EAGLE-3 Decoding
You can enable EAGLE-3 decoding by setting--speculative-algorithm EAGLE3 and choosing an appropriate model.
Multi Token Prediction
We support MTP(Multi-Token Prediction) in SGLang by using speculative decoding. We use Xiaomi/MiMo-7B-RL model as example here (deepseek mtp usage refer to deepseek doc)References
EAGLE process is as follows:- Within EAGLE the draft model predicts the next feature vector, i.e. the last hidden state of the original LLM, using the feature sequence and the token sequence .
- The next token is then sampled from . Afterwards, the two sequences are extended in a tree style—branching out multiple potential continuations, with the branching factor per step controlled by the
speculative_eagle_topkparameter—to ensure a more coherent connection of context, and are given as input again. - EAGLE-2 additionally uses the draft model to evaluate how probable certain branches in the draft tree are, dynamically stopping the expansion of unlikely branches. After the expansion phase, reranking is employed to select only the top
speculative_num_draft_tokensfinal nodes as draft tokens. - EAGLE-3 removes the feature prediction objective, incorporates low and mid-layer features, and is trained in an on-policy manner.
