You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NPU: Qwen3.8-27B-NPU2 (FastFlowLM Q4NX, 17.1 GB) on the NPU route and as the hybrid prefill side #587
FastFlowLM published FastFlowLM/Qwen3.8-27B-NPU2 (Apache-2.0, 2026-09-29): model.q4nx 17.10 GB + vision_weight.q4nx 0.96 GB, Qwen3.8-27B geometry (qwen35 family, same as our HRX 27B rows), with a generic Qwen3.8 card. Newer FLM drops in the same week: D3-Mini/Nano/Lite-NPU2 (23–25 Oct), Nemotron-3.5-Bolt-E4B-NPU2 (24 Oct), MiniCPM-V-4.7-1B-NPU2 (12 Oct).
Why it matters here:
Our NPU engine runs FLM Q4NX files on our own ELFs (the largest so far: Qwen3.6-35B-A3B on the lax kernels at 16.3–16.5 tok/s). A dense 27B Q4NX is the first file that lines up exactly with the leaderboard's main model, so NPU decode and prefill numbers become directly comparable with the HRX rows.
Hybrid (owner 23 Oct: NPU prefill + HRX decode) needs a 27B prefill side on the NPU; this is it, without converting our own GGUF.
Task, after the OS release gate has the GPU/NPU free:
Fetch to strixhalo (18 GB; disk floor 60 GB; delete afterwards if not kept), register the file for the NPU route (registry + Q4NX chunk check with npu/q4nx), note the vision weights as unused for now.
Measure on the NPU engine: decode tok/s (one-token), prefill tok/s at 32-token chunks (layerP), KLD vs the BF16 base on the leaderboard's text, GSM8K n=40, under the same tools/bench.py conditions as the HRX rows; record as a leaderboard NPU row (private data).
Hybrid probe: --device hybrid with this file as the prefill provider and the HRX UD-Q4_K_XL for decode; report the prefill speed-up and whether the KV hand-off holds KLD.
Census: FLM *-NPU2 drops are not architectures, so the daily census does not see them; add a one-line watch for new FastFlowLM Q4NX repos to the census-watch summary.
Attribution rules as in NOTICE (FastFlowLM kernels MIT, acknowledged; our ELFs). Private add-on only; no NPU kernel content in public text.
Status update with numbers — the device route now works on main, and the cost model is measured.
What is fixed and merged
npu: fix a Q4NX GDN model on the device path (#587) #618 — GDN model on the device path: padded ssm_alpha_proj/ssm_beta_proj rows, the weight-cache
key-2 collision between ssm_out_proj (N=5120) and gate_proj (N=17408) that produced !!!!!!!!,
and the per-token re-dequantise that made it 54 s/token.
npu: prefill a GDN model in one chunk instead of one token at a time (#587) #624 (open) — batched prefill: gdn_layer_batch, reset() clearing the recurrent state, step_batch loading GDN host parameters per layer, and the gated head width. Measured on strixhalo,
prompt "The capital of France is", greedy: 2 298 submits / 145.7 s → 350 submits / 58.1 s, same Paris, NPU_BATCH_CHECK MATCH on all 64 layers.
Qwen3.8-27B-NPU2 runs on the NPU route (1bit forward-serve -m model.q4nx --kernels kernels/)
with 7 geometry-derived full ELFs built by the family emitter — no private kernel work was needed for
the route itself.
Why decode is still slow, measured not guessed
One decode token streams 24.3 GB of int8 weights in ~11 s ⇒ ~2.2 GB/s effective DMA bandwidth is
the ceiling, not launch overhead. A two-run runlist probe (one submit, one wait, 115 289 us vs two
submits, 118 502 us) shows batching submits saves nothing.
Hybrid prefill: recommending against, for this model. NPU prefill is 5 tokens in 58 s, so NPU
prefill + HRX decode cannot beat HRX decode alone on the iGPU here. The NPU path's win is watts, not
tokens/s.
Remaining lever is design work (bigger DMA bursts / more columns, or lower bpw), which lives in the
private kernel tree — flagging as the owner's call rather than doing it here.
What is still missing is what needs the device, per the issue's own task list: fetch FastFlowLM/Qwen3.8-27B-NPU2 (model.q4nx 17.10 GB + vision_weight.q4nx 0.96 GB) to strixhalo and run it on the NPU route.
Classification: needs GPU measurement (NPU lane, not this box) — decode tok/s and prefill wall clock for the dense 27B Q4NX against the existing 17.1 GB / N=4-safe memory record, so the NPU row becomes comparable with the HRX 27B rows. Nothing here is blocked on code.
Root-caused and fixed — it was never the model, it was the context hand-off.
Cause. Lemonade passes each model's declared window to the backend: read_flm_max_context_window (fastflowlm_models.cpp:109) returns max_position_embeddings from the model's config.json — 57139 for qwen3.8-mtp:27b — and FastFlowLMServer::load() hands it to flm serve --ctx-len. FLM's NPU attention layout allocates ctx + 128 and can walk at most 16384 chunks (MAX_L_LIMIT), so it refuses to build the model:
[ERROR] Failed to load model: attn_layout: max_len 16512 puts the deepest pass's replay at 1032 chunks,
past the 1024 its 10-bit BD dimension can walk. max_len is at most 16384 (MAX_L_LIMIT)
The server still answers /v1/models with that model failed, so the failure surfaced as HTTP 500 on the first request instead of at load.
Why any value above 8192 is broken, not just 57139. FLM rounds the request up to its 16384 tier, and that tier allocates ctx + 128 = 16512, which is over its own limit — so the tier can never be built. Measured on the box, same model and prompt, each value a real chat completion:
Failed to load model (all → 16384 tier → max_len 16512)
8192
replies, 1.57 tok/s
So 8192 is the servable ceiling on this NPU path, and the model itself is fine: served directly it runs 1.54 tok/s with MTP speculative decoding (acceptance 6.00, hit rate 85.7 %).
Fix — 1bit-MONSTER/lemonade#26: clamp ctx_size where it enters the FLM launch (with a warning naming both numbers), and advertise min(config window, 8192) in the model metadata, because the router auto-tunes ctx_size from that advertised window — it was reading 57139 back into the launch.
Verified end to end on the rebuilt binary, through Lemonade on :8088, with the request that used to 500:
Remaining for this issue: the hybrid-prefix half (27B on NPU as a prefill stage for an HRX target) is untouched — that is a separate measurement and needs the GPU lane.
The dequant path is real. npu/forward/src/q4nx_forward.cpp:2560-2561 (at 5c2aee2):
constbooldense_weights_cached=lin_kd_==0&& !mla_&&ple_dim_==0&&n_expert_==0&&weight_cached(0);
if (!dense_weights_cached&& !load_layer(l)) { ... }
so every GDN layer (lin_kd_ != 0) re-enters load_layer on every token, dense-MLP tail included (deqT(&lw->gate_proj_weight, wg_.data(), c_.IM, H) and the up/down pair, npu/forward/src/q4nx_forward.cpp:1127-1129). The comment above the guard says this is deliberate — "GDN/MLA/PLE load members used outside the GEMMs, so they keep loading every token" — so the measurement has to argue against a stated intent, not an oversight.
It is also visible in the profile: ~/lb/587-gbnos-server-20261027T213012Z.log prints [prof] npu_gemm n=50 pack=42.3 quant+launch=0.7 wait=24.9 readback=0.1 ms (N=17408), with pack flat across N=17408/6144/5120 and flat over the run's first ~350 launches (one token's dispatch count) — 42.3 ms × 350 ≈ 14.8 s. Caveat: the same field decays later in that log (38.6 at n=400 down to 7.0 at n=2200), so it behaves like a running mean over a mostly one-time cost and does not by itself establish a sustained per-token 14.8 s. wait stays 24.4-25.1 ms throughout, flat in N.
But the box already holds an A/B of exactly this fix from 2026-10-27 — ~/lb/587-ab-20261027T164909Z.log reads unpatched: wall=462s and patched: wall=855s (~/lb/587-ab.sh: unpatched ~/wt/587-npudx-build/1bit, patched ~/wt/587-speed-build/1bit, 2 tokens, both arms under taskset -c 0-3). The cached build measured ~1.85× slower, 855/462. So the per-token dequant is visible in the profile and caching it measured worse, and one A/B pair on a 462 s baseline cannot separate the fix from drift — least of all with a host-side workload pinned to four cores.
Next: re-run the A/B interleaved (A/B/A/B) with the patched run's [prof] lines captured. Until that exists, 63.1 s/token (docs/npu-leaderboard.md:32-33) should be read as a host-side number.
Correction to the comment above, from the same evidence — the A/B sentence is wrong.
~/lb/587-ab.sh compares UNP=~/wt/587-npudx-build/1bit with PAT=~/wt/587-speed-build/1bit, i.e. the NPU-dx and speed builds, not a weight-cache build. The cache build (~/wt/587-cache-build/1bit) is only the BIN default of a different script, ~/lb/587-cachemetric.sh, and there is no ~/lb/587-cache-*.log on the box.
So: 462 s vs 855 s says nothing about caching the GDN dense tail. The cache guard has never been measured. What survives unchanged:
npu/forward/src/q4nx_forward.cpp:2560-2561 still sets dense_weights_cached = lin_kd_ == 0 && ..., so GDN models re-load_layer per token — and the guard's own comment at :2556-2559 says that reload is deliberate for GDN/MLA/PLE, which makes this a design question, not obviously a defect.
pack=42.3 ms is real but decays in the same log (38.6 at n=400 → 7.0 at n=2200): running-mean shaped, so ~14.8 s/token is not established.
The decisive experiment is therefore still the one the issue asks for: build the cache variant, run it interleaved against the current build on the same box, and capture [prof] for both arms. Until then 63.1 s/token stands as measured, cause unknown.
The dense-weight cache guard, measured for the first time — and it is inert on this model by construction.
Run: ~/lb/587-cache-20261030/run-20261030T030506Z/ (ab.sh, results.tsv, driver.log, per-request client JSON). strixhalo, 2026-10-30 03:05–03:51 UTC. Qwen3.8-27B-NPU2 (qwen3_5, 64 layers), one tree (~/wt/w-587-src = main + the NPU_FFN_CACHE patch, nothing else), 5 rounds × 3 arms with the arms rotated through the three slots round by round, two token budgets (1 and 8), prompt Count from 1 to 20, separated by commas: 1, 2, 3,, greedy. Server PID + /proc start time + port owner checked before and after every request: 0 void rows out of 30. MemAvailable ≥ 104 G throughout.
What each arm toggles, exactly
arm
1bit sha256
what differs
cache-on
a0be0114…
the tree as it stands; the guard at npu/forward/src/q4nx_forward.cpp:2593 evaluated normally
cache-off
a2bed0f7…
same tree, that one line replaced by const bool dense_weights_cached = false;
tail-cached
a0be0114… (the same binary as cache-on)
NPU_FFN_CACHE=1 → ffn_cache_ → ffn_tail_cached() (:831), the second gate on the same three dequants at :1013 and :1158
Only two behaviours exist between three arms, and the second one is reached by an env var, not by a rebuild.
Why cache-on and cache-off cannot differ on this model
The guard is lin_kd_ == 0 && !mla_ && …. lin_kd_ = lin_nkh_ * lin_khd_ (:355) is model-level, and this model's config.json is qwen3_5 with linear_attention in layer_types (linear_num_key_heads 16 × linear_key_head_dim 128 = 2048), so lin_kd_ == 0 is false and short-circuits the whole expression to false — the exact value the cache-off arm forces. The two arms are the same code path. The A/B is a negative control, not a test of caching: it establishes that the binaries and the harness are stable, and it cannot argue for or against the guard.
Numbers (my own re-derivation from results.tsv, mean ± population sd over the 5 rounds)
n = 8, wall seconds:
arm
mean wall
sd
CPU over the request
CPU/token
cache-on
117.403
0.195
506.4 s
63.30 s
cache-off
117.443
0.156
506.1 s
63.26 s
tail-cached
104.524
0.553
182.8 s
22.85 s
n=8 paired per-round delta on − off: −0.040 ± 0.102 s, largest |delta| 0.181 s (0.15%). Identical within noise, as the source says it must be.
n=8 tail − off: −12.919 s (−11.0%), and negative in all five rounds (−12.46, −12.62, −12.72, −12.74, −14.05); n=8 tail − on: −12.879 s.
n=1: on 61.485 ± 6.641, off 58.528 ± 0.355, tail 56.399 ± 0.966. The cache-on spread is one cold-start outlier (r1 74.750 s); excluding it, on = 58.17 ± 0.44 s. Same story: no arm effect at 1 token.
Resident memory does not move: MemAvailable 119.3–119.6 G before, 76.3–76.8 G after, in every arm. The tail cache costs no extra residency.
Unit correction on my own earlier note: the "~505 ms → ~181 ms" figure is 506 s → 183 s of CPU for the whole 8-token request (63.3 → 22.9 s/token) — seconds, not milliseconds.
Correctness: all 15 requests returned the same continuation 4, 5, 6; no arm diverged, and every round's [ffn] dense-tail cache on/off (NPU_FFN_CACHE=…) line confirms the state the binary itself believed it was in.
What this means
:2593 is dead code for any hybrid GDN model. It is still right for dense models, so it should stay — but it must stop being read as "the GDN cache switch". For GDN, ffn_tail_cached() is the only cache switch that exists.
The win that is actually there: −11% wall, −64% CPU per token, identical output, from a knob that is still default off (npu/forward/include/q4nx_forward.h:237), so nothing on main gets it today.
Next: make the dense-tail cache the default for GDN models on the NPU route behind a size/footprint guard, add the docs/npu.md line, and prove it with this same driver.
Decision (orchestrator, 2026-10-31 12:30 ADT): this issue stays OPEN — closing it now would close it without a
single measured 27B number on the current path.
Close condition: the pb16i engine wiring passes its greedy-text acceptance in #697 (pb16i + sealed ELF
output identical to the int8 container on 3 prompts). Only then is there a 27B row that is a result rather than a
number measured on a broken path — the 1.22–1.50 s/token figures in PR #692 are exactly that today.
What the closing comment will carry: the measured 27B numbers on the accepted path, side by side with the
numbers this issue already owns — the FastFlowLM Q4NX route at 1.54–1.57 tok/s through Lemonade with the ctx_size clamp at 8192 (#26 in the lemonade repo), merge 63.1 → 22.85 s/token from the dense-tail cache
(#637), and the pb16i/sealed-ELF token time once it is correct. No number goes in that comment that was not
measured on the shipped path.
The code items are all merged (#617, #618, #624, #637, #658); the only thing left is this measurement,
so the issue is a waiting-on-#697 row, not a feature gap. Hybrid prefill stays recommended against (NPU
prefill is 5 tokens in 58 s here), and that stands as the recorded answer to item 3.
Disposition: parked on the #697 acceptance, by the owner's own decision (recorded here 2026-10-31 12:30 ADT: "this issue stays OPEN — closing it now would close it without a single measured 27B number on the current path").
The close condition is explicit: the pb16i engine wiring passes its greedy-text acceptance in #697 (pb16i + sealed ELF output identical to the int8 container on 3 prompts). Only then is a 27B row a result rather than a number measured on a broken path — the 1.22-1.50 s/token figures in PR #692 are exactly that today.
Unpark:#697's acceptance passes; then measure the 27B NPU row and record it here with the closing comment the issue already describes.
Unparked and worked as TISSUES-ALL #587. The unpark condition is met, checked rather than assumed:#697 closed
2026-11-01T02:50Z with the acceptance measured (window11 3/3 text-identical, 1.72 s/token) and PR #728 merged
2026-11-01T09:51Z (46353fe9) — so a 27B number measured now is a result, not a number on a broken path.
What was still open was the registration, and it was wrong by 12 packs.tools/registry_build.py's NPU_ARCHS listed only the MoE qwen3.5 class, never the dense one, so registry/architectures.json mapped the whole
dense qwen35 family hrx-only and the daily census-watch (engine#588, the item-4 watch this issue asked for, which
is live) reported qwen35 (12 pack(s)) under "Q4NX (NPU) packs for a family the NPU route does not serve" — including this issue's own model, FastFlowLM/Qwen3.8-27B-NPU2. census_watch.py --full before vs after the fix: 38 → 26 unserved packs, no qwen35 line at all, and the repo now prints registry Qwen3_5ForConditionalGeneration -> qwen35 npu route: qwen3_5.
PR #1278 (9040fc97, Fixes #587): the dense family is registered for npu (the two text-LM classes; the bare
vision wrapper Qwen3_5Model is deliberately not claimed, since vision_weight.q4nx is a separate file this route does
not load), the registry regenerated against the pinned llama.cpp (--check clean, counts.npu 7 → 9), docs/npu.md's qwen35 row rewritten from "not served: no NPU kernel set" to the measured answer, and the census
tests moved off their D3-Mini fixture onto a family that is still HRX-only. Host-only: no device, no kernel, no ELF.
Item status against the four tasks in the issue
Fetch / register with the npu/q4nx chunk check — register: done in registry: the dense qwen3.5 family is served on the NPU route, so Qwen3.8-27B-NPU2's packs are not a census gap (Fixes #587) #1278 (registry + docs). The chunk check on
the served directory (tools/check_q4nx_dir.py ~/models/npu/bonsai2-27b-t2s2-serve) says "chunk layout verified:
every quantized tensor's shape names a known chunk kind" plus 16 padded-grid WARNs on the full-attention q_proj
(5120 → 10240, engine#1097, closed 2026-11-05). The file itself is on the box (16,832,423,048 B + kernels, plan.json).
Census watch — already delivered as engine#588 and verified by running it today, not by reading its docstring;
this PR supplies the registry answer it was missing.
Closing via #1278 therefore closes the registration and the census half; items 2's fresh row, its KLD/GSM8K rows and
item 3's hand-off measurement are carried by the three commands above and by #1278's body, so nothing here is lost by
the close.
Item 2 is now measured on the device — 0.2902 s/token. PR #1278's second commit a3139ade carries three
leaderboard records from one npu-hold ticket on the sealed single-ELF ternary rung of this container
(~/models/npu/bonsai2-27b-t2s2-serve, binary 1bit t2s2-20261104, --kernels …/kernels-m16, port 18099, greedy,
one 13-token prompt, 0 amdxdna errors, clean exit):
metric
value
how it was taken
decode
0.2902 s/token (3.45 tok/s)
slope between completion lengths, so prefill and per-request cost cancel: (n5−n1)/4 = 0.2884, (n9−n1)/8 = 0.2920, spread 1.3 %, 3 repeats each (n=1 0.9537 ± 0.0038 s, n=5 2.1073 ± 0.0150 s, n=9 3.2900 ± 0.0105 s)
prefill
19.55 tok/s
marginal cost of a prompt token from two prompt lengths: 51.1 ms/token over 24 extra tokens (t37 2.1810 ± 0.0344 s vs t13 0.9537 ± 0.0038 s)
first token
22.811 s cold
/health answers ~4 s after launch before the container loads, so the load is inside the first request; warm, the same prompt is 0.9537 s
The container's whole progression is now on the leaderboard: 63.1 s/token and 145.7 s first token on the int8
rung (2026-10-27) → 1.72 s/token on the per-role PB16i set (#697/#728) → 0.2902 s/token here. That is the row
the close comment was waiting for, and it is why the qwen35 row in docs/npu.md says served, and measured
instead of not served.
Two operational facts worth having in the issue, because they cost me two failed tickets and will cost the next
person the same: --kernels must point at the kernels-m16 subdirectory (18 _t2s2-tagged ELFs including the
sealed one) — pointing at the model directory makes the serve refuse for a missing full_i8_QKV_K5120_N14336.elf —
and the binary the keeper serves this rung with is ~/wt/serve-bin/t2s2-20261104/1bit, not the 11-02 build.
Both were read off the keeper's own launch line rather than guessed. The device was blocked for ~5 h before that by
an orphaned host-GEMM serve holding /tmp/1bit-npu-device.lock exclusively (pid 2231177, ~/wt/issue1035-npubuild, :18095); it released at 16:28:30 and the ticket then ran in 62 s.
Still open on the issue, deliberately: KLD vs the BF16 base on the leaderboard text and GSM8K n=40 — both need a
reference pass plus ~2 h of decode at 0.29 s/token, i.e. their own ticket, not a footnote. Item 3's hybrid answer is
unchanged and now has its number: NPU prefill 19.55 tok/s against HRX's ~287 tok/s on the same box, so NPU prefill +
HRX decode stays "recommended against", with the KV hand-off untested because the speed-up precondition still fails.
Correction to my own close-out, checked against main rather than assumed: the measured row is not in the merge. #1278's queue merge (918f731a) landed at 19:38Z, while the measurement commit a3139ade was pushed at 20:54Z —
1 h 16 m after the merge — so it went to a branch whose PR was already closed and never reached main
(git ls-tree -r origin/main bench/npu-leaderboard/ has no *20261106* record; docs/npu.md on main has no 0.2902). My comment above said the numbers were in #1278's second commit, which was true of the branch and false of main; the branch also still exists, so this is easy to check both ways.
Fixed as PR #1296 (afbd05c4, branch 1bit/tissues-587-row off main, that commit rebased, no other change). So the
record now reads: the registry/census half of #587 is merged (#1278); the device row — 0.2902 s/token decode (3.45
tok/s), 19.55 tok/s prefill, 22.811 s cold first token, all with their derivations and caveats — is in #1296 awaiting
the queue. The two operational facts at the end of my previous comment stand (--kernels …/kernels-m16, the Nov-4
binary), and so does the still-unmeasured pair (KLD vs the BF16 base, GSM8K n=40), which needs its own ticket.
Activity
tools: check a Q4NX directory's chunk layout before it is served (#587)…
npu: fix a Q4NX GDN model on the device path (#587) (#618)
bong-water-water-bong commentedon Oct 27, 2026
Status update with numbers — the device route now works on
main, and the cost model is measured.What is fixed and merged
ssm_alpha_proj/ssm_beta_projrows, the weight-cachekey-2 collision between
ssm_out_proj(N=5120) andgate_proj(N=17408) that produced!!!!!!!!,and the per-token re-dequantise that made it 54 s/token.
gdn_layer_batch,reset()clearing the recurrent state,step_batchloading GDN host parameters per layer, and the gated head width. Measured on strixhalo,prompt "The capital of France is", greedy: 2 298 submits / 145.7 s → 350 submits / 58.1 s, same
Paris,NPU_BATCH_CHECKMATCH on all 64 layers.Qwen3.8-27B-NPU2 runs on the NPU route (
1bit forward-serve -m model.q4nx --kernels kernels/)with 7 geometry-derived full ELFs built by the family emitter — no private kernel work was needed for
the route itself.
Why decode is still slow, measured not guessed
One decode token streams 24.3 GB of int8 weights in ~11 s ⇒ ~2.2 GB/s effective DMA bandwidth is
the ceiling, not launch overhead. A two-run runlist probe (one submit, one wait, 115 289 us vs two
submits, 118 502 us) shows batching submits saves nothing.
Hybrid prefill: recommending against, for this model. NPU prefill is 5 tokens in 58 s, so NPU
prefill + HRX decode cannot beat HRX decode alone on the iGPU here. The NPU path's win is watts, not
tokens/s.
Remaining lever is design work (bigger DMA bursts / more columns, or lower bpw), which lives in the
private kernel tree — flagging as the owner's call rather than doing it here.
npu: batch prefill through GDN layers and fix the gated head width (#587
bong-water-water-bong commentedon Oct 28, 2026
Status check against
main(8d2b25d) — most of the surrounding work already landed, so the issue is now down to the fetch + the NPU run:Merged and on
main:tools/check_q4nx_dir.py).step_batchchunk instead of one token at a time (this issue's own prefill item).docs/npu-leaderboard.md:31-35:435.9 s(pre-npu: 64x64 tiled transpose for projection assembly (first-token latency) #622) ->145.7 s, batched prefill58.14 sfor a 5-token chunk versus145.7 ssequential.What is still missing is what needs the device, per the issue's own task list: fetch
FastFlowLM/Qwen3.8-27B-NPU2(model.q4nx17.10 GB +vision_weight.q4nx0.96 GB) to strixhalo and run it on the NPU route.Classification: needs GPU measurement (NPU lane, not this box) — decode tok/s and prefill wall clock for the dense 27B Q4NX against the existing 17.1 GB /
N=4-safe memory record, so the NPU row becomes comparable with the HRX 27B rows. Nothing here is blocked on code.fastflowlm: clamp ctx_size to what the NPU attention layout can allocate
bong-water-water-bong commentedon Oct 29, 2026
Root-caused and fixed — it was never the model, it was the context hand-off.
Cause. Lemonade passes each model's declared window to the backend:
read_flm_max_context_window(fastflowlm_models.cpp:109) returnsmax_position_embeddingsfrom the model'sconfig.json— 57139 forqwen3.8-mtp:27b— andFastFlowLMServer::load()hands it toflm serve --ctx-len. FLM's NPU attention layout allocatesctx + 128and can walk at most 16384 chunks (MAX_L_LIMIT), so it refuses to build the model:The server still answers
/v1/modelswith that model failed, so the failure surfaced asHTTP 500on the first request instead of at load.Why any value above 8192 is broken, not just 57139. FLM rounds the request up to its 16384 tier, and that tier allocates
ctx + 128= 16512, which is over its own limit — so the tier can never be built. Measured on the box, same model and prompt, each value a real chat completion:Failed to load model(all → 16384 tier →max_len16512)So 8192 is the servable ceiling on this NPU path, and the model itself is fine: served directly it runs 1.54 tok/s with MTP speculative decoding (acceptance 6.00, hit rate 85.7 %).
Fix —
1bit-MONSTER/lemonade#26: clampctx_sizewhere it enters the FLM launch (with a warning naming both numbers), and advertisemin(config window, 8192)in the model metadata, because the router auto-tunesctx_sizefrom that advertised window — it was reading 57139 back into the launch.Verified end to end on the rebuilt binary, through Lemonade on
:8088, with the request that used to 500:Remaining for this issue: the hybrid-prefix half (27B on NPU as a prefill stage for an HRX target) is untouched — that is a separate measurement and needs the GPU lane.
fastflowlm: clamp ctx_size to what the NPU attention layout can alloc…
bong-water-water-bong commentedon Oct 30, 2026
Reporting a contradiction, not a cause.
The dequant path is real.
npu/forward/src/q4nx_forward.cpp:2560-2561(at5c2aee2):so every GDN layer (
lin_kd_ != 0) re-entersload_layeron every token, dense-MLP tail included (deqT(&lw->gate_proj_weight, wg_.data(), c_.IM, H)and the up/down pair,npu/forward/src/q4nx_forward.cpp:1127-1129). The comment above the guard says this is deliberate — "GDN/MLA/PLE load members used outside the GEMMs, so they keep loading every token" — so the measurement has to argue against a stated intent, not an oversight.It is also visible in the profile:
~/lb/587-gbnos-server-20261027T213012Z.logprints[prof] npu_gemm n=50 pack=42.3 quant+launch=0.7 wait=24.9 readback=0.1 ms (N=17408), withpackflat across N=17408/6144/5120 and flat over the run's first ~350 launches (one token's dispatch count) — 42.3 ms × 350 ≈ 14.8 s. Caveat: the same field decays later in that log (38.6 at n=400 down to 7.0 at n=2200), so it behaves like a running mean over a mostly one-time cost and does not by itself establish a sustained per-token 14.8 s.waitstays 24.4-25.1 ms throughout, flat in N.But the box already holds an A/B of exactly this fix from 2026-10-27 —
~/lb/587-ab-20261027T164909Z.logreadsunpatched: wall=462sandpatched: wall=855s(~/lb/587-ab.sh: unpatched~/wt/587-npudx-build/1bit, patched~/wt/587-speed-build/1bit, 2 tokens, both arms undertaskset -c 0-3). The cached build measured ~1.85× slower, 855/462. So the per-token dequant is visible in the profile and caching it measured worse, and one A/B pair on a 462 s baseline cannot separate the fix from drift — least of all with a host-side workload pinned to four cores.Next: re-run the A/B interleaved (A/B/A/B) with the patched run's
[prof]lines captured. Until that exists, 63.1 s/token (docs/npu-leaderboard.md:32-33) should be read as a host-side number.bong-water-water-bong commentedon Oct 30, 2026
Correction to the comment above, from the same evidence — the A/B sentence is wrong.
~/lb/587-ab.shcomparesUNP=~/wt/587-npudx-build/1bitwithPAT=~/wt/587-speed-build/1bit, i.e. the NPU-dx and speed builds, not a weight-cache build. The cache build (~/wt/587-cache-build/1bit) is only theBINdefault of a different script,~/lb/587-cachemetric.sh, and there is no~/lb/587-cache-*.logon the box.So:
462 svs855 ssays nothing about caching the GDN dense tail. The cache guard has never been measured. What survives unchanged:npu/forward/src/q4nx_forward.cpp:2560-2561still setsdense_weights_cached = lin_kd_ == 0 && ..., so GDN models re-load_layerper token — and the guard's own comment at:2556-2559says that reload is deliberate for GDN/MLA/PLE, which makes this a design question, not obviously a defect.pack=42.3 msis real but decays in the same log (38.6 at n=400 → 7.0 at n=2200): running-mean shaped, so ~14.8 s/token is not established.The decisive experiment is therefore still the one the issue asks for: build the cache variant, run it interleaved against the current build on the same box, and capture
[prof]for both arms. Until then 63.1 s/token stands as measured, cause unknown.bong-water-water-bong commentedon Oct 30, 2026
The dense-weight cache guard, measured for the first time — and it is inert on this model by construction.
Run:
~/lb/587-cache-20261030/run-20261030T030506Z/(ab.sh,results.tsv,driver.log, per-request client JSON). strixhalo, 2026-10-30 03:05–03:51 UTC. Qwen3.8-27B-NPU2 (qwen3_5, 64 layers), one tree (~/wt/w-587-src=main+ theNPU_FFN_CACHEpatch, nothing else), 5 rounds × 3 arms with the arms rotated through the three slots round by round, two token budgets (1 and 8), promptCount from 1 to 20, separated by commas: 1, 2, 3,, greedy. Server PID +/procstart time + port owner checked before and after every request: 0 void rows out of 30. MemAvailable ≥ 104 G throughout.What each arm toggles, exactly
1bitsha256a0be0114…npu/forward/src/q4nx_forward.cpp:2593evaluated normallya2bed0f7…const bool dense_weights_cached = false;a0be0114…(the same binary as cache-on)NPU_FFN_CACHE=1→ffn_cache_→ffn_tail_cached()(:831), the second gate on the same three dequants at:1013and:1158Only two behaviours exist between three arms, and the second one is reached by an env var, not by a rebuild.
Why cache-on and cache-off cannot differ on this model
The guard is
lin_kd_ == 0 && !mla_ && ….lin_kd_ = lin_nkh_ * lin_khd_(:355) is model-level, and this model'sconfig.jsonisqwen3_5withlinear_attentioninlayer_types(linear_num_key_heads16 ×linear_key_head_dim128 = 2048), solin_kd_ == 0is false and short-circuits the whole expression tofalse— the exact value the cache-off arm forces. The two arms are the same code path. The A/B is a negative control, not a test of caching: it establishes that the binaries and the harness are stable, and it cannot argue for or against the guard.Numbers (my own re-derivation from
results.tsv, mean ± population sd over the 5 rounds)n = 8, wall seconds:
Unit correction on my own earlier note: the "~505 ms → ~181 ms" figure is 506 s → 183 s of CPU for the whole 8-token request (63.3 → 22.9 s/token) — seconds, not milliseconds.
Correctness: all 15 requests returned the same continuation
4, 5, 6; no arm diverged, and every round's[ffn] dense-tail cache on/off (NPU_FFN_CACHE=…)line confirms the state the binary itself believed it was in.What this means
:2593is dead code for any hybrid GDN model. It is still right for dense models, so it should stay — but it must stop being read as "the GDN cache switch". For GDN,ffn_tail_cached()is the only cache switch that exists.default off(npu/forward/include/q4nx_forward.h:237), so nothing onmaingets it today.docs/npu.mdline, and prove it with this same driver.q4nx: cross-check our packer against the official converter (#587) (#658
npu: cache the dense FFN tail for GDN models by default (#587) (#637)
bong-water-water-bong commentedon Oct 31, 2026
Decision (orchestrator, 2026-10-31 12:30 ADT): this issue stays OPEN — closing it now would close it without a
single measured 27B number on the current path.
Close condition: the pb16i engine wiring passes its greedy-text acceptance in #697 (pb16i + sealed ELF
output identical to the int8 container on 3 prompts). Only then is there a 27B row that is a result rather than a
number measured on a broken path — the 1.22–1.50 s/token figures in PR #692 are exactly that today.
What the closing comment will carry: the measured 27B numbers on the accepted path, side by side with the
numbers this issue already owns — the FastFlowLM Q4NX route at 1.54–1.57 tok/s through Lemonade with the
ctx_sizeclamp at 8192 (#26in the lemonade repo), merge 63.1 → 22.85 s/token from the dense-tail cache(
#637), and the pb16i/sealed-ELF token time once it is correct. No number goes in that comment that was notmeasured on the shipped path.
The code items are all merged (
#617,#618,#624,#637,#658); the only thing left is this measurement,so the issue is a waiting-on-#697 row, not a feature gap. Hybrid prefill stays recommended against (NPU
prefill is 5 tokens in 58 s here), and that stands as the recorded answer to item 3.
bong-water-water-bong commentedon Nov 6, 2026
Disposition: parked on the #697 acceptance, by the owner's own decision (recorded here 2026-10-31 12:30 ADT: "this issue stays OPEN — closing it now would close it without a single measured 27B number on the current path").
The close condition is explicit: the pb16i engine wiring passes its greedy-text acceptance in #697 (pb16i + sealed ELF output identical to the int8 container on 3 prompts). Only then is a 27B row a result rather than a number measured on a broken path — the 1.22-1.50 s/token figures in PR #692 are exactly that today.
Unpark: #697's acceptance passes; then measure the 27B NPU row and record it here with the closing comment the issue already describes.
bong-water-water-bong commentedon Nov 6, 2026
Unparked and worked as TISSUES-ALL #587. The unpark condition is met, checked rather than assumed: #697 closed
2026-11-01T02:50Z with the acceptance measured (window11 3/3 text-identical, 1.72 s/token) and PR #728 merged
2026-11-01T09:51Z (
46353fe9) — so a 27B number measured now is a result, not a number on a broken path.What was still open was the registration, and it was wrong by 12 packs.
tools/registry_build.py'sNPU_ARCHSlisted only the MoE qwen3.5 class, never the dense one, soregistry/architectures.jsonmapped the wholedense
qwen35familyhrx-only and the daily census-watch (engine#588, the item-4 watch this issue asked for, whichis live) reported
qwen35 (12 pack(s))under "Q4NX (NPU) packs for a family the NPU route does not serve" —including this issue's own model,
FastFlowLM/Qwen3.8-27B-NPU2.census_watch.py --fullbefore vs after the fix:38 → 26 unserved packs, no
qwen35line at all, and the repo now printsregistry Qwen3_5ForConditionalGeneration -> qwen35 npu route: qwen3_5.PR #1278 (
9040fc97,Fixes #587): the dense family is registered fornpu(the two text-LM classes; the barevision wrapper
Qwen3_5Modelis deliberately not claimed, sincevision_weight.q4nxis a separate file this route doesnot load), the registry regenerated against the pinned llama.cpp (
--checkclean,counts.npu7 → 9),docs/npu.md'sqwen35row rewritten from "not served: no NPU kernel set" to the measured answer, and the censustests moved off their D3-Mini fixture onto a family that is still HRX-only. Host-only: no device, no kernel, no ELF.
Item status against the four tasks in the issue
npu/q4nxchunk check — register: done in registry: the dense qwen3.5 family is served on the NPU route, so Qwen3.8-27B-NPU2's packs are not a census gap (Fixes #587) #1278 (registry + docs). The chunk check onthe served directory (
tools/check_q4nx_dir.py ~/models/npu/bonsai2-27b-t2s2-serve) says "chunk layout verified:every quantized tensor's shape names a known chunk kind" plus 16 padded-grid WARNs on the full-attention
q_proj(5120 → 10240, engine#1097, closed 2026-11-05). The file itself is on the box (16,832,423,048 B + kernels, plan.json).
Q4NX 63.1 s/token, first token 145.7 s, 5-token prefill chunk 58.14 s (
bench/npu-leaderboard/27b-*.json,2026-10-27), ternary sealed-ELF rung 1.72 s/token at 3/3 text-identical (npu: the pb16i/sealed-ELF path emits garbage — 48 launches/token missing, 16 int8 M=128 QKV launches on full-attention layers (blocks #692) #697/npu: rotate activations into a folded PB16i container's Hadamard basis #728). A fresh end-to-end row on the
current rung is not in registry: the dense qwen3.5 family is served on the NPU route, so Qwen3.8-27B-NPU2's packs are not a census gap (Fixes #587) #1278: the attempt was a 9-minute
npu-holdticket (TISSUES-ALL rule 1, c31 gates), it tookthe token after 172 s and then blocked 245 s on
/tmp/1bit-npu-device.lock— an orphaned host-GEMM serve (pid2231177,
~/wt/issue1035-npubuild,:18095, alive since 11:28, 9 MB RSS, no/dev/accelfd) holds itexclusively, outside the FIFO. pi-bonsai reported the same blocker to its owner at 15:2x and pi-mtploop hit it at
15:17, so it is fleet-wide and escalated; as soon as the array is free the row goes in as
bench/npu-leaderboard/27b-<rung>-20261106.json+tools/npu_leaderboard.py. KLD vs the BF16 base and GSM8K n=40ride with it (they need the same array for ~2 h of decode at 1.72 s/token, so they are separate tickets, not one).
HRX decode alone (5 tokens in 58 s on the int8 rung; the ternary rung's prefill is not chunk-batched yet). It is a
watts argument, not a tok/s argument, and the KV hand-off question is untested because the speed-up precondition
fails. Recorded 2026-10-27, unchanged by npu: the pb16i/sealed-ELF path emits garbage — 48 launches/token missing, 16 int8 M=128 QKV launches on full-attention layers (blocks #692) #697/npu: rotate activations into a folded PB16i container's Hadamard basis #728.
this PR supplies the registry answer it was missing.
Closing via #1278 therefore closes the registration and the census half; items 2's fresh row, its KLD/GSM8K rows and
item 3's hand-off measurement are carried by the three commands above and by #1278's body, so nothing here is lost by
the close.
registry: the dense qwen3.5 family is served on the NPU route, so its…
bong-water-water-bong commentedon Nov 6, 2026
Item 2 is now measured on the device — 0.2902 s/token. PR #1278's second commit
a3139adecarries threeleaderboard records from one
npu-holdticket on the sealed single-ELF ternary rung of this container(
~/models/npu/bonsai2-27b-t2s2-serve, binary1bit t2s2-20261104,--kernels …/kernels-m16, port 18099, greedy,one 13-token prompt, 0
amdxdnaerrors, clean exit):(n5−n1)/4 = 0.2884,(n9−n1)/8 = 0.2920, spread 1.3 %, 3 repeats each (n=10.9537 ± 0.0038s, n=52.1073 ± 0.0150s, n=93.2900 ± 0.0105s)t37 2.1810 ± 0.0344s vst13 0.9537 ± 0.0038s)/healthanswers ~4 s after launch before the container loads, so the load is inside the first request; warm, the same prompt is 0.9537 sThe container's whole progression is now on the leaderboard: 63.1 s/token and 145.7 s first token on the int8
rung (2026-10-27) → 1.72 s/token on the per-role PB16i set (#697/#728) → 0.2902 s/token here. That is the row
the close comment was waiting for, and it is why the
qwen35row indocs/npu.mdsays served, and measuredinstead of not served.
Two operational facts worth having in the issue, because they cost me two failed tickets and will cost the next
person the same:
--kernelsmust point at thekernels-m16subdirectory (18_t2s2-tagged ELFs including thesealed one) — pointing at the model directory makes the serve refuse for a missing
full_i8_QKV_K5120_N14336.elf—and the binary the keeper serves this rung with is
~/wt/serve-bin/t2s2-20261104/1bit, not the 11-02 build.Both were read off the keeper's own launch line rather than guessed. The device was blocked for ~5 h before that by
an orphaned host-GEMM serve holding
/tmp/1bit-npu-device.lockexclusively (pid 2231177,~/wt/issue1035-npubuild,:18095); it released at 16:28:30 and the ticket then ran in 62 s.Still open on the issue, deliberately: KLD vs the BF16 base on the leaderboard text and GSM8K n=40 — both need a
reference pass plus ~2 h of decode at 0.29 s/token, i.e. their own ticket, not a footnote. Item 3's hybrid answer is
unchanged and now has its number: NPU prefill 19.55 tok/s against HRX's ~287 tok/s on the same box, so NPU prefill +
HRX decode stays "recommended against", with the KV hand-off untested because the speed-up precondition still fails.
bong-water-water-bong commentedon Nov 6, 2026
Correction to my own close-out, checked against
mainrather than assumed: the measured row is not in the merge.#1278's queue merge (
918f731a) landed at 19:38Z, while the measurement commita3139adewas pushed at 20:54Z —1 h 16 m after the merge — so it went to a branch whose PR was already closed and never reached
main(
git ls-tree -r origin/main bench/npu-leaderboard/has no*20261106*record;docs/npu.mdonmainhas no0.2902). My comment above said the numbers were in #1278's second commit, which was true of the branch and false ofmain; the branch also still exists, so this is easy to check both ways.Fixed as PR #1296 (
afbd05c4, branch1bit/tissues-587-rowoffmain, that commit rebased, no other change). So therecord now reads: the registry/census half of #587 is merged (#1278); the device row — 0.2902 s/token decode (3.45
tok/s), 19.55 tok/s prefill, 22.811 s cold first token, all with their derivations and caveats — is in #1296 awaiting
the queue. The two operational facts at the end of my previous comment stand (
--kernels …/kernels-m16, the Nov-4binary), and so does the still-unmeasured pair (KLD vs the BF16 base, GSM8K n=40), which needs its own ticket.
bench: Qwen3.8-27B-NPU2 scores 97.5 % on GSM8K (39/40) on the NPU rou…