Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions edge0-strata/serve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
}
Expand Down
6 changes: 3 additions & 3 deletions edge0-strata/serve/test_model_card_sampling.py
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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), {})
Expand All @@ -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)

Expand Down
Loading