[Bugfix] Fix the issue with interleaved thinking when using streaming#30033
Merged
DarkLight1337 merged 4 commits intovllm-project:mainfrom Dec 4, 2025
Merged
Conversation
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request addresses a bug in is_reasoning_end that caused incorrect behavior with interleaved thinking blocks during streaming. The change correctly determines if reasoning has ended by checking for the last occurrence of a start or end token. The logic is sound and effectively resolves the issue. However, the pull request lacks unit tests to cover the fixed scenario, which is a significant omission for preventing future regressions. I have added a comment to highlight the need for adding a dedicated test case.
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Signed-off-by: Chauncey <chaunceyjiang@gmail.com>
DarkLight1337
approved these changes
Dec 4, 2025
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
5 tasks
dsuhinin
pushed a commit
to dsuhinin/vllm
that referenced
this pull request
Jan 21, 2026
…vllm-project#30033) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Signed-off-by: Chauncey <chaunceyjiang@gmail.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.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
Fix the issue with interleaved thinking when using streaming.
When the user's prompt contains something like
<think>...</think> ... <think>,is_reasoning_endincorrectly determines that reasoning has already ended. In reality, because the last token is<think>, the reasoning has just begun. This causes reasoning to fail to work properly.Especially in interleaved thinking mode, where the chat_template renders a
<think>...</think> ... <think>prompt with 100% consistency.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.