Skip to content

Not all stop sequences are created equal#534

Closed
zacharyblank wants to merge 1 commit intovllm-project:mainfrom
zacharyblank:fix_stop_sequence
Closed

Not all stop sequences are created equal#534
zacharyblank wants to merge 1 commit intovllm-project:mainfrom
zacharyblank:fix_stop_sequence

Conversation

@zacharyblank
Copy link

@zacharyblank zacharyblank commented Jul 20, 2023

This PR fixes some stop sequences not being matched. When generating and decoding tokens, sometimes a single token will generate the stop sequence plus additional characters. This caused if seq.output_text.endswith(stop_str): not to behave as expected.

For example. If a stop sequence is defined as ", and the model generates "," as a single token, as is the case with EleutherAI/gpt-neox-20b, then the stop sequence will not be detected and generation will not stop.

This is a small PR that, instead of checking only the end of the generated sequence, checks the entire sequence for the stop sequence

Copy link
Member

@zhuohan123 zhuohan123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! Can you fix the formatting error with format.sh? In addition, does this change lead to an O(N) string comparison at every iteration, which leads to O(N^2) general complexity? Will this affect the performance of long sequences? Can we somehow just compare stop_str with the newly generated token, instead of the whole sequence?

@claudiosv
Copy link

I believe #1724 is a dupe of this one. Would like to see this merged though.

@hmellor
Copy link
Member

hmellor commented Mar 28, 2024

@zacharyblank is this PR still necessary? If yes, do you still plan to get it merged?

@njhill
Copy link
Member

njhill commented Mar 28, 2024

#3672 is a more complete fix for this.

@hmellor
Copy link
Member

hmellor commented Mar 28, 2024

I'll close this in favour of yours @njhill

@hmellor hmellor closed this Mar 28, 2024
amy-why-3459 pushed a commit to amy-why-3459/vllm that referenced this pull request Sep 15, 2025
update faq about w8a8

---------

Signed-off-by: Mengqing Cao <cmq0113@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants