feat(vllm-serve): add --reasoning-parser and --reasoning-config flags#5672
Open
kfirah-create wants to merge 1 commit intohuggingface:mainfrom
Open
feat(vllm-serve): add --reasoning-parser and --reasoning-config flags#5672kfirah-create wants to merge 1 commit intohuggingface:mainfrom
kfirah-create wants to merge 1 commit intohuggingface:mainfrom
Conversation
`trl vllm-serve` currently doesn't expose vLLM's reasoning config
options. This means `thinking_token_budget` passed via
`GRPOConfig.generation_kwargs` fails with a 400 error:
"thinking_token_budget is set but reasoning_config is not configured"
because the vLLM engine has no `ReasoningConfig` set.
This adds `--reasoning_parser` and `--reasoning_config` CLI flags to
`ScriptArguments` in `vllm_serve.py` and passes them through to the
`LLM()` constructor. This enables thinking-aware models (Qwen3.5,
DeepSeek-R1, etc.) to use `thinking_token_budget` during GRPO training
without needing to launch vLLM manually outside of TRL.
Example usage:
trl vllm-serve \
--model Qwen/Qwen3.5-9B \
--reasoning_parser qwen3
Then in the training script:
GRPOConfig(
...,
generation_kwargs={"thinking_token_budget": 1024},
)
Made-with: Cursor
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.
What does this PR do?
trl vllm-servecurrently doesn't expose vLLM's--reasoning-parseror--reasoning-configoptions. When using thinking models (Qwen3.5, DeepSeek-R1, etc.) with GRPO andthinking_token_budgetingeneration_kwargs, the vLLM engine returns a 400 error:This is because vLLM requires a
ReasoningConfigon the engine to activate itsThinkingTokenBudgetLogitsProcessor, buttrl vllm-servehas no way to set it.This PR adds two new
ScriptArgumentsfields invllm_serve.py:reasoning_parser— e.g.,"qwen3","deepseek_r1"— forwarded toLLM(reasoning_parser=...)reasoning_config— JSON string forwarded toLLM(reasoning_config=...)for explicit delimiter controlBoth are passed through to the
LLM()constructor, enablingthinking_token_budgetingeneration_kwargsto work end-to-end.Example usage:
trl vllm-serve \ --model Qwen/Qwen3.5-9B \ --reasoning_parser qwen3Before submitting
AI writing disclosure
We welcome the use of AI tools to help with contributions. For transparency and to help us improve our review process, please indicate the level of AI involvement in this PR.
Who can review?
@qgallouedec — this enables
thinking_token_budgetsupport for thinking models (Qwen3.5, DeepSeek-R1) when usingtrl vllm-servewith GRPO.Note
Medium Risk
Adds new CLI arguments that are forwarded into vLLM engine initialization; risk is mainly version/compatibility issues if installed vLLM lacks these constructor params or if invalid JSON is provided.
Overview
trl vllm-servenow supports thinking-model reasoning setup by adding--reasoning_parserand--reasoning_configoptions toScriptArguments.These values are forwarded into the vLLM
LLM(...)constructor (withreasoning_configparsed from JSON), enablingthinking_token_budgetin downstreamgeneration_kwargswhen serving models like Qwen/DeepSeek.Reviewed by Cursor Bugbot for commit a1a1272. Bugbot is set up for automated code reviews on this repo. Configure here.