Skip to content

[Feature] Add auto-detection for reasoning_config when only reasoning_parser is set#38214

Merged
chaunceyjiang merged 5 commits into
vllm-project:mainfrom
chaunceyjiang:auto_reasoning_config
Apr 10, 2026
Merged

[Feature] Add auto-detection for reasoning_config when only reasoning_parser is set#38214
chaunceyjiang merged 5 commits into
vllm-project:mainfrom
chaunceyjiang:auto_reasoning_config

Conversation

@chaunceyjiang

@chaunceyjiang chaunceyjiang commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Add auto-detection for reasoning_config when only reasoning_parser is set

Test Plan

see e2e

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify

mergify Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--38214.org.readthedocs.build/en/38214/

@mergify mergify Bot added the documentation Improvements or additions to documentation label Mar 26, 2026
Comment thread vllm/config/reasoning.py Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 introduces automatic initialization of reasoning boundary tokens (think_start_str, think_end_str) based on a specified reasoning parser. The ReasoningConfig now supports an optional reasoning_parser_name and can derive boundary tokens from it if not explicitly provided. The VLLMConfig logs a warning if this auto-initialization fails. Default reasoning configuration arguments are now set in arg_utils.py, and the documentation has been updated to reflect this new behavior. Additionally, existing tests for thinking_token_budget have been parameterized to cover both default and auto-configured server setups, and an assertion message was improved for clarity. There is no feedback to provide from the review comments.

@mergify

mergify Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Hi @chaunceyjiang, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@llsj14 llsj14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is a nice solution. Should we consider setting start_token and end_token to None in BasicReasoningParsers as well?

Right now, these fields are part of the interface, but some reasoning parsers don’t actually define or update them. This can potentially lead to assertion errors or even NotImplementedError in certain cases.

@property
@abstractmethod
def start_token(self) -> str:
"""The token that starts reasoning content."""
raise NotImplementedError
@property
@abstractmethod
def end_token(self) -> str:
"""The token that ends reasoning content."""
raise NotImplementedError

@chaunceyjiang chaunceyjiang force-pushed the auto_reasoning_config branch 2 times, most recently from f8cf822 to 96bdf52 Compare March 26, 2026 14:40
@mergify mergify Bot added the v1 label Mar 26, 2026
@chaunceyjiang

Copy link
Copy Markdown
Collaborator Author

/cc @njhill Ready for review.

@sfeng33 sfeng33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing I noticed: with this change, reasoning_config can now be non-None even when auto-detection fails (i.e., enabled=False). This means the validation in vllm/v1/engine/input_processor.py (line 103) would pass through a request with thinking_token_budget set, but the ThinkingTokenBudgetLogitsProcessor would silently ignore it since is_enabled is False.

Would it make sense to update that check to something like:

if params.thinking_token_budget is not None and (
   self.vllm_config.reasoning_config is None
    or not self.vllm_config.reasoning_config.enabled
 ):

Comment thread vllm/config/reasoning.py Outdated

@sfeng33 sfeng33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 27, 2026
@chaunceyjiang

Copy link
Copy Markdown
Collaborator Author

@chaunceyjiang

Copy link
Copy Markdown
Collaborator Author

@DarkLight1337 All tests have passed.

@chaunceyjiang

Copy link
Copy Markdown
Collaborator Author

@claude review

@mergify

mergify Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @chaunceyjiang.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Apr 1, 2026
…_parser is set

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
@chaunceyjiang chaunceyjiang force-pushed the auto_reasoning_config branch from 1e02c70 to ead0fcd Compare April 9, 2026 02:40
…_parser is set

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
@mergify mergify Bot removed the needs-rebase label Apr 9, 2026
…_parser is set

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
@vllm-project vllm-project deleted a comment from mergify Bot Apr 9, 2026
@chaunceyjiang chaunceyjiang enabled auto-merge (squash) April 9, 2026 03:06
@chaunceyjiang chaunceyjiang merged commit ecbfbb8 into vllm-project:main Apr 10, 2026
62 checks passed
wojciech-wais pushed a commit to wojciech-wais/vllm that referenced this pull request Apr 13, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
whk-lab pushed a commit to whk-lab/vllm that referenced this pull request Apr 23, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
mystous pushed a commit to mystous/vllm_hybrid that referenced this pull request May 10, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
jhu960213 pushed a commit to jhu960213/vllm that referenced this pull request May 20, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
…_parser is set (vllm-project#38214)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants