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++
setup: --remote-expert-opt only beside a helper cache; docs: --pipeline-windows and --adapt-async combine (#1447)
Niko122154d26589cab4
diff --git a/docs/MULTI_GPU.md b/docs/MULTI_GPU.mdindex 50080d7d8..95a6b883a 100644--- a/docs/MULTI_GPU.md+++ b/docs/MULTI_GPU.md@@ -224,7 +224,7 @@ Two cards, exactly two stages, `--serve`. In the config:rounds them differently, and a near-tie can flip (a serial run given the same caches through `--vram-reserve-mib`matches it exactly).- **Off, with one line in the log saying why**, with `--batch` slots, `--peer-device`, the helper caches- (`--expert-cache-device1..3`, `--remote-expert-opt`), a split into three or more stages or onto one GPU+ (`--expert-cache-device1..3`, which `--remote-expert-opt` builds on), a split into three or more stages or onto one GPU(`--split-device 0`), or no draft layer. A request with repetition penalties (`penalty_last_n`) or coupleddraft sampling decodes serially.- **With the resident RAM mode's asynchronous swaps** (`--adapt-async 1`, [DETAILS.md](DETAILS.md)) a round's steps@@ -239,8 +239,35 @@ Two cards, exactly two stages, `--serve`. In the config:(`--mmap-experts` on that 32 GB PC) the file reads dominate and it measured no faster.The `STRATA_PIPELINE_*` tuning and test variables (THETA, FORCE_MISS, SWITCH, LOG, TRACE and the like) are read only with-`STRATA_PIPELINE_DEBUG=1`. `--pipeline-windows` and `--adapt-async 1` exclude each other (the engine says so and keeps the-pipeline).+`STRATA_PIPELINE_DEBUG=1`. `--pipeline-windows` and `--adapt-async 1` combine: the engine turns the asynchronous tier+off beside `--pipeline-windows 2` only when `STRATA_PIPELINE_ADAPT_ASYNC=0` is set. What switches either one off is+printed once at start ("is off: ..."). `--remote-expert-opt` does something only with a helper cache+(`--expert-cache-device1..3`); on a plain layer split it is inert, and setup no longer writes it there (#1447).++Measured on 2x RTX 3090 (sm_86, 250 W limits; GPU0 PCIe 4.0 x16, GPU1 x4, no NVLink; Ryzen 7 9800X3D, 32 GB RAM),+Qwen3.8-Flash-Next GSQ-RCO IQ3_S, `--resident-experts`, KV int8, `--spec 4 --mtp`, `"layer_split": "29"` for the+`--pipeline-windows` rows (without `--remote-expert-opt`); the others are setup's config (`auto`). Decode is the mean of+runs 2-6 of 1,500-token coding replies at temperature 0.6, prefill one cold 19.9K-token prompt; one run per arm unless+noted (reported by adambenhassen, #1447; not repeated on our boxes):++| Arm | Decode tok/s | Prefill tok/s |+|---|---:|---:|+| setup defaults (two runs) | 137.0 / 136.9 | 1798 |+| `--adapt-async 1` (two runs) | 145.2 / 143.7 | 1800 / 1797 |+| `--adapt-async 1`, no `--remote-expert-opt` | 145.0 | 1807 |+| `STRATA_ADAPT_LAG=2` | 142.8 | 1800 |+| `STRATA_EXCHANGE_ROTATE=1` | 139.6 | 1800 |+| `STRATA_PF_FUSED=1` | 137.2 | 1913 |+| `--pipeline-windows 2` | 136.7 | 2097 |+| `STRATA_SPEC_COUPLED=1` | 137.6 | 1804 |+| `STRATA_SPEC_PROB=1` | 137.2 | 1788 |+| `STRATA_SPEC_COUPLED=1` + `STRATA_SPEC_GUMBEL=1` | 136.5 | 1805 |+| async + lag 2 + rotate + pf_fused | 145.0 | 1829 |+| pw2 + lag 2 + rotate + pf_fused | 135.9 | 2296 |+| pw2 + async + lag 2 + rotate + pf_fused | 142.0 | 2302 |++The last row keeps most of the asynchronous tier's decode gain and the pipeline's +28% prefill; no stalls in any arm.+These are opt-in settings on one rig, not defaults.## Several conversations at oncediff --git a/setup.py b/setup.pyindex 12e87fe11..319a42b5a 100644--- a/setup.py+++ b/setup.py@@ -1107,10 +1107,11 @@ def split_budget(cfg: dict, yes: bool = False, explicit: bool = False) -> bool:REMOTE_EXPERT_OPT = "--remote-expert-opt"+HELPER_CACHE_FLAGS = ("--expert-cache-device1", "--expert-cache-device2", "--expert-cache-device3")def recommend_remote_expert_opt(cfg: dict, off: bool = False) -> None:- """0.1.39b (#578): a config on two or more GPUs gets --remote-expert-opt - the helper expert caches+ """0.1.39b (#578): a config on two or more GPUs with a helper cache gets --remote-expert-opt - the helper expert caches(--expert-cache-device1..3) then stay complementary to the main GPU's, return their rows already weighted and skipthe CPU's activation quantization where no expert is left to it (dual RTX 4090: +63% mixed, +132% code over theplain helper path). The engine uses it only with a helper cache; a layer split runs as before. A recommendation:@@ -1123,6 +1124,23 @@ def recommend_remote_expert_opt(cfg: dict, off: bool = False) -> None:if REMOTE_EXPERT_OPT in args:args.remove(REMOTE_EXPERT_OPT)return+ # #1352: --pipeline-windows (the first card starts the next window) is switched off by --remote-expert-opt (the+ # helper caches), so a config that asks for it keeps its pipeline: one of the two, not both (docs/MULTI_GPU.md)+ pw = args.index("--pipeline-windows") if "--pipeline-windows" in args else -1+ if pw >= 0 and pw + 1 < len(args) and args[pw + 1] != "0":+ if REMOTE_EXPERT_OPT in args:+ warn("--pipeline-windows and --remote-expert-opt are both in this config: the engine turns the pipeline off "+ "beside the helper caches. Keep one - remove --remote-expert-opt for the pipeline "+ "(docs/MULTI_GPU.md, #1352)")+ else:+ ok("multi-GPU: --pipeline-windows is set, so --remote-expert-opt is not added (the helper caches turn the "+ "pipeline off; docs/MULTI_GPU.md)")+ return+ # #1447: the flag acts only on the helper caches (--expert-cache-device1..3); without one the engine builds nothing+ # from it, and a plain layer split gained a flag that says "helpers" for no reason. Setup adds it only beside a+ # helper cache; a flag already in the config stays (the user's, or an earlier setup's - harmless).+ if not any(a.split("=", 1)[0] in HELPER_CACHE_FLAGS for a in args):+ returnif REMOTE_EXPERT_OPT not in args:args.append(REMOTE_EXPERT_OPT)ok("multi-GPU: --remote-expert-opt (helper expert caches complementary to the main GPU's, #578; "diff --git a/tools/test_setup_golden.json b/tools/test_setup_golden.jsonindex 6140de75c..96701cce1 100644--- a/tools/test_setup_golden.json+++ b/tools/test_setup_golden.json@@ -233,8 +233,7 @@"131072","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -279,8 +278,7 @@"131072","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -325,8 +323,7 @@"131072","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -371,8 +368,7 @@"131072","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -457,8 +453,7 @@"65536","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -503,8 +498,7 @@"65536","--kv","int8",- "--resident-experts",- "--remote-expert-opt"+ "--resident-experts"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -548,8 +542,7 @@"--max-context","65536","--kv",- "int8",- "--remote-expert-opt"+ "int8"],"cwd": "<T>","exe": "<T>/engine/<EXE>",@@ -593,8 +586,7 @@"--max-context","65536","--kv",- "int8",- "--remote-expert-opt"+ "int8"],"cwd": "<T>","exe": "<T>/engine/<EXE>",diff --git a/tools/test_setup_remote_opt.py b/tools/test_setup_remote_opt.pyindex 7e57ee408..8d797a2ae 100644--- a/tools/test_setup_remote_opt.py+++ b/tools/test_setup_remote_opt.py@@ -17,6 +17,7 @@ import setup # noqa: E402from test_setup_golden import PROFILES, install # noqa: E402FLAG = "--remote-expert-opt"+HELPER = ["--expert-cache-device1", "auto"]class Rule(unittest.TestCase):@@ -26,10 +27,22 @@ class Rule(unittest.TestCase):self.addCleanup(p.stop)def test_two_gpus_get_it_once(self):- cfg = {"args": ["--spec", "4"], "gpu": [0, 1]}+ cfg = {"args": ["--spec", "4"] + HELPER, "gpu": [0, 1]}setup.recommend_remote_expert_opt(cfg)setup.recommend_remote_expert_opt(cfg)- self.assertEqual(cfg["args"], ["--spec", "4", FLAG])+ self.assertEqual(cfg["args"], ["--spec", "4"] + HELPER + [FLAG])++ def test_no_helper_cache_no_flag(self):+ """#1447: on a plain layer split there is no helper cache for the flag to act on, so setup does not write it."""+ cfg = {"args": ["--spec", "4"], "gpu": [0, 1]}+ setup.recommend_remote_expert_opt(cfg)+ self.assertEqual(cfg["args"], ["--spec", "4"])+ kept = {"args": [FLAG], "gpu": [0, 1]} # a flag already there is the user's: left alone+ setup.recommend_remote_expert_opt(kept)+ self.assertEqual(kept["args"], [FLAG])+ eq = {"args": ["--expert-cache-device2=auto"], "gpu": [0, 1, 2]}+ setup.recommend_remote_expert_opt(eq)+ self.assertIn(FLAG, eq["args"])def test_one_gpu_is_untouched(self):for gpu in (None, 0, [0]):@@ -41,9 +54,24 @@ class Rule(unittest.TestCase):cfg = {"args": ["--spec", "4", FLAG], "gpu": [0, 1]}setup.recommend_remote_expert_opt(cfg, off=True)self.assertEqual(cfg["args"], ["--spec", "4"])- cfg = {"args": ["--spec", "4"], "gpu": [0, 1, 2], "remote_expert_opt": False}+ cfg = {"args": ["--spec", "4"] + HELPER, "gpu": [0, 1, 2], "remote_expert_opt": False}setup.recommend_remote_expert_opt(cfg)- self.assertEqual(cfg["args"], ["--spec", "4"])+ self.assertEqual(cfg["args"], ["--spec", "4"] + HELPER)++ def test_pipeline_windows_wins(self):+ """#1352: the two exclude each other (the engine drops the pipeline beside the helper caches), so setup+ does not add the flag to a config that asks for the pipeline, and says so when both are there."""+ cfg = {"args": ["--spec", "4", "--pipeline-windows", "2"] + HELPER, "gpu": [0, 1]}+ setup.recommend_remote_expert_opt(cfg)+ self.assertEqual(cfg["args"], ["--spec", "4", "--pipeline-windows", "2"] + HELPER)+ both = {"args": [FLAG, "--pipeline-windows", "2"], "gpu": [0, 1]}+ with mock.patch.object(setup, "warn") as w:+ setup.recommend_remote_expert_opt(both)+ self.assertEqual(both["args"], [FLAG, "--pipeline-windows", "2"]) # a recommendation, never forced+ self.assertEqual(w.call_count, 1)+ off = {"args": ["--pipeline-windows", "0"] + HELPER, "gpu": [0, 1]} # 0: no pipeline asked for+ setup.recommend_remote_expert_opt(off)+ self.assertIn(FLAG, off["args"])def test_the_users_key_is_kept_on_a_rerun(self):self.assertNotIn("remote_expert_opt", setup.SETUP_KEYS) # #629: carried over, so the opt-out survives@@ -51,17 +79,13 @@ class Rule(unittest.TestCase):class Install(unittest.TestCase):def test_install_on_two_gpus(self):+ """#1447: a plain two-GPU install has no helper cache, so no --remote-expert-opt is written."""ram, found = PROFILES["47GB-2x16GB"]args = ["--family", "qwen", "--no-start", "--model", "Q2_0"]code, text, cfg, _ = install(ram, found, args)self.assertEqual(code, 0, text)self.assertIsInstance(cfg.get("gpu"), list)- self.assertEqual(cfg["args"].count(FLAG), 1)- self.assertIn("--no-remote-expert-opt leaves it out", text)- code, text, off, _ = install(ram, found, args + ["--no-remote-expert-opt"])- self.assertEqual(code, 0, text)- self.assertNotIn(FLAG, off["args"])- self.assertEqual([a for a in cfg["args"] if a != FLAG], off["args"])+ self.assertNotIn(FLAG, cfg["args"])def test_install_on_one_gpu(self):ram, found = PROFILES["96GB-1x16GB"]diff --git a/tools/test_setup_risk.py b/tools/test_setup_risk.pyindex 9a0174d86..a76f77a8c 100644--- a/tools/test_setup_risk.py+++ b/tools/test_setup_risk.py@@ -328,7 +328,7 @@ class StartOnSeveralGpus(unittest.TestCase):code, out, asked, cfg = self.offer(["--resident-experts"], "y")self.assertIn("[n]", asked[0])self.assertEqual(cfg["gpu"], [0, 1])- self.assertEqual(cfg["args"], ["--mmap-experts", "--remote-expert-opt"]) # 0.1.39b: #578 on 2+ GPUs+ self.assertEqual(cfg["args"], ["--mmap-experts"]) # #1447: no helper cache, no --remote-expert-optcode, out, asked, cfg = self.offer(["--mmap-experts"], None) # other configs: as beforeself.assertEqual(cfg["gpu"], [0, 1])@@ -341,7 +341,7 @@ class StartOnSeveralGpus(unittest.TestCase):code, out, asked, cfg = self.offer(["--resident-experts"], None) # --yes: the recommendationself.assertIsNone(code, out)self.assertEqual(cfg["gpu"], [0, 1])- self.assertEqual(cfg["args"], ["--resident-experts", "--remote-expert-opt"])+ self.assertEqual(cfg["args"], ["--resident-experts"])self.assertNotIn("OS file cache", out)def test_start_with_gpus(self):@@ -360,7 +360,7 @@ class StartOnSeveralGpus(unittest.TestCase):cfg = json.loads(p.read_text())self.assertIsNone(code, out)self.assertEqual(cfg["gpu"], [0, 1])- self.assertEqual(cfg["args"], ["--mmap-experts", "--remote-expert-opt"]) # 0.1.39b: #578 on 2+ GPUs+ self.assertEqual(cfg["args"], ["--mmap-experts"]) # #1447: no helper cache, no --remote-expert-optself.assertIn("no layer split yet", out)self.assertTrue(call.called)diff --git a/tools/test_setup_unsloth.py b/tools/test_setup_unsloth.pyindex 6a467db48..fc31e2783 100644--- a/tools/test_setup_unsloth.py+++ b/tools/test_setup_unsloth.py@@ -569,7 +569,7 @@ class LayerSplit(unittest.TestCase):self.assertIsNone(code, out)self.assertTrue(started)self.assertEqual(cfg["gpu"], [0, 1])- self.assertEqual(cfg["args"], ["--pack", "p", "--kv", "int8", "--remote-expert-opt"]) # 0.1.39b: #578+ self.assertEqual(cfg["args"], ["--pack", "p", "--kv", "int8"]) # #1447: no helper cacheself.assertIn("no RAM budget", out)def test_start_with_gpus_without_the_ram_is_asked(self):