q4nx-build scrambles the DeltaNet value heads of Qwen3.8-27B (and any Qwen3.5-family model with 3+ value heads per key head)
What's wrong
Converting a Qwen3.5 / Qwen3.8 GGUF with q4nx-build produces a broken model when the gated DeltaNet has more than two value heads per key head. Qwen3.8-27B (48 value heads over 16 key heads) is the first model like that. The published Atomic-Germ/Qwen3.8-27B-NPU2 was made this way and answers in fragments of unrelated text on the open kernels.
The smaller sizes (2B / 0.8B: 16 over 16; 4B / 9B: 32 over 16) are not affected.
Why
llama.cpp stores these models' value heads in a different order from Hugging Face's, so q4nx-build has to put them back. The code that does that assumed the 9B's shape:
- exactly 2 value heads per key head (the 27B has 3), and
- the value rows of
qkvbeing its second half, which is only true when there are twice as many value heads as key heads.
So in all 48 linear-attention layers of the 27B, every tensor indexed by value head comes out in the wrong order: the value rows of qkv, z, out_proj's columns, alpha / beta, A, dt_bias, and the conv1d value channels. Everything else in the file is fine.
Why nothing caught it
The NPU kernels and the CPU reference used to check them both read the same converted file, so they agreed with each other perfectly while both computing the wrong model. It only showed up once the container was compared against Qwen's original weights.
How it was confirmed
Comparing the container tensor by tensor against Qwen/Qwen3.8-27B's safetensors: the full-attention layers, the FFN and the norms all match (correlation ~0.997), and every value-head-indexed DeltaNet tensor is near 0. Running the old reorder rule on llama.cpp's head order reproduces the exact scramble found in the published file.
Fix
Read the head counts from the GGUF itself (qwen35.ssm.group_count, time_step_rank, state_size, inner_size), split qkv / conv1d after the q and k rows rather than at the half, and only reorder when there are more value heads than key heads. Models with 32 value heads over 16 convert exactly as before.
After the fix
Atomic-Germ/Qwen3.8-27B-NPU2 needs to be converted again and re-uploaded. A container reconverted from unsloth/Qwen3.8-27B-GGUF (Q8_0) matches the original weights on every tensor and answers correctly on the NPU.
we don't need this in 0.1.0 since we don't support qwen 3.8 yet anyways