From ebb0a71ad0b2e2a09ed76b14338465f6b121ebfd Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Mon, 15 Jun 2026 14:12:44 +0800 Subject: [PATCH] [Bugfix] Reject out-of-range temperature values in SamplingParams (#44965) Signed-off-by: Peter Pan --- vllm/sampling_params.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vllm/sampling_params.py b/vllm/sampling_params.py index 2786ca8c5c..c8c5c4d80b 100644 --- a/vllm/sampling_params.py +++ b/vllm/sampling_params.py @@ -526,6 +526,12 @@ class SamplingParams( parameter="temperature", value=self.temperature, ) + if self.temperature > 2.0: + raise VLLMValidationError( + f"temperature must be in [0, 2], got {self.temperature}.", + parameter="temperature", + value=self.temperature, + ) if not 0.0 < self.top_p <= 1.0: raise VLLMValidationError( f"top_p must be in (0, 1], got {self.top_p}.",