From 626fa9bba5663a5cf6a870debf031ee344ddb822 Mon Sep 17 00:00:00 2001 From: Nick Hill Date: Wed, 27 May 2026 21:59:34 -0700 Subject: [PATCH] [BugFix] Fix blocked reasoning parsing with MRV2 (#43808) Signed-off-by: Nick Hill --- .../test_thinking_token_budget.py | 13 +++++++--- vllm/config/vllm.py | 19 +++++++------- vllm/v1/engine/input_processor.py | 26 ++++++++++++------- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/tests/entrypoints/openai/chat_completion/test_thinking_token_budget.py b/tests/entrypoints/openai/chat_completion/test_thinking_token_budget.py index ae2b597e13..3e9e4850f0 100644 --- a/tests/entrypoints/openai/chat_completion/test_thinking_token_budget.py +++ b/tests/entrypoints/openai/chat_completion/test_thinking_token_budget.py @@ -72,7 +72,9 @@ def server(): "0.4", "--no-async-scheduling", ] - with RemoteOpenAIServer(MODEL_NAME, args) as remote_server: + # thinking_token_budget is not yet supported by the V2 model runner. + env_dict = {"VLLM_USE_V2_MODEL_RUNNER": "0"} + with RemoteOpenAIServer(MODEL_NAME, args, env_dict=env_dict) as remote_server: yield remote_server @@ -88,7 +90,9 @@ def server_with_auto_reasoning_config(): "0.4", "--no-async-scheduling", ] - with RemoteOpenAIServer(MODEL_NAME, args) as remote_server: + # thinking_token_budget is not yet supported by the V2 model runner. + env_dict = {"VLLM_USE_V2_MODEL_RUNNER": "0"} + with RemoteOpenAIServer(MODEL_NAME, args, env_dict=env_dict) as remote_server: yield remote_server @@ -122,11 +126,12 @@ def server_qwen35_fp8_mtp_tp2(): } ), ] + # thinking_token_budget is not yet supported by the V2 model runner. + env_dict: dict[str, str] = {"VLLM_USE_V2_MODEL_RUNNER": "0"} # With 4+ GPUs, run TP=2 on physical devices 2,3 so module-scoped 0.6B servers # on 0,1 do not exhaust memory on the same devices as this worker. - env_dict = None if current_platform.device_count() >= 4: - env_dict = {"CUDA_VISIBLE_DEVICES": "2,3"} + env_dict["CUDA_VISIBLE_DEVICES"] = "2,3" with RemoteOpenAIServer( QWEN35_FP8_MTP_MODEL, diff --git a/vllm/config/vllm.py b/vllm/config/vllm.py index 04aee9d48b..9e71d7b47e 100644 --- a/vllm/config/vllm.py +++ b/vllm/config/vllm.py @@ -500,14 +500,14 @@ class VllmConfig: if not HAS_TRITON: logger.warning_once( - "Model runner v2 requires Triton; using the v1 model runner instead." + "Model Runner V2 requires Triton; using the V1 model runner instead." ) return False unsupported = self._get_v2_model_runner_unsupported_features() if unsupported: logger.warning_once( - "Model runner v2 does not yet support %s; using the v1 model " + "Model Runner V2 does not yet support %s; using the V1 model " "runner instead.", ", ".join(unsupported), ) @@ -1982,10 +1982,6 @@ class VllmConfig: ): unsupported.append("EAGLE3 with pipeline parallelism") - if self.reasoning_config is not None: - # TODO: add reasoning budget enforcement to ModelRunnerV2. - unsupported.append("reasoning budget enforcement") - if self.parallel_config.enable_dbo: unsupported.append("dual batch overlap") @@ -2027,13 +2023,18 @@ class VllmConfig: def _validate_v2_model_runner(self) -> None: """Check for features not yet supported by the V2 model runner.""" if not HAS_TRITON: - raise ValueError("VLLM_USE_V2_MODEL_RUNNER requires Triton.") + raise ValueError("Model Runner V2 requires Triton.") unsupported = self._get_v2_model_runner_unsupported_features() if unsupported: raise ValueError( - "VLLM_USE_V2_MODEL_RUNNER does not yet support: " - + ", ".join(unsupported) + f"Model Runner V2 does not yet support: {', '.join(unsupported)}" + ) + + if self.reasoning_config is not None: + logger.warning_once( + "Model Runner V2 does not yet support the thinking_token_budget " + "request parameter. Set VLLM_USE_V2_MODEL_RUNNER=0 if this is required." ) def validate_block_size(self) -> None: diff --git a/vllm/v1/engine/input_processor.py b/vllm/v1/engine/input_processor.py index c579c92baf..10a6329f5a 100644 --- a/vllm/v1/engine/input_processor.py +++ b/vllm/v1/engine/input_processor.py @@ -49,6 +49,7 @@ class InputProcessor: self.speculative_config = vllm_config.speculative_config self.structured_outputs_config = vllm_config.structured_outputs_config self.observability_config = vllm_config.observability_config + self.use_v2_model_runner = vllm_config.use_v2_model_runner self.generation_config_fields = model_config.try_get_generation_config() @@ -98,15 +99,22 @@ class InputProcessor: self.tokenizer, ) - if params.thinking_token_budget is not None and ( - self.vllm_config.reasoning_config is None - or not self.vllm_config.reasoning_config.enabled - ): - raise ValueError( - "thinking_token_budget is set but reasoning_config is " - "not configured. Please set --reasoning-config to use " - "thinking_token_budget." - ) + if params.thinking_token_budget is not None: + if ( + self.vllm_config.reasoning_config is None + or not self.vllm_config.reasoning_config.enabled + ): + raise ValueError( + "thinking_token_budget is set but reasoning_config is " + "not configured. Please set --reasoning-parser " + "and/or --reasoning-config to use thinking_token_budget." + ) + if self.use_v2_model_runner: + raise ValueError( + "thinking_token_budget is not yet supported by the V2 " + "model runner. Run vLLM with VLLM_USE_V2_MODEL_RUNNER=0 " + "to use thinking_token_budget." + ) elif isinstance(params, PoolingParams): supported_pooling_tasks = [ task for task in supported_tasks if task in POOLING_TASKS