[Security] Reject min_tokens that exceeds the filled max_tokens default (#57731)

Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com>
This commit is contained in:
Juan Pérez de Algaba
2026-09-22 05:50:23 +00:00
committed by GitHub
parent d50723df04
commit 4800024b98
3 changed files with 64 additions and 0 deletions
+7
View File
@@ -397,6 +397,13 @@ class InputProcessor:
sampling_params.max_tokens = (
self.model_config.max_model_len - prompt_len
)
# min_tokens is not checked while max_tokens is unset.
if sampling_params.min_tokens > sampling_params.max_tokens:
raise VLLMValidationError(
f"min_tokens must be less than or equal to "
f"max_tokens={sampling_params.max_tokens}, got "
f"{sampling_params.min_tokens}."
)
sampling_params.update_from_generation_config(
self.generation_config_fields,