Repository navigation
[Spec Decode] Reduce TP communication for speculative decoding draft token generation - #34049
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an efficient local argmax reduction strategy for speculative decoding, aiming to reduce communication overhead across tensor parallel ranks. The changes are well-implemented, gated by a new configuration flag, and include appropriate fallbacks and user warnings. My review identifies one critical issue where a negative logit scaling factor could lead to incorrect behavior in the new optimization path. Otherwise, the changes look solid and improve performance as intended.
|
Hi @zixi-qi, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
2d8c9b9 to
d53c172
Compare
|
cc @houseroad could you take a look when you get a chance? Thx a lot! |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: qizixi <qizixi@meta.com>
d53c172 to
09ccb68
Compare
|
Rebase and resolve merge conflict |
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
May I ask which senario people will use large batchsize in spec decoding? |
Generally speaking when batch size is large, speculative decoding is less helpful, but the exact break even point varies based on the base model, hardware, draft model accuracy etc. So there are certain scenarios where this optimization comes in handy. |
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
…token generation (vllm-project#34049) Signed-off-by: qizixi <qizixi@meta.com> Co-authored-by: Lu Fang <30275821+houseroad@users.noreply.github.com>
Purpose
Reduce TP communication overhead in Eagle speculative decoding by replacing the all-gather of full vocabulary logits with a local argmax + gather reduction.
Problem
During draft token generation, Eagle speculative decoding all-gathers the full logits tensor across TP ranks — O(batch_size × vocab_size) data per step. For large vocabularies (e.g., 200K+ tokens in Llama 4), this becomes unnecessary overhead since only the argmax token ID is needed for greedy draft selection.
Solution
Add a use_local_argmax_reduction option to speculative_config that:
Test Plan
Benchmarked on Llama4 Maverick + EAGLE and observed on par draft acceptance rate + small improvement on TTIT. Generally this optimization is helpful when batch_size * draft_vocab_size is sufficiently large, when bs is small or draft model has smaller vocabulary the gains would become marginal, so default to False.
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.