[Hybrid] Simplify accepted token counting in spec decode for hybrid models#38372
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request simplifies the logic for counting accepted tokens in the GPUModelRunner class. The change replaces a complex operation involving tensor concatenation and argmax with a more efficient and readable summation of non-negative-one values in the output_token_ids tensor. I have no feedback to provide.
…odels Replace the concatenate-sentinel-then-argmax approach with a simple sum of valid tokens. Since rejected tokens are marked with -1 and valid tokens are always contiguous from position 0, counting non-(-1) tokens directly gives the number of accepted tokens. This eliminates unnecessary memory allocation (torch.cat, torch.full) and is more readable. Signed-off-by: Francesco Fusco <ffu@zurich.ibm.com>
285faa0 to
fa04e18
Compare
zxd1997066
pushed a commit
to zxd1997066/vllm
that referenced
this pull request
Apr 15, 2026
…odels (vllm-project#38372) Signed-off-by: zengxian <xiangdong.zeng@intel.com>
whk-lab
pushed a commit
to whk-lab/vllm
that referenced
this pull request
Apr 23, 2026
avinashsingh77
pushed a commit
to avinashsingh77/vllm
that referenced
this pull request
Apr 27, 2026
…odels (vllm-project#38372) Signed-off-by: Avinash Singh <avinashsingh.rcoem@gmail.com>
mystous
pushed a commit
to mystous/vllm_hybrid
that referenced
this pull request
May 10, 2026
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
jhu960213
pushed a commit
to jhu960213/vllm
that referenced
this pull request
May 20, 2026
mvanhorn
pushed a commit
to mvanhorn/vllm
that referenced
this pull request
Jun 4, 2026
…odels (vllm-project#38372) Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Replace the concatenate-sentinel-then-argmax approach with a simple sum of valid tokens. Since rejected tokens are marked with -1 and valid tokens are always contiguous from position 0, counting non-(-1) tokens directly gives the number of accepted tokens.
This eliminates unnecessary memory allocation (torch.cat, torch.full) and is more readable.
Test Plan
Correctness test:
Latency test:
Serving benchmark with server:
and client:
Eval:
Running the gsm8k config from this pr
Test Result
main:this branch:Latency
main:this branch:Main results:
Accuracy on GSM8k
main:this
branch:Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.