Skip to content

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: Qwen3.6 --parallel on small cards follows the measured cost (the slots may take 35% of the experts' room; 12 GB at 8K: 4, 16 GB at 32K: 2), and the text says the gain against one-at-a-time with drafts is small

Niko122134db47a8e1c3
diff --git a/docs/QWEN36.md b/docs/QWEN36.md
index ab9f0b600..96898ca21 100644
--- a/docs/QWEN36.md
+++ b/docs/QWEN36.md
@@ -103,13 +103,23 @@ The text is the same with and without it (every slot equal to its solo tokens).
**What a slot costs.** Each slot keeps its own cache in VRAM: 1.5 GB at a context of 32K (fp32 keys and values of the 10 attention layers
and the MTP block, 45 KB per token) and 0.07 GB of recurrent state. Setup writes the context for one conversation, so N slots take N times
that from the room the experts would have: on a card that does not hold every expert (12 and 16 GB, the hybrid mode) that is room the
-expert slots lose, and a batch reads more distinct experts from RAM. Setup **offers `--parallel`** on every card that has room for the sessions: up to 3-4 where every expert still
-fits (3 on a 32 GB card at 32K), and on a card that does not (12 and 16 GB) up to the count that leaves 5.5 GB of the card for the weights
-and the expert cache; there it says the price in the same breath, asks "How many requests at once?" (Enter keeps one at a time), and any
-number you give is kept. It pays on a card that does not hold every expert too: on the RTX 3060 12 GB, `--batch 4` leaves 37 of 256 experts per layer in VRAM instead of 54, so a request alone decodes
-64.7 tok/s instead of 68.3 (-5%, 3 interleaved runs each, medians of the 10 parity prompts), and four requests at once ran 99 tok/s together
-against 64 for one (table above; each of them slower: ~25 tok/s). The engine says what the sessions take before it
-allocates them and refuses (with the numbers) a count that cannot fit.
+expert slots lose, and a batch reads more distinct experts from RAM. Setup **offers `--parallel`** where the sessions do not eat the experts' room: up to 3-4 where every expert still fits (3 on a 32 GB card at
+32K), and on a card that does not (the hybrid mode) the count whose sessions take at most 35% of the room the experts would have, so it
+depends on the context you chose (12 GB: 4 slots at 8K, none at 32K; 16 GB: 2 slots at 32K). It says the price in the same breath, asks
+"How many requests at once?" (Enter keeps one at a time), and any number you give is kept. Measured on the hybrid cards (UD-Q4_K_XL, medians of 5
+interleaved pairs, `--mtp 2` as setup writes it; "together" = total tokens per second of N simultaneous requests, against ONE request at a time
+with the draft layer):
+
+| card, context | slots | one request alone, vs 1 slot | N together, vs one at a time |
+| --- | ---: | ---: | ---: |
+| RTX 3060 12 GB, 8K | 2 / 4 / 8 | -3.5% / -4.3% / -12% | 0.99x / 1.15x / 1.10x |
+| RTX A4000 16 GB, 32K | 2 / 4 | -10.6% / -29.9% | 1.03x / 0.76x |
+| Tesla P100 16 GB, 32K | 2 / 4 | -9% / -25% | (see notes-145-q36.md) |
+
+Without the draft layer (`--mtp 0`) the same slots give 1.26-1.64x together (3060 at 8K: 4 slots 1.64x for -5.5% alone), but a single request
+with drafts is already about 1.6x as fast as one without, so on a small card the main gain is that a second user starts at once; the
+speed gain is small. On a card that holds every expert (R9700 32 GB, 8K prompts) 4 slots run 1.45x one-at-a-time-with-drafts (1.59x with
+`--batch-mtp`). The engine says what the sessions take before it allocates them and refuses (with the numbers) a count that cannot fit.
In the hybrid mode the text of a request can differ a little between running alone and running beside others: the experts that sit on the
GPU or on the CPU change with the routing of all the requests, and the two compute with different rounding. With the slot tables fixed (`STRATA_Q36_FIXED_SLOTS=1`, a test setting) every slot equals its
diff --git a/setup.py b/setup.py
index 0f0f681e1..34729f547 100644
--- a/setup.py
+++ b/setup.py
@@ -5602,8 +5602,10 @@ def own_path_parallel_slot_gb(fam: dict, ctx: int) -> float:
return ctx * fam["kv_bytes_per_token"] / 1e9 + fam["state_gb"]
-PARALLEL_SMALL_ROOM_GB = 5.5 # a card that does not hold every expert: what the dense weights, the buffers and a useful
- # expert cache need beside the slots' sessions (a 12 GB card held 4 slots at 32K with this much)
+PARALLEL_SMALL_SHARE = 0.35 # a card that does not hold every expert: the slots' sessions may take this share of the room the
+ # experts would have (VRAM less ~4.5 GB for the dense weights and buffers). Measured (Q4_K_XL):
+ # RTX 3060 12 GB, 8K context, 4 slots (23% of that room): a request alone -4%; A4000 / P100
+ # 16 GB, 32K, 2 slots (27%): -11% / -9%, 4 slots (54%): -27% and no gain together.
def own_path_parallel_fits_all(fam: dict, model: str, vram_gb: float, ctx: int, n: int) -> bool:
@@ -5629,7 +5631,8 @@ def own_path_parallel_recommend(fam: dict, model: str, vram_gb: float, ctx: int)
return 0 # a card that holds every expert for one session only: more sessions would push experts to the CPU
# (measured on a 32 GB R9700 at 128K: 4 slots left 15 of 256 experts per layer, decode 81 tok/s
# against ~180): not offered there, a number asked for is kept
- return max([n for n in (2, 3, 4) if n * slot + PARALLEL_SMALL_ROOM_GB <= vram_gb], default=0)
+ room = max(vram_gb - 4.5, 0.0)
+ return max([n for n in (2, 3, 4) if n * slot <= PARALLEL_SMALL_SHARE * room], default=0)
def own_path_parallel_note(a_parallel, fam: dict, model: str, vram_gb: float, ctx: int) -> list:
@@ -5646,11 +5649,12 @@ def own_path_parallel_note(a_parallel, fam: dict, model: str, vram_gb: float, ct
if own_path_parallel_fits_all(fam, model, vram_gb, ctx, rec):
return [f"Several requests at once (opt-in): --parallel {rec} decodes up to {rec} together instead of one after "
f"the other (each takes ~{slot:.1f} GB of VRAM at this context; docs/BATCHING.md)."]
- return [f"Several requests at once (opt-in): --parallel {rec} decodes up to {rec} together instead of one after the "
- f"other. The price on this card, which does not hold every expert: each session takes ~{slot:.1f} GB of VRAM "
- "from the expert cache, so a request alone runs about 5% slower and each of the requests running together "
- "is slower than one alone; together they are faster (measured on an RTX 3060 12 GB: 4 requests 99 tok/s "
- "against 64 for one, 1.5x). Worth it for several users or agents at once, not for one chat "
+ return [f"Several requests at once (opt-in): --parallel {rec} decodes up to {rec} together, so a second user or agent "
+ "starts at once instead of waiting for the first. The price on this card, which does not hold every expert: "
+ f"each session takes ~{slot:.1f} GB of VRAM from the expert cache, so a request alone runs about 4-11% "
+ "slower, and next to one-at-a-time WITH the draft layer the requests together are only 1.0-1.15x faster "
+ "(measured, Q4_K_XL: RTX 3060 12 GB at 8K context, 4 requests: 1.15x, alone -4%; A4000 / P100 16 GB at "
+ "32K, 2 requests: 1.0x, alone -9 to -11%). Worth it for several users at once, not for one chat "
"(docs/QWEN36.md)."]
lines = [f"parallel requests: {a_parallel} at once (each takes ~{slot:.1f} GB of VRAM at this context, "
f"{a_parallel * slot:.1f} GB in all)"]
diff --git a/tools/test_setup_qwen36.py b/tools/test_setup_qwen36.py
index 7b31f4796..3106e6165 100644
--- a/tools/test_setup_qwen36.py
+++ b/tools/test_setup_qwen36.py
@@ -238,19 +238,22 @@ class InstallOwnPath(unittest.TestCase):
self.assertNotIn("parallel", self.cfg)
self.assertIn("--parallel 3", out)
# a 12 GB card runs the hybrid mode: parallel is offered there too, with its price said (never forced)
- self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 12.0, 32768), 4)
+ # (measured: 12 GB at 8K, 4 slots: a request alone -4%; 16 GB at 32K, 2 slots -9 to -11%, 4 slots no gain together)
+ self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 12.0, 8192), 4)
+ self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 12.0, 32768), 0)
+ self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 16.0, 32768), 2)
self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 12.0, 131072), 0)
self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 8.0, 32768), 0)
# a card that holds every expert for ONE session only is not offered more: 4 slots on a 32 GB R9700 at 128K left
# 15 of 256 experts per layer in VRAM and decode ran 81 tok/s against ~180
self.assertEqual(setup.own_path_parallel_recommend(fam, "UD-Q4_K_XL", 31.9, 131072), 0)
- rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no")
+ rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", context=8192)
self.assertNotIn("parallel", self.cfg)
self.assertIn("--parallel 4", out)
self.assertIn("does not hold every expert", out)
- self.assertIn("about 5% slower", out)
- self.assertIn("1.5x", out)
- rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", parallel=6)
+ self.assertIn("a request alone runs about 4-11% slower", out)
+ self.assertIn("WITH the draft layer", out)
+ rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", context=8192, parallel=6)
self.assertEqual(self.cfg["parallel"], 6)
self.assertIn("recommended for this card: 4", out)
self.assertIn("kept as you chose", out)
@@ -258,7 +261,7 @@ class InstallOwnPath(unittest.TestCase):
self.assertEqual(self.cfg["parallel"], 4)
self.assertIn("recommended for this card: one at a time", out)
self.assertIn("kept as you chose", out)
- rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", parallel=1)
+ rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", context=8192, parallel=1)
self.assertEqual(self.cfg["parallel"], 1)
rc, out = self.install(model="UD-Q4_K_XL", vram=32.0, vision="no", parallel=12)
self.assertIn("at most 8", out)
@@ -276,7 +279,7 @@ class InstallOwnPath(unittest.TestCase):
for answers, want in ((["1"], None), (["3"], 3)):
self.cfg = {}
with mock.patch.object(setup, "ask", ask):
- rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", yes=False)
+ rc, out = self.install(model="UD-Q4_K_XL", vram=12.0, vision="no", context=8192, yes=False)
self.assertEqual(rc, 0, out)
self.assertEqual(self.cfg.get("parallel"), want)
self.assertIn("--parallel 4", out) # the offer and its price are said before the question