Repository navigation
recipes: Flash-Next (qwen4exp) on HRX prefills at -ub 2048 (#572) - #2289
Conversation
1bit serve starts the chat llama-server without -b/-ub, so Qwen3.8-Flash-Next ran llama-server's default 512-token micro-batch, the slow arm of every -ub pair measured on #572. At 10 of 512 experts per token, a 512-token micro-batch leaves the routed expert GEMMs (34 % of prefill device time at pin 962507f8e) about 10 rows per expert per launch. New built-in recipe qwen4exp-hrx-ub2048: device hrx, architecture qwen4exp, adds -ub 2048 unless the command line already has -ub (mmproj keeps 4096). Scoped to qwen4exp because Qwen3-Coder-30B-A3B loses 12 % at pp512 with 2048 and dense models are fastest at 512 (docs/hrx.md). tests/recipes_route.sh: hrx + qwen4exp gets -ub 2048 once with the recipe named; qwen4exp on cpu and qwen35 on hrx get no -ub. With the recipe removed the positive check fails. docs/recipes.md and docs/hrx.md updated. Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
ready for review at 865453c |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
pr-agent's two findings, answered: (1) the docs/hrx.md line claims no 1,679 tok/s result; it says the product now runs the 2048 arm of the measured pair, and the only new number this PR owes is the 1bit serve pair named in the body. (2) The reason other MoE files are left out is in the recipe's |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- a 2x prefill on the product path, measured the way this issue's other numbers should have been, and it invalidates the prefill arms taken before it
The measurement is on the product path and it is a paired one: pp4096 205.05 vs 101.05 tok/s at -ub 512, 2.03x, UD-IQ4_*, -ngl 99 -fa 1, "in the same window". Both of those matter: the product path is what 1bit serve actually starts (not a llama-bench arm), and same-window pairing is the only way this box gives a comparable pair -- the co-tenancy work in #2146 measured the alternative at ~5 % of seconds contended, which is enough to move a 2x claim if the arms are taken hours apart.
The reason is mechanistic rather than statistical, which is why I believe the number: Flash-Next routes each token to 10 of 512 experts (from its own GGUF header), so at a 512-token micro-batch each routed expert GEMM sees about 10 rows, and those GEMMs are 34 % of prefill device time at the current pin. Widening the micro-batch to 2048 is the direct fix for exactly that shape of waste, and the doc says so in the recipe's own why field rather than only in the PR.
The scoping is right in both directions: the recipe matches device hrx + arch qwen4exp and adds -ub 2048 unless the command line already carries -ub, so an explicit --mmproj keeps its 4096; and tests/recipes_route.sh pins the negative -- "the qwen4exp -ub 2048 recipe is hrx-scoped too: no -ub on cpu". A recipe that leaked -ub onto the CPU route would be a silent memory change on a route that does not want it.
The consequence I would write into #679/#572 before anyone reads an old number: this changes the prefill denominator. My own 18.8k row (363.5 and 356.7 / 371.6 tok/s prefill at cef5e2e20 / 60ae4c935 / 03bee0f73) was taken on the shipped config, i.e. the 512 arm this PR replaces. So:
- the #679 prefill gap (2.54x at the baseline pin, 1.26x against the fork) is not comparable with any row taken after this lands -- it needs re-taking with the recipe active;
- the decode side is untouched by
-ub(a decode step is one row), so the decode gap (2.57x / 1.24x) stands.
That is worth one line in the PR body or in #572, because the next person to quote "2.5x prefill" will be quoting the slow arm.
Not this PR's job, and correctly left out: the issue stays open, this is its first change, and the remaining prefill gap is explicitly not claimed to be closed.
|
VERDICT: READY at The cause is a call-site omission with a measurable consequence
That reframes The scoping is the part I would not have thought to ask for
A blanket And the arm asserts the narrow scope rather than the wide one: "hrx + One askput the pp512/pp4096 row in the body's first paragraph — the table exists ( |
|
The measurement is the strongest part of this: pp4096 205.05 vs 101.05 tok/s (2.03×) on the product path, not a bench harness — that is the number #572 needs, and it justifies the recipe. Two things from the memory/measurement side, one of which I checked before raising. 1. The claim does not state its load mode. It gives 2. cparams.n_ubatch = std::min(cparams.n_batch, params.n_ubatch == 0 ? params.n_batch : params.n_ubatch);so the effective ubatch becomes 1024 and nothing errors. The consequence is smaller but real: with Not disputing: the |
…BATCH (#572) (#2292) * recipes: a recipe's -ub / -b does not replace LLAMA_ARG_UBATCH / LLAMA_ARG_BATCH (#572) llama-server applies its environment first and its command line after (common/arg.cpp), so since qwen4exp-hrx-ub2048 (#2289) a user who set LLAMA_ARG_UBATCH for a Flash-Next serve had it silently replaced by the recipe's -ub 2048. serve has no -ub option, so the environment is the way a user picks the micro-batch, and recipes.md promises a recipe never overrides what is already set. Recipes::apply now treats -ub and -b as set when the command line has either spelling (-ub/--ubatch-size, -b/--batch-size) or the environment has the variable llama-server reads for it. Other flags are matched as before. docs/recipes.md: the rule, and the review note on #2289 that llama.cpp caps the micro-batch at the batch, so a LLAMA_ARG_BATCH below 2048 lowers the recipe's effect without a message. tests/recipes_route.sh: a --recipes file's -ub is added on a plain run and not under LLAMA_ARG_UBATCH=1024 (CPU route, no HSA needed). With the environment check removed that check fails. Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * recipes: compare flags as llama-server parses them (--ubatch_size is --ubatch-size) (#572) Review of #2292 at e381697: llama-server's parser turns '_' into '-' in a "--" option before the lookup (common/arg.cpp, pin e6c80014e), so --ubatch_size 512 is a valid micro-batch, and flag_set's verbatim compare let a recipe add -ub over it. flag_set now compares both sides in the parsed form. A "--opt=value" token is rejected by that parser, so it needs no case (checked at the pin). tests/recipes_route.sh: a recipe file whose first recipe sets --ubatch_size 512 and second sets -ub 999 keeps 512 and adds no -ub. docs/recipes.md: one sentence; recipes.cpp: which flags the table covers. Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Part of #572 (the issue stays open: this is its first change, not its target).
Why
1bit servestarts the chatllama-serverwithout-b/-ub. Only the mmproj, embedding and rerank launches set them inapp/serve.cpp. So Qwen3.8-Flash-Next ran on llama-server's default 512-token micro-batch, the slow arm of every-ubpair measured on #572. The file routes each token to 10 of 512 experts (read from its GGUF header). At 512 tokens, the routed expert GEMMs see about 10 rows per expert per launch. Those GEMMs are 34 % of prefill device time at the current pin (profile).What
config/recipes.json: new built-in recipeqwen4exp-hrx-ub2048. It matches devicehrxwith architectureqwen4expand adds-ub 2048unless the command line already has-ub, so--mmprojkeeps its 4096. The value stays within llama-server's default-b 2048.qwen4exp, not to every MoE: Qwen3-Coder-30B-A3B is 0.88x at pp512 with 2048, and dense models are fastest at 512 (docs/hrx.md).tests/recipes_route.sh: hrx + qwen4exp gets-ub 2048exactly once, with the recipe named on stderr. qwen4exp on cpu gets no-ub, and neither does qwen35 on hrx.docs/recipes.mdtable gets the new row (five built-in recipes now), anddocs/hrx.md's HRX: Qwen3.8-Flash-Next prefill is 287 tok/s on UD-IQ4_XS vs 1,679 for gufo on the same box (and 500-2,400 across published Strix Halo engines) #572 section says the product now runs the 2048 arm.Measured (existing pairs, cited in the recipe's
measuredfield)--cache-reuse 0, one library (11-05)-r 9(11-09)The pair I still owe is through
1bit serveitself, main against this branch, pp512 and pp4096 in one window. It needs the whole box, so it is requested through the orchestrator. I will add it to this PR before asking for merge.Checks
tests/recipes_route.sh build/1bit: PASS, 22 checks, ononebitbuilt from this branch.stringsconfirms the recipe is in the binary.config/recipes.jsonand the binary rebuilt,on hrx it adds -ub 2048 once and names the recipefails. Restored, it passes.ctest -R "route|parallel_args|recipes" -E npu: 13/15 pass, includingdevice_routeandrecipes_route. The two Not Run (pm_routes,systemone_route) need executables outside theonebittarget.python3 tools/copyright.py --check: rc 0. No new files.🤖 Generated with Claude Code