From af1ee8c475a2326d1d86f58b77e8e163579b44dc Mon Sep 17 00:00:00 2001 From: hcl Date: Tue, 30 Jun 2026 12:02:36 +0800 Subject: [PATCH] fix(config): reject negative max_logprobs (except -1) and long_prefill_token_threshold (#44070) Signed-off-by: Chenglun Hu Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- vllm/config/model.py | 2 +- vllm/config/scheduler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vllm/config/model.py b/vllm/config/model.py index ef0600af54..b12639d516 100644 --- a/vllm/config/model.py +++ b/vllm/config/model.py @@ -213,7 +213,7 @@ class ModelConfig: flexibility.""" enable_return_routed_experts: bool = False """Whether to return routed experts.""" - max_logprobs: int = 20 + max_logprobs: int = Field(default=20, ge=-1) """Maximum number of log probabilities to return when `logprobs` is specified in `SamplingParams`. The default value comes the default for the OpenAI Chat Completions API. -1 means no cap, i.e. all (output_length * diff --git a/vllm/config/scheduler.py b/vllm/config/scheduler.py index 1858e5e02c..e041469660 100644 --- a/vllm/config/scheduler.py +++ b/vllm/config/scheduler.py @@ -77,7 +77,7 @@ class SchedulerConfig: this less than max_num_partial_prefills will allow shorter prompts to jump the queue in front of longer prompts in some cases, improving latency.""" - long_prefill_token_threshold: int = 0 + long_prefill_token_threshold: int = Field(default=0, ge=0) """For chunked prefill, a request is considered long if the prompt is longer than this number of tokens."""