-
- Notifications
You must be signed in to change notification settings - Fork 10.6k
[Bugfix] Fix erroneous randomly generated cases in bad word testing #22170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to fix two corner cases in the bad word testing logic by introducing new helper functions. While the approach is sound, the implementation contains critical bugs due to variable shadowing. The new helper functions are called with arguments of the wrong type, which will lead to runtime errors. I have provided comments with suggestions to fix these issues. Additionally, I've pointed out a maintainability issue in one of the new helper functions, also related to variable shadowing, and suggested an improvement.
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
4dbea9e
to 4d051be
Compare Signed-off-by: phantomlei <phantomlei3@gmail.com>
4d051be
to eb0208b
Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching these subtle edge cases! LGTM, requested committers for stamping/review.
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com> Signed-off-by: Paul Pak <paulpak58@gmail.com>
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com> Signed-off-by: Diego-Castan <diego.castan@ibm.com>
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com>
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com>
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com> Signed-off-by: Xiao Yu <xiao.yu@amd.com>
…llm-project#22170) Signed-off-by: phantomlei <phantomlei3@gmail.com>
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Fix a random bug from tests/v1/sample/test_sampler.py::test_sampler_bad_words when batch size is 32 and bad words lengths is (2, 2).
There are two corner cases that would trigger this unit test to fail but the input is random generated so this error is diffcult to replicate during CI test in vLLM.
Corner Case 1:
When two randomly generated token ID sequences share the same first token ID — for example, [[522, 2], [522, 3]] — only [522, 2] will be considered in the bad words filtering process. [522, 3] will be ignored, leading to incomplete coverage.
Corner Case 2:
When the first token IDs of two randomly generated token ID sequences differ by only 1 — for example, [[524, 2], [523, 3]] — and the has_bad_words check happens to return False for both, the last token in the output may incorrectly be replaced with 524 (a bad word), causing an error.
Test Plan
100 runs of the following command and make sure all passes
Test Result
all passed
(Optional) Documentation Update