[Security] Reject non-finite temperature and repetition_penalty values#45116
Merged
vllm-bot merged 1 commit intoJun 11, 2026
Merged
Conversation
Add math.isfinite() validation for temperature and repetition_penalty in SamplingParams._verify_args(). NaN and Infinity bypass comparison operators (< , >) in Python's IEEE 754 semantics, allowing them to propagate to GPU sampling kernels where they cause undefined behavior or CUDA crashes. Signed-off-by: Juan Perez de Algaba Sierra <jperezde@redhat.com> Signed-off-by: jperezde <jperezde@redhat.com>
hmellor
reviewed
Jun 10, 2026
hmellor
left a comment
Member
There was a problem hiding this comment.
Would it be faster to use <= float('inf')? These checks are going to run a lot so we should try to use the fastest method
Contributor
Author
|
@hmellor The problem using That's the reason why. Do you think of a better solution for it? I don't really know it |
Member
|
Oh yeah of course, I should have suggested Anyway, a micro benchmark suggests that comparison is only faster if we write inf to a variable for reuse (not what I originally suggested)
Let's stick with what you have |
hmellor
approved these changes
Jun 10, 2026
Saddss
pushed a commit
to Saddss/vllm
that referenced
this pull request
Jun 14, 2026
vllm-project#45116) Signed-off-by: jperezde <jperezde@redhat.com>
vivek8123
pushed a commit
to odh-on-pz/vllm-upstream
that referenced
this pull request
Jun 18, 2026
vllm-project#45116) Signed-off-by: jperezde <jperezde@redhat.com>
This was referenced Jun 19, 2026
divineearthly
pushed a commit
to divineearthly/vllm
that referenced
this pull request
Jun 19, 2026
vllm-project#45116) Signed-off-by: jperezde <jperezde@redhat.com> Signed-off-by: divineearthly <divineearthly@gmail.com>
This was referenced Jun 22, 2026
tunglinwood
pushed a commit
to tunglinwood/vllm
that referenced
this pull request
Jun 22, 2026
vllm-project#45116) Signed-off-by: jperezde <jperezde@redhat.com>
nkzhenhua
pushed a commit
to nkzhenhua/vllm
that referenced
this pull request
Jun 24, 2026
vllm-project#45116) Signed-off-by: jperezde <jperezde@redhat.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.
Summary
math.isfinite()validation fortemperatureandrepetition_penaltyinSamplingParams._verify_args().<,>) due to IEEE 754 float semantics, allowing them to propagate to GPU sampling kernels where they cause undefined behavior or CUDA crashes.Test plan
tests/samplers/test_non_finite_params.pywith 12 parametrized tests covering NaN, +Inf, -Inf rejection and valid value acceptance for both parameters.pytest tests/samplers/test_non_finite_params.py -v— all 12 tests pass.pre-commit run --files vllm/sampling_params.py tests/samplers/test_non_finite_params.py— all hooks pass.