[GH-ISSUE #4449] [Engine] A Qwen3.8-Flash-Next GGUF with its NextN (MTP) block inside (block_count 49, nextn_predict_layers 1) doesn't load: iq_pack writes layer 48, the engine wants 48 layers #1985

Closed
opened 2026-11-04 01:55:47 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @talisp on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4449

In short: a Qwen3.8-Flash-Next fine-tune published as one GGUF with its MTP layer inside (the way llama.cpp writes NextN models) doesn't start on 0.2.7. The pack tool writes that layer as a 49th expert layer, and the engine wants exactly 48 layers in the header and in two per-layer lists. With a copy whose header leaves the MTP layer out (the weights untouched), it runs at 133-136 tok/s here, like Unsloth's files. Its own MTP layer drafts better than the base model's (79.5% vs 71.5% accepted), so it would be nice if Strata could use it from the file.

Area: [Engine] (and tools/iq_pack.py)

Desktop app, Terminal or source? Release 0.2.7 (control 0.1.52, engine 0.1.52 for CUDA 12), started from the terminal (serve/server.py --engine strata)

Reproduction status: Reproduced locally, every start

Strata version: 0.2.7 (strata --version: 0.1.52)

Graphics card, memory and system: 1× NVIDIA L40S-48Q (vGPU, 48 GB, sm_89), Xeon Platinum 8580 VM (32 vCPUs), ~504 GB RAM, Ubuntu 22.04, Linux 6.8.

Model: CYBER-FROST-3.8-PS-GUFF-Q5_K_M.gguf (peasantsmith/CYBER-FROST-3.8-PS-GUFF @32867bb, 112.5 GB, one file), a cybersecurity fine-tune of Qwen3.8-Flash-Next. Architecture qwen4exp, like Unsloth's GGUFs, but it keeps the NextN/MTP block in the file, the way llama.cpp writes one:

qwen4exp.block_count            49
qwen4exp.nextn_predict_layers   1
qwen4exp.attention.compress_ratios   49 entries (all 0)
qwen4exp.attention.recurrent_layers  49 entries (the last, False, is the NextN layer)
blk.48.*                        32 tensors: attention, experts (Q5_K / IQ4_NL), nextn.eh_proj, nextn.enorm, nextn.hnorm, nextn.hc_head_*

Unsloth's Qwen3.8-Flash-Next-UD-Q4_K_XL (which runs fine here: ~134 tok/s decode) has block_count 48, no nextn_predict_layers and 48 compress_ratios.

What happens

Three stops, one after the other, as we worked around each:

  1. tools/iq_pack.py --gguf <file> --out <pack> --compat-bf16 finishes (rc 0), but writes a line for layer 48 into native_experts.txt (v3 header), and the engine refuses it:
    strata generate: native_experts.txt: a malformed line: 48 13 20 78014054400 3174400 111345363904 111928677824 110872583104
    
  2. With that line removed by hand, the engine refuses the GGUF itself:
    strata: qwen4exp.attention.compress_ratios is all zeros (a converter's placeholder): using the compiled pooling block of 4 cells (#2396)
    strata generate: qwen4exp.block_count = 49, the kernels are compiled for 48
    
  3. With a copy of the GGUF whose header says block_count 48, nextn_predict_layers 0 and has no blk.48.* entries (tensor data byte-identical, offsets unchanged), it stops at the per-layer list:
    strata generate: qwen4exp.attention.compress_ratios must list one entry for each of the 48 layers
    
  4. With both 49-entry lists cut to 48 as well, it loads and runs well: 133-136 tok/s decode, the same as Unsloth's UD-Q4_K_XL here. With the fine-tune's own MTP layer (taken out of blk.48) instead of the base model's, drafts are accepted more often (79.5% against 71.5%), though decode stays about the same.
Run (one start each, page cache dropped) Decode tok/s (mean of 6) Draft acceptance Prompt 11.4K / 46.9K / 190.4K tok/s
Patched copy, --mtp of the 0.1.45 setup (base Qwen) 133.18 / 134.45 71.2% / 71.9% 2,203 / 2,883 / 2,742
Patched copy, the fine-tune's own MTP 136.17 / 134.83 79.6% / 79.4% 2,212 / 2,886 / 2,743
Unsloth UD-Q4_K_XL, for scale 133.13 / 134.30 71.9% 2,244 / 2,909 / 2,763

The header-only copy we used: block_count 48, nextn_predict_layers 0, compress_ratios and recurrent_layers cut to their first 48 entries, the 32 blk.48.* tensor entries dropped from the table (their bytes stay in the file, unreferenced). Every other tensor's bytes checked identical to the original's.

What we'd suggest

  • In the engine, read nextn_predict_layers and take block_count - nextn_predict_layers as the layer count (and the first that many entries of the per-layer lists), as llama.cpp does for its NextN models.
  • In iq_pack.py, skip the layers at and above block_count - nextn_predict_layers in native_experts.txt (or write them where --mtp could use them: the fine-tune's own NextN would draft better than the base model's, which --mtp needs today).

For reference, Project Maya (a sibling project whose Qwen engine grew from Strata's code) loads this file as is: its pack writes no expert line for layer 48 and its MTP extractor takes the draft layer out of blk.48 (maya mtp: draft layer loaded, 1097 MiB of VRAM (experts 675, dense 109)). On the same file and box it decodes slower than Strata (69-84 tok/s; its Qwen engine is older), but it does start.

We searched the issues for nextn, block_count, native_experts and the model name, and found nothing on this.

Command line

strata --serve --pack <pack> --native CYBER-FROST-3.8-PS-GUFF-Q5_K_M.gguf --expert-profile control/data/expert-profile.bin \
  --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <the 0.1.45 setup's mtp/rt> --max-context 262144 \
  --kv fp16 --kv-resident 32768 --conversation-cache-mib 32768 --conversation-cache-slots 4 \
  --conversation-cache-min-tokens 4000 --vram-reserve-mib 700

env STRATA_ROUTE_TAIL_SKIP=0. The same flags with the Unsloth UD-Q4_K_XL pack run normally.

Originally created by @talisp on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4449 **In short:** a Qwen3.8-Flash-Next fine-tune published as one GGUF with its MTP layer inside (the way llama.cpp writes NextN models) doesn't start on 0.2.7. The pack tool writes that layer as a 49th expert layer, and the engine wants exactly 48 layers in the header and in two per-layer lists. With a copy whose header leaves the MTP layer out (the weights untouched), it runs at 133-136 tok/s here, like Unsloth's files. Its own MTP layer drafts better than the base model's (79.5% vs 71.5% accepted), so it would be nice if Strata could use it from the file. **Area:** `[Engine]` (and `tools/iq_pack.py`) **Desktop app, Terminal or source?** Release 0.2.7 (control 0.1.52, engine 0.1.52 for CUDA 12), started from the terminal (`serve/server.py --engine strata`) **Reproduction status:** Reproduced locally, every start **Strata version:** 0.2.7 (`strata --version`: 0.1.52) **Graphics card, memory and system:** 1× NVIDIA L40S-48Q (vGPU, 48 GB, sm_89), Xeon Platinum 8580 VM (32 vCPUs), ~504 GB RAM, Ubuntu 22.04, Linux 6.8. **Model:** `CYBER-FROST-3.8-PS-GUFF-Q5_K_M.gguf` (peasantsmith/CYBER-FROST-3.8-PS-GUFF @32867bb, 112.5 GB, one file), a cybersecurity fine-tune of Qwen3.8-Flash-Next. Architecture `qwen4exp`, like Unsloth's GGUFs, but it **keeps the NextN/MTP block in the file**, the way llama.cpp writes one: ``` qwen4exp.block_count 49 qwen4exp.nextn_predict_layers 1 qwen4exp.attention.compress_ratios 49 entries (all 0) qwen4exp.attention.recurrent_layers 49 entries (the last, False, is the NextN layer) blk.48.* 32 tensors: attention, experts (Q5_K / IQ4_NL), nextn.eh_proj, nextn.enorm, nextn.hnorm, nextn.hc_head_* ``` Unsloth's `Qwen3.8-Flash-Next-UD-Q4_K_XL` (which runs fine here: ~134 tok/s decode) has `block_count 48`, no `nextn_predict_layers` and 48 `compress_ratios`. ## What happens Three stops, one after the other, as we worked around each: 1. **`tools/iq_pack.py --gguf <file> --out <pack> --compat-bf16`** finishes (rc 0), but writes a line for layer 48 into `native_experts.txt` (v3 header), and the engine refuses it: ``` strata generate: native_experts.txt: a malformed line: 48 13 20 78014054400 3174400 111345363904 111928677824 110872583104 ``` 2. **With that line removed by hand**, the engine refuses the GGUF itself: ``` strata: qwen4exp.attention.compress_ratios is all zeros (a converter's placeholder): using the compiled pooling block of 4 cells (#2396) strata generate: qwen4exp.block_count = 49, the kernels are compiled for 48 ``` 3. **With a copy of the GGUF whose header says `block_count 48`, `nextn_predict_layers 0` and has no `blk.48.*` entries** (tensor data byte-identical, offsets unchanged), it stops at the per-layer list: ``` strata generate: qwen4exp.attention.compress_ratios must list one entry for each of the 48 layers ``` 4. **With both 49-entry lists cut to 48 as well**, it loads and runs well: 133-136 tok/s decode, the same as Unsloth's UD-Q4_K_XL here. With the fine-tune's own MTP layer (taken out of `blk.48`) instead of the base model's, drafts are accepted more often (79.5% against 71.5%), though decode stays about the same. | Run (one start each, page cache dropped) | Decode tok/s (mean of 6) | Draft acceptance | Prompt 11.4K / 46.9K / 190.4K tok/s | |---|---|---|---| | Patched copy, `--mtp` of the 0.1.45 setup (base Qwen) | 133.18 / 134.45 | 71.2% / 71.9% | 2,203 / 2,883 / 2,742 | | Patched copy, the fine-tune's own MTP | 136.17 / 134.83 | 79.6% / 79.4% | 2,212 / 2,886 / 2,743 | | Unsloth UD-Q4_K_XL, for scale | 133.13 / 134.30 | 71.9% | 2,244 / 2,909 / 2,763 | The header-only copy we used: `block_count` 48, `nextn_predict_layers` 0, `compress_ratios` and `recurrent_layers` cut to their first 48 entries, the 32 `blk.48.*` tensor entries dropped from the table (their bytes stay in the file, unreferenced). Every other tensor's bytes checked identical to the original's. ## What we'd suggest - In the engine, read `nextn_predict_layers` and take `block_count - nextn_predict_layers` as the layer count (and the first that many entries of the per-layer lists), as llama.cpp does for its NextN models. - In `iq_pack.py`, skip the layers at and above `block_count - nextn_predict_layers` in `native_experts.txt` (or write them where `--mtp` could use them: the fine-tune's own NextN would draft better than the base model's, which `--mtp` needs today). For reference, Project Maya (a sibling project whose Qwen engine grew from Strata's code) loads this file as is: its pack writes no expert line for layer 48 and its MTP extractor takes the draft layer out of `blk.48` (`maya mtp: draft layer loaded, 1097 MiB of VRAM (experts 675, dense 109)`). On the same file and box it decodes slower than Strata (69-84 tok/s; its Qwen engine is older), but it does start. We searched the issues for `nextn`, `block_count`, `native_experts` and the model name, and found nothing on this. ## Command line ``` strata --serve --pack <pack> --native CYBER-FROST-3.8-PS-GUFF-Q5_K_M.gguf --expert-profile control/data/expert-profile.bin \ --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <the 0.1.45 setup's mtp/rt> --max-context 262144 \ --kv fp16 --kv-resident 32768 --conversation-cache-mib 32768 --conversation-cache-slots 4 \ --conversation-cache-min-tokens 4000 --vram-reserve-mib 700 ``` env `STRATA_ROUTE_TAIL_SKIP=0`. The same flags with the Unsloth UD-Q4_K_XL pack run normally.
Author
Owner

@otaliptus commented on GitHub (Oct 28, 2026):

Same file shape, a second model, another backend: bottlecapai/ThinkingCap-Qwen3.8-Flash-Next-GGUF (IQ4_XS, 8 shards, 90 GB; the file #3890 asks for), on the SYCL engine (Intel Arc Pro B70, built from source). It stops on v0.1.45 (2026-10-23) and on v0.2.7.1 / engine 0.1.53 (re-run today). What this adds to the report above:

The file. qwen4exp.block_count 49, nextn_predict_layers 1, 32 blk.48.* tensors spread over shards 3-7, 49-entry attention.compress_ratios and recurrent_layers. Unlike the all-zero list above, this one is a real layer split with compress_ratios[48] = 4 (the head is a full-attention block), so the engine stops one check earlier. The three stops, in order, as each was worked around:

strata generate: native_experts.txt: a malformed line: 48 12 8 59519795200 3584000 3205999072 3677858272 5428571488 ThinkingCap-Qwen3.8-Flash-Next-IQ4_XS-00004-of-00008.gguf
strata generate: qwen4exp.attention.compress_ratios[48] = 4, but full_attention_interval = 4 makes layer 48 linear attention (and the other full-attention layers pool 4)
strata generate: native dense projections: native dense: tensor absent from canonical table: blk.48.ffn_gate_shexp.weight

Line 1 is the packer's 49th row (as above). Line 2 is what the engine says to the original shards once the pack is right (0.1.45 and 0.1.53 both). Line 3 is a third stop the report above did not reach, because its header copy also dropped the blk.48.* entries from the tensor table: with the header trimmed to 48 layers but the tensor entries kept, the native-dense loader's layer filter has no upper bound by default (layer_hi = -1, native_dense.hpp:26, native_dense.cpp:268) and looks the head's quantized tensors up in the canonical table.

Where it sits in v0.2.7.1, from reading the code (I have not built a fix):

  • include/strata/core/family_layout.hpp:64: num("nextn_predict_layers", g.n_mtp_layers) is read only inside if (family == Qwen35Moe). For qwen4exp, n_mtp_layers stays 0 and line 73's g.n_layers = block_count - g.n_mtp_layers gives 49. The rest follows: the per-layer array check in include/strata/artifact/gguf_reader.hpp (the compress_ratios block, about line 768) runs over 49 entries, and the compiled-geometry comparison (family_layout.hpp, the fields table) sees 49 against 48. The canonical-layout loop at line 270 already runs to n_layers + n_mtp_layers and the nextn.* names exist (lines 212-215) for qwen35moe.
  • So the engine side looks like: read nextn_predict_layers for qwen4exp too; let the per-layer arrays carry n_layers or n_layers + n_mtp_layers entries and check the trunk; bound the dense loader's filter by n_layers (or skip blk.<l> with l >= n_layers). The {"the in-file MTP layers", g.n_mtp_layers, c.n_mtp_layers} comparison would then have to allow 1 for qwen4exp while --mtp keeps supplying the draft layer from outside, as today.

Packer. The iq_pack.py change I have run from 0.1.45 through 0.2.7.1 (the packer's unit tests pass): model_layers() = block_count - nextn_predict_layers, the head's block left out of native_experts.txt and of the dense index: patch. Writing the head where --mtp could use it, as suggested above, would be the better form of it.

Workaround without touching the engine: a script that rewrites the shards as the 48-layer trunk (headers fixed, split.tensors.count corrected, the 32 head tensors dropped, every kept tensor sha256-verified; 5 minutes for 90 GiB), packed with --compat-bf16 and served with the base model's --mtp runtime (the vendor card says the head is the base model's, unchanged). On the B70 that loads and runs: 35 tok/s decode with IQ4_XS experts and 35 GiB of them mirrored in RAM, 47 of 87 drafts accepted on a short answer. Measurements against the base model are in our notes; the three stops are written up in docs/07.

Hardware: Intel Arc Pro B70 32 GB · 62 GB RAM · Debian 13 · engine built from source in the strata-sycl-dev image; the config setup_intel.py writes for the IQ3_S base, with the pack and the shards swapped.

<!-- gh-comment-id:6481701315 --> @otaliptus commented on GitHub (Oct 28, 2026): Same file shape, a second model, another backend: **bottlecapai/ThinkingCap-Qwen3.8-Flash-Next-GGUF** (IQ4_XS, 8 shards, 90 GB; the file #3890 asks for), on the SYCL engine (Intel Arc Pro B70, built from source). It stops on v0.1.45 (2026-10-23) and on v0.2.7.1 / engine 0.1.53 (re-run today). What this adds to the report above: **The file.** `qwen4exp.block_count 49`, `nextn_predict_layers 1`, 32 `blk.48.*` tensors spread over shards 3-7, 49-entry `attention.compress_ratios` and `recurrent_layers`. Unlike the all-zero list above, this one is a real layer split with `compress_ratios[48] = 4` (the head is a full-attention block), so the engine stops one check earlier. The three stops, in order, as each was worked around: ``` strata generate: native_experts.txt: a malformed line: 48 12 8 59519795200 3584000 3205999072 3677858272 5428571488 ThinkingCap-Qwen3.8-Flash-Next-IQ4_XS-00004-of-00008.gguf strata generate: qwen4exp.attention.compress_ratios[48] = 4, but full_attention_interval = 4 makes layer 48 linear attention (and the other full-attention layers pool 4) strata generate: native dense projections: native dense: tensor absent from canonical table: blk.48.ffn_gate_shexp.weight ``` Line 1 is the packer's 49th row (as above). Line 2 is what the engine says to the original shards once the pack is right (0.1.45 and 0.1.53 both). Line 3 is a **third stop** the report above did not reach, because its header copy also dropped the `blk.48.*` entries from the tensor table: with the header trimmed to 48 layers but the tensor entries kept, the native-dense loader's layer filter has no upper bound by default (`layer_hi = -1`, `native_dense.hpp:26`, `native_dense.cpp:268`) and looks the head's quantized tensors up in the canonical table. **Where it sits in v0.2.7.1, from reading the code** (I have not built a fix): - `include/strata/core/family_layout.hpp:64`: `num("nextn_predict_layers", g.n_mtp_layers)` is read only inside `if (family == Qwen35Moe)`. For `qwen4exp`, `n_mtp_layers` stays 0 and line 73's `g.n_layers = block_count - g.n_mtp_layers` gives 49. The rest follows: the per-layer array check in `include/strata/artifact/gguf_reader.hpp` (the `compress_ratios` block, about line 768) runs over 49 entries, and the compiled-geometry comparison (`family_layout.hpp`, the `fields` table) sees 49 against 48. The canonical-layout loop at line 270 already runs to `n_layers + n_mtp_layers` and the `nextn.*` names exist (lines 212-215) for qwen35moe. - So the engine side looks like: read `nextn_predict_layers` for qwen4exp too; let the per-layer arrays carry `n_layers` or `n_layers + n_mtp_layers` entries and check the trunk; bound the dense loader's filter by `n_layers` (or skip `blk.<l>` with `l >= n_layers`). The `{"the in-file MTP layers", g.n_mtp_layers, c.n_mtp_layers}` comparison would then have to allow 1 for qwen4exp while `--mtp` keeps supplying the draft layer from outside, as today. **Packer.** The `iq_pack.py` change I have run from 0.1.45 through 0.2.7.1 (the packer's unit tests pass): `model_layers() = block_count - nextn_predict_layers`, the head's block left out of `native_experts.txt` and of the dense index: [patch](https://github.com/otaliptus/b70-llm-notes/blob/main/patches/0011-strata-iq-pack-skip-in-file-mtp-head-block.patch). Writing the head where `--mtp` could use it, as suggested above, would be the better form of it. **Workaround without touching the engine:** a [script](https://github.com/otaliptus/b70-llm-notes/blob/main/scripts/gguf-strip-mtp-block.py) that rewrites the shards as the 48-layer trunk (headers fixed, `split.tensors.count` corrected, the 32 head tensors dropped, every kept tensor sha256-verified; 5 minutes for 90 GiB), packed with `--compat-bf16` and served with the base model's `--mtp` runtime (the vendor card says the head is the base model's, unchanged). On the B70 that loads and runs: 35 tok/s decode with IQ4_XS experts and 35 GiB of them mirrored in RAM, 47 of 87 drafts accepted on a short answer. Measurements against the base model are in [our notes](https://github.com/otaliptus/b70-llm-notes/blob/main/docs/03-results.md#thinkingcap); the three stops are written up in [docs/07](https://github.com/otaliptus/b70-llm-notes/blob/main/docs/07-strata-notes.md). Hardware: Intel Arc Pro B70 32 GB · 62 GB RAM · Debian 13 · engine built from source in the strata-sycl-dev image; the config `setup_intel.py` writes for the IQ3_S base, with the pack and the shards swapped.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660461239 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1985
No description provided.