From aadb3668f53f634103741be14e2703353a9c36bd Mon Sep 17 00:00:00 2001 From: linyubupa <403864360@qq.com> Date: Sun, 22 Nov 2026 02:26:58 +0800 Subject: [PATCH] feat(serve): default the sampling temperature to 1.0 in both thinking states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A request that sends no sampling takes the table's values, and the instruct rows were 0.7 — flatter, shorter answers than the same model in thinking mode. Use 1.0 for both states in every family; top_p, top_k and presence_penalty stay as they were. Requests and configs that ask for a temperature still win, and an explicit temperature 0 is still greedy. The table no longer mirrors the Qwen cards' instruct column; the comment says so. --- edge0-strata/serve/server.py | 10 ++++++---- edge0-strata/serve/test_model_card_sampling.py | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/edge0-strata/serve/server.py b/edge0-strata/serve/server.py index ab67a871..865bb5d9 100644 --- a/edge0-strata/serve/server.py +++ b/edge0-strata/serve/server.py @@ -8880,16 +8880,18 @@ def check_request_sampling(req) -> None: "deepseek41": "deepseek-v4.1-flash"} -# The sampling each model card recommends ("Best Practices"), used when neither the request, the Chat settings nor the -# run config's `sampling` block says otherwise. Greedy is only for a request or config that asks for temperature 0. +# The sampling used when neither the request, the Chat settings nor the run config's `sampling` block says otherwise. +# Temperature is 1.0 in both states for every family: the instruct 0.7 of the Qwen cards produced shorter, flatter +# answers than the cards' own thinking setting, and one temperature keeps behaviour the same whichever mode the +# client ends up in. Greedy is only for a request or config that asks for temperature 0. # min_p 0, repetition_penalty 1 and presence_penalty 0 are the engine's own "off", so they are not listed. MODEL_CARD_SAMPLING = { # Qwen3.8-Flash-Next (and Gyro, the same base model) "qwen4exp": {"thinking": {"temperature": 1.0, "top_p": 0.95, "top_k": 20}, - "instruct": {"temperature": 0.7, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}}, + "instruct": {"temperature": 1.0, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}}, # Qwen3.6-35B-A3B: the general-task sets (the card's precise-coding set is temperature 0.6, presence_penalty 0) "qwen35moe": {"thinking": {"temperature": 1.0, "top_p": 0.95, "top_k": 20, "presence_penalty": 1.5}, - "instruct": {"temperature": 0.7, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}}, + "instruct": {"temperature": 1.0, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}}, # DeepSeek-V4.1-Flash: temperature 1.0, top_p 1.0 for local use (thinking or not), no penalties "deepseek41": {"thinking": {"temperature": 1.0, "top_p": 1.0}, "instruct": {"temperature": 1.0, "top_p": 1.0}}, } diff --git a/edge0-strata/serve/test_model_card_sampling.py b/edge0-strata/serve/test_model_card_sampling.py index ee491506..49a88626 100644 --- a/edge0-strata/serve/test_model_card_sampling.py +++ b/edge0-strata/serve/test_model_card_sampling.py @@ -1,6 +1,6 @@ """serve/test_model_card_sampling.py - a request that sends no sampling gets the model card's, not greedy (mock engine). -Qwen's "Best Practices": thinking mode temperature 1.0 / top_p 0.95 / top_k 20, non-thinking 0.7 / 0.8 / 20 with +Both modes now default to temperature 1.0: thinking top_p 0.95 / top_k 20, non-thinking 0.8 / 20 with presence_penalty 1.5. The request's own fields win, then the Chat settings shared with apps, then the config's `sampling` block, then the card; temperature 0 asked for is still greedy. @@ -61,7 +61,7 @@ def keys(self, **body): def test_tables(self): self.assertEqual(model_card_sampling("qwen4exp", True), {"temperature": 1.0, "top_p": 0.95, "top_k": 20}) self.assertEqual(model_card_sampling("qwen4exp", False), - {"temperature": 0.7, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}) + {"temperature": 1.0, "top_p": 0.8, "top_k": 20, "presence_penalty": 1.5}) self.assertEqual(model_card_sampling("qwen35moe", True)["presence_penalty"], 1.5) self.assertEqual(model_card_sampling(None, True), {}) self.assertEqual(model_card_sampling("unknown", False), {}) @@ -75,7 +75,7 @@ def test_thinking_default(self): def test_non_thinking_default(self): k = self.keys(reasoning_effort="none") - self.assertIn("temperature=0.7", k) + self.assertIn("temperature=1.0", k) self.assertIn("top_p=0.8", k) self.assertIn("penalty_present=1.5", k)