From ebc10770ac5a9331824c53ef0c6adad780904dc3 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 12 Jun 2026 17:59:56 +0300 Subject: [PATCH] server : fix reasoning budget WebUI precedence over model.ini (#24517) When reasoning-budget is set in model.ini, the per-request thinking_budget_tokens from the WebUI was ignored because the model.ini value took unconditional precedence. Swap the precedence so the WebUI per-request value is checked first, with the model.ini value serving as a fallback default. Assisted-by: pi:llama.cpp/Qwen3.6-27B --- tools/server/server-common.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/server/server-common.cpp b/tools/server/server-common.cpp index 9f3caac8f..aebaf1f91 100644 --- a/tools/server/server-common.cpp +++ b/tools/server/server-common.cpp @@ -1126,9 +1126,9 @@ json oaicompat_chat_params_parse( // Reasoning budget: pass parameters through to sampling layer { - int reasoning_budget = opt.reasoning_budget; - if (reasoning_budget == -1 && body.contains("thinking_budget_tokens")) { - reasoning_budget = json_value(body, "thinking_budget_tokens", -1); + int reasoning_budget = json_value(body, "thinking_budget_tokens", -1); + if (reasoning_budget == -1) { + reasoning_budget = opt.reasoning_budget; } if (!chat_params.thinking_end_tag.empty()) {