Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
web: the page sends no sampling until the user changes it, so the server's model-card defaults apply (stored 0.6 counts as not set); test (#2685)
Niko1221e8634865674e
diff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex aa0ec7a39..54eeba27e 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -1278,7 +1278,7 @@ request's thinking state: Qwen3.8-Flash-Next (and Gyro) thinking temperature 1.0top_p 0.8, top_k 20, presence_penalty 1.5. Qwen3.6-35B-A3B thinking 1.0 / 0.95 / 20 with presence_penalty 1.5, not thinking0.7 / 0.8 / 20 with 1.5 (min_p 0 and repetition_penalty 1 are "off"). Order of precedence: the request, the web page's shared Chat settings,the config's `sampling` block, the card. Greedy is only for who asks for it: `temperature: 0` in the request, or `"sampling": {"temperature": 0}` in the config-(before 0.1.45 a config without a block ran greedy, and greedy decoding is what makes small local models loop; #2685). The penalties (`presence_penalty`, `frequency_penalty`,+(before 0.1.45 a config without a block ran greedy, and greedy decoding is what makes small local models loop; #2685). The web page sends no sampling of its own until you change its Sampling settings (it showed and sent 0.6 before); an old stored 0.6 with the default top_p and top_k counts as not set. The penalties (`presence_penalty`, `frequency_penalty`,`repetition_penalty`, with `penalty_last_n` capping how many recent tokens they count over, default 64 when anypenalty is set; llama.cpp's names `repeat_penalty` and `repeat_last_n` work too, in the config's `sampling` block and in a request, #1819) ride the same path; they count the tokens the request has consumed, so a repetition penaltysuppresses what the model itself just said, not the prompt alone. Since engine 0.1.19 they apply to every tokendiff --git a/serve/test_web_sampling.py b/serve/test_web_sampling.pynew file mode 100644index 000000000..b502ace2f--- /dev/null+++ b/serve/test_web_sampling.py@@ -0,0 +1,77 @@+"""serve/test_web_sampling.py - the web page sends no sampling of its own until the user changes it (0.1.45, #2685).++The page used to send temperature 0.6 / top_p 0.95 / top_k 20 with every request, so the server's model-card defaults+(thinking 1.0, not thinking 0.7 + presence penalty) never applied to it. Pins, with node, the page's own functions:+untouched (the shown defaults, or the old stored 0.6) sends nothing, a changed value is sent whole, 0 is greedy.+Skipped without node.++ python -m unittest serve.test_web_sampling -v+"""+from __future__ import annotations++import json+import re+import shutil+import subprocess+import unittest+from pathlib import Path++APP = Path(__file__).resolve().parent / "web" / "app.js"+++def slice_between(src: str, start: str, end: str) -> str:+ a = src.index(start)+ return src[a:src.index(end, a)]++[email protected](shutil.which("node"), "node is not installed")+class WebSampling(unittest.TestCase):+ @classmethod+ def setUpClass(cls):+ src = APP.read_text(encoding="utf-8")+ cls.defaults = slice_between(src, "const DEFAULTS", "let settings")+ cls.shared = slice_between(src, "function sharedDefaults", "async function saveShared")+ cls.body = slice_between(src, " if (!(settings.temperature > 0)) {", " if (settings.seed)")++ def run_js(self, settings: dict, pieces: str):+ js = (self.defaults + "function projectionLoaded() { return false; }\n" + self.shared ++ f"\nconst settings = {json.dumps(settings)};\nconst body = {{}};\n{pieces}\n"+ "console.log(JSON.stringify({body, shared: sharedDefaults(settings)}));")+ out = subprocess.run(["node", "-e", js], capture_output=True, text=True, timeout=30)+ self.assertEqual(out.returncode, 0, out.stderr)+ return json.loads(out.stdout)++ def sampling(self, **kw):+ s = {"thinking": "high", "temperature": 1.0, "top_p": 0.95, "top_k": 20, "max": "", "seed": "", "esp": True}+ s.update(kw)+ r = self.run_js(s, self.body)+ return r["body"], r["shared"]++ def test_untouched_sends_nothing(self):+ for t in (1.0, 0.6): # the shown default, and the old stored default+ body, shared = self.sampling(temperature=t)+ self.assertEqual(body, {})+ self.assertEqual(shared, {"reasoning_effort": "high"})++ def test_changed_values_are_sent_whole(self):+ body, shared = self.sampling(temperature=0.3)+ self.assertEqual(body, {"temperature": 0.3, "top_p": 0.95, "top_k": 20})+ self.assertEqual(shared["temperature"], 0.3)+ body, _ = self.sampling(top_k=40)+ self.assertEqual(body, {"temperature": 1.0, "top_p": 0.95, "top_k": 40})+ body, _ = self.sampling(temperature=0.6, top_p=0.9)+ self.assertEqual(body["temperature"], 0.6)++ def test_zero_is_greedy(self):+ body, shared = self.sampling(temperature=0)+ self.assertEqual(body, {"temperature": 0})+ self.assertEqual(shared["temperature"], 0)++ def test_the_old_default_is_shown_as_the_new_one(self):+ src = APP.read_text(encoding="utf-8")+ self.assertRegex(src, r"if \(samplingUntouched\(settings\)\) settings\.temperature = DEFAULTS\.temperature;")+ self.assertIsNone(re.search(r"temperature: 0\.6", src))+++if __name__ == "__main__":+ unittest.main()diff --git a/serve/web/app.js b/serve/web/app.jsindex d3ad404fc..4bc2a46f3 100644--- a/serve/web/app.js+++ b/serve/web/app.js@@ -560,8 +560,18 @@ function markdown(text) {}// ------------------------------------------------------------------ Chat-const DEFAULTS = {thinking: "high", temperature: 0.6, top_p: 0.95, top_k: 20, max: "", seed: "", show: true, esp: true, mcp: true};+// The sampling shown until the user changes it is the model card's thinking set. Untouched, the page sends NO sampling+// fields: the server picks the card's set for the request's thinking state (thinking 1.0 / 0.95 / 20, not thinking+// 0.7 / 0.8 / 20 with a presence penalty). Before 0.1.45 the page sent 0.6 itself; a stored 0.6 with the other two+// values untouched counts as "not set" too.+const DEFAULTS = {thinking: "high", temperature: 1.0, top_p: 0.95, top_k: 20, max: "", seed: "", show: true, esp: true, mcp: true};+const OLD_DEFAULT_TEMPERATURE = 0.6;+function samplingUntouched(s) {+ const t = +s.temperature;+ return (t === DEFAULTS.temperature || t === OLD_DEFAULT_TEMPERATURE) && +s.top_p === DEFAULTS.top_p && +s.top_k === DEFAULTS.top_k;+}let settings = {...DEFAULTS, ...store.get("sampling", {})};+if (samplingUntouched(settings)) settings.temperature = DEFAULTS.temperature;let messages = store.get("chat", []);let attachments = []; // {name, url}let busy = null; // {controller, msg}@@ -790,10 +800,10 @@ async function send() {const body = {model: health.model, messages: apiMessages(), stream: true,reasoning_effort: settings.thinking};- if (settings.temperature > 0) {- Object.assign(body, {temperature: +settings.temperature, top_p: +settings.top_p, top_k: +settings.top_k});- } else {+ if (!(settings.temperature > 0)) {body.temperature = 0;+ } else if (!samplingUntouched(settings)) {+ Object.assign(body, {temperature: +settings.temperature, top_p: +settings.top_p, top_k: +settings.top_k});}if (settings.seed) body.seed = +settings.seed;if (settings.max) body.max_tokens = +settings.max;@@ -1011,8 +1021,9 @@ async function loadShared() {$("s-share").setAttribute("aria-checked", String(sharedOn));}function sharedDefaults(s) {- const d = {reasoning_effort: s.thinking, temperature: +s.temperature};- if (+s.temperature > 0) Object.assign(d, {top_p: +s.top_p, top_k: +s.top_k});+ const d = {reasoning_effort: s.thinking};+ if (!(+s.temperature > 0)) d.temperature = 0;+ else if (!samplingUntouched(s)) Object.assign(d, {temperature: +s.temperature, top_p: +s.top_p, top_k: +s.top_k});if (s.seed) d.seed = +s.seed;if (s.max) d.max_tokens = +s.max;if (projectionLoaded()) d.experimental_speed_projection = s.esp !== false;