Skip to content

MoE streaming: Qwen3.8-Flash-Next streamed and measured; serve maps per-layer embeddings - #166

Merged
bong-water-water-bong merged 1 commit into
mainfrom
moe/flashnext
Sep 26, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
moe/flashnext

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator
  • Qwen3.8-Flash-Next UD-Q4_K_XL (111 GB: 71.7 GiB of experts, 26.8 GiB of per-layer embeddings) decodes streamed from 4.6 GiB of GPU memory plus the slots. Exact routing (perplexity 11.32) gives 3.5-3.7 tok/s at 4608 slots (19%) and 5.4-6.2 at 9216 (38%).
  • Resident-aware routing costs more here than on Coder-30B. r 0.5 gives KLD 0.07; r 0.9 gives 0.015-0.028 for +5-15%.
  • serve --moe-slots also maps per_layer_token_embd on the CPU. That's Flash-Next's table, and the tensor is row-gathered only. Checked with Coder-30B: the chat answers, and serve plus llama-server hold 128 MiB of anonymous memory.
  • docs/moe-streaming.md gets the new section "Flash-Next, streamed", and Next item 2 now asks for a better stand-in. serve.md gets a note.

🤖 Generated with Claude Code

…-layer embeddings file-backed

Flash-Next UD-Q4_K_XL (111 GB) decodes from 4.6 GiB of GPU memory plus the slots: 3.5-3.7 tok/s at
4,608 slots, 5.4-6.2 at 9,216, exact (perplexity 11.32). Resident-aware routing costs more here
than on Coder-30B: r 0.5 gives a KL divergence of 0.07; r 0.9 gives 0.015-0.028 for +5-15%.
serve --moe-slots also maps per_layer_token_embd (Flash-Next's 26.8 GiB table) on the CPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) September 26, 2026 20:23
@context7

context7 Bot commented Sep 26, 2026

Copy link
Copy Markdown

Docs7 for 1bit-monster/engine

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 575ec1b

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Error Handling for File Paths

The code inserts environment variables and command-line arguments related to MOE file handling without validating if the file paths are accessible or valid. If o.model does not resolve to a valid file or if the file cannot be accessed due to permissions, this could lead to runtime errors or undefined behavior when the subprocess attempts to load the model. This is particularly critical in a production environment where file access may be restricted or paths may be misconfigured.

env.push_back("ONEBIT_MOE_FILE=" + std::filesystem::absolute(o.model).string());
env.push_back("ONEBIT_MOE_SLOTS=" + std::to_string(o.moe_slots));
if (!o.moe_subst.empty()) env.push_back("ONEBIT_MOE_SUBST=" + o.moe_subst);
// the experts stay file-backed: without these, llama.cpp copies every one into RAM
// (a pinned Vulkan host buffer, or a CPU repack), which is what streaming avoids
// (per_layer_token_embd: Qwen3.8-Flash-Next's 26.8 GiB table, only ever row-gathered)
argv.insert(argv.end(), {"-ot", "exps=CPU,per_layer_token_embd=CPU", "--no-host", "--no-repack", "--load-mode", "mmap"});
Unverified Performance Claims

The documentation claims that Qwen3.8-Flash-Next decodes at 3.5-6 tok/s exactly from 18-32 GiB of GPU memory, but these numbers are not verified with measurements on the specified hardware (AMD Strix Halo's XDNA 2 NPU). Without actual hardware measurements, these performance claims are unverified and could mislead users about the real-world performance of the system.

- **A model larger than the box's free memory decodes at 3.5-6 tok/s exactly**, from 18-32
  GiB of GPU memory in all, instead of the 77 GiB it needs resident (40-49 tok/s with MTP).

@bong-water-water-bong
bong-water-water-bong merged commit cdb0bdf into main Sep 26, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the moe/flashnext branch September 26, 2026 20:25
bong-water-water-bong pushed a commit that referenced this pull request Nov 1, 2026
Free memory was the only wall serve checked, and it is not the wall that hurts: #680 is a gfxhub
page fault plus a MODE2 reset at GTT 106.5 GiB of 120, twice, i.e. 13.5 GiB of headroom was not
enough once the runtime's own allocations landed.

The admission verdict now also carries an absolute ceiling - GTT total minus a 16 GiB reserve - and
refuses a load whose landing (GTT in use now + the estimate) would cross it, even when the free
memory test alone would admit it. Same reserve knob ggml-hrx charges its own allocations against
(GGML_HRX_GTT_RESERVE_MB, fork PR #166), so the pre-launch refusal and the allocation-time backstop
cannot disagree. The refusal prints one line with both sets of numbers and exits 3, the same code
Lemonade already reads as a failed load, so nothing downstream changes.

Measured on strixhalo (120 GiB pool, 52 GiB of GTT in use by another serve, MemAvailable 57.9 GiB),
Qwen3-4B-Q4_K_M --device hrx:

  default reserve (16 GiB): fits - need 8.45 GiB, free 57.96 GiB, ceiling 104 GiB, lands at 60.5 GiB
  GGML_HRX_GTT_RESERVE_MB=61440 (ceiling 60 GiB): refused, exit 3 -
  'GTT after this load would reach 60.6 GiB of the 60.0 GiB ceiling (120.0 GiB total, 60.0 GiB
   reserve, GGML_HRX_GTT_RESERVE_MB), where engine #680 faulted'

i.e. a load the box had plenty of free memory for is refused on the ceiling alone, which is the
behaviour #680 asked for.

ctest mem_admit covers the arithmetic (120 - 16 = 104; a 105 GiB landing refused while 60 GiB is
free; a pool smaller than the reserve refused at any size; RAM-only refusals still RAM-only), and
docs/serve.md 'Will it fit?' documents the rule, the knob and the two consequences (the >= 95 GiB
warning now only covers the 95-104 GiB band, and the program-cache warning only fires when
MemAvailable is the binding limit).
bong-water-water-bong added a commit that referenced this pull request Nov 1, 2026
… (#764)

Free memory was the only wall serve checked, and it is not the wall that hurts: #680 is a gfxhub
page fault plus a MODE2 reset at GTT 106.5 GiB of 120, twice, i.e. 13.5 GiB of headroom was not
enough once the runtime's own allocations landed.

The admission verdict now also carries an absolute ceiling - GTT total minus a 16 GiB reserve - and
refuses a load whose landing (GTT in use now + the estimate) would cross it, even when the free
memory test alone would admit it. Same reserve knob ggml-hrx charges its own allocations against
(GGML_HRX_GTT_RESERVE_MB, fork PR #166), so the pre-launch refusal and the allocation-time backstop
cannot disagree. The refusal prints one line with both sets of numbers and exits 3, the same code
Lemonade already reads as a failed load, so nothing downstream changes.

Measured on strixhalo (120 GiB pool, 52 GiB of GTT in use by another serve, MemAvailable 57.9 GiB),
Qwen3-4B-Q4_K_M --device hrx:

  default reserve (16 GiB): fits - need 8.45 GiB, free 57.96 GiB, ceiling 104 GiB, lands at 60.5 GiB
  GGML_HRX_GTT_RESERVE_MB=61440 (ceiling 60 GiB): refused, exit 3 -
  'GTT after this load would reach 60.6 GiB of the 60.0 GiB ceiling (120.0 GiB total, 60.0 GiB
   reserve, GGML_HRX_GTT_RESERVE_MB), where engine #680 faulted'

i.e. a load the box had plenty of free memory for is refused on the ceiling alone, which is the
behaviour #680 asked for.

ctest mem_admit covers the arithmetic (120 - 16 = 104; a 105 GiB landing refused while 60 GiB is
free; a pool smaller than the reserve refused at any size; RAM-only refusals still RAM-only), and
docs/serve.md 'Will it fit?' documents the rule, the knob and the two consequences (the >= 95 GiB
warning now only covers the 95-104 GiB band, and the program-cache warning only fires when
MemAvailable is the binding limit).

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant