[GH-ISSUE #326] Native pack rejects the BF16 blk.1.ple_key.weight that --compat-bf16 writes for OrcaRouter IQ3_XXS #155

Closed
opened 2026-11-04 01:40:31 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @Gen4536 on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/326

Hello

I've been testing your backend and it has been working quite nicely so far, but I've had to make some modifications to get it to work with orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF (IQ3_XXS).

The Issue

docs/ORCA.md tells users to pack orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF (IQ3_XXS) with tools/iq_pack.py --compat-bf16, then launch with --native and --ple-gguf. That pack stores blk.1.ple_key.weight as BF16. A current stock engine treats the GGUF's IQ3_XXS key as a native matrix, causes the packed BF16 row to be skipped, and then rejects the canonical BF16 WeightRef as incompatible, exiting with:

native dense: incompatible matrix blk.1.ple_key.weight

The PLE runtime already knows how to use a packed BF16 key. The load never gets that far. This is still the case in tag v0.1.30 (30ec18e).

In a few words, we get this incompatibility, which means that I can't even load the model without patching the backend.

When it started

v0.1.25 introduced it. v0.1.24 still loads this pack.

In v0.1.24, eligible() accepts only a Q2_0 key (GGML type 42). The comment there says other quantized keys are converted to BF16 by iq_pack and their packed bytes stay resident. The Orca packer rule was already present in that tag: a non-Q2_0 blk.1.ple_key.weight is written as BF16, so the IQ3_XXS GGUF tensor is not treated as a native matrix and the packed row loads.

v0.1.25 widened that check in commit daa121b (PR #121, the AMD HIP backend, 2026-09-29). eligible() now also accepts IQ3_XXS (type 18) and IQ4_XS (type 23):

return include_ple_key && (tensor.type == 42 || tensor.type == 18 || tensor.type == 23);

The packer was not changed. The Orca GGUF key is type 18, so from v0.1.25 onward the loader skips the packed BF16 row and then rejects it. The same check is still in v0.1.26, v0.1.27, and v0.1.30.

Workaround I tested

Two edits on v0.1.27 (a790805). The packer, the GGUF, and src/kernels/cuda/ple.cu stay as they are. The PLE wiring later in generate.cpp already uses wk->data as BF16 when the pack row is not quantized.

1. Keep a BF16 key in the weight arena (src/program/generate.cpp).

After served_names fills the skip set, read the blk.1.ple_key.weight row of <pack>/index.txt. The code_bits field is the same value WeightRef::quantized() uses. code_bits == 0 means the pack stored BF16. Remove that name from the skip set so those bytes are loaded. A nonzero code_bits stays skipped, and NativeDense uploads the GGUF matrix as before.

if (native_pack && skip.count("blk.1.ple_key.weight")) {
    int code_bits = 0;
    if (!pack_index_code_bits(o.pack, "blk.1.ple_key.weight", code_bits, err)) return 1;
    if (code_bits == 0) skip.erase("blk.1.ple_key.weight");
}

2. Do not upload the GGUF key over that BF16 row (src/core/native_dense.cpp).

eligible() still matches the GGUF tensor, because it is IQ3_XXS. In NativeDense::load, before the shape check that returns incompatible matrix, skip only this key when the pack row is not quantized:

if (tensor.name == "blk.1.ple_key.weight" && !ref.quantized()) continue;

A Q2_0, IQ3_XXS, or IQ4_XS key whose pack row is still quantized falls through and keeps the current native upload, shape check, and kernel path. The same load function covers the layer-split call.

After both edits the engine reports PLE on and serves the packed BF16 key. One edit alone does not: leaving the key skipped means the arena has no key, and loading the BF16 bytes without the continue still dies on incompatible matrix.

I'm not 100% sure this is the way to go, to be honest with you, but the patch worked fine and I've been able to test the model without running into the native dense: incompatible matrix blk.1.ple_key.weight error.

Possible intended fix

Since v0.1.25 intentionally added native IQ3_XXS and IQ4_XS PLE support, another possible solution may be to update the packer instead.

For example, the PLE-key part of needs_bf16() could treat every currently supported native PLE format as native:

NATIVE_PLE_TYPES = {"Q2_0", "IQ3_XXS", "IQ4_XS"}

return name.endswith(BF16_PROJECTIONS) or (
    name == "blk.1.ple_key.weight"
    and type_name not in NATIVE_PLE_TYPES
)

Then a newly generated OrcaRouter IQ3_XXS pack would leave that PLE key on the native path rather than dequantizing it to BF16.

That seems consistent with the v0.1.25 eligible() change and avoids unnecessarily converting a tensor that the runtime can now execute natively.

It would, however, leave existing --compat-bf16 packs unloadable unless the loader also accepts a resident BF16 PLE key as a fallback. So preserving the BF16 fallback in the loader may still be useful for backward compatibility.

At the moment the three pieces appear to disagree:

  • native_dense.cpp: Q2_0 / IQ3_XXS / IQ4_XS are native PLE types.
  • iq_pack.py: only Q2_0 is considered native for the PLE key.
  • docs/ORCA.md: the IQ3_XXS key is converted to BF16 and the native loader retains that converted key.

Additional info (which to be fair, you already know, but might as well post it here)

What the packer does

tools/iq_pack.py converts a non-Q2_0 PLE key to BF16:

# The existing native PLE key supports Q2_0 only. Other key encodings use the BF16 path.
return name.endswith(BF16_PROJECTIONS) or (name == "blk.1.ple_key.weight" and type_name != "Q2_0")

OrcaRouter IQ3_XXS stores blk.1.ple_key.weight as IQ3_XXS (GGML type 18), not Q2_0 (type 42). --compat-bf16 dequantizes it and writes a BF16 row (code_bits == 0, 52,428,800 bytes) into the pack. The GGUF file is left unchanged. Official GSQ-RCO files that already store a Q2_0 key are not converted and stay on the native key path.

docs/ORCA.md states that the native loader retains this converted PLE key, and that the existing native Q2_0 path remains available for the original model.

What the loader does

With --native, startup fails in two steps. Either step alone still leaves this pack unloadable.

  1. NativeDense::served_names sees the GGUF key. eligible() accepts Q2_0, IQ3_XXS, and IQ4_XS (native_dense.cpp). The IQ3_XXS name is added to the skip set, so the packed BF16 copy is not loaded into the weight arena. For a native pack, generate.cpp only erases blk.1.ple_key.weight from that set when the pack is not native:
if (!native_pack) skip.erase("blk.1.ple_key.weight");
  1. NativeDense::load then requires the pack's WeightRef to be quantized and to match the GGUF shape. The pack row is BF16, so the check fails and the engine returns native dense: incompatible matrix blk.1.ple_key.weight.

Keeping the BF16 bytes in the arena without the second change still hits that error. Skipping the native upload without putting the BF16 bytes in the arena leaves PLE with no key. The wiring later in generate.cpp already selects the right pointer once a resident row exists: wk->data as BF16 when !wk->quantized(), and the native upload when the pack row is still quantized.

Originally created by @Gen4536 on GitHub (Oct 1, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/326 Hello I've been testing your backend and it has been working quite nicely so far, but I've had to make some modifications to get it to work with `orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF` (IQ3_XXS). ## The Issue `docs/ORCA.md` tells users to pack `orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF` (IQ3_XXS) with `tools/iq_pack.py --compat-bf16`, then launch with `--native` and `--ple-gguf`. That pack stores `blk.1.ple_key.weight` as BF16. A current stock engine treats the GGUF's IQ3_XXS key as a native matrix, causes the packed BF16 row to be skipped, and then rejects the canonical BF16 `WeightRef` as incompatible, exiting with: ```text native dense: incompatible matrix blk.1.ple_key.weight ``` The PLE runtime already knows how to use a packed BF16 key. The load never gets that far. This is still the case in tag `v0.1.30` (`30ec18e`). In a few words, we get this incompatibility, which means that I can't even load the model without patching the backend. ## When it started `v0.1.25` introduced it. `v0.1.24` still loads this pack. In `v0.1.24`, `eligible()` accepts only a Q2_0 key (GGML type 42). The comment there says other quantized keys are converted to BF16 by `iq_pack` and their packed bytes stay resident. The Orca packer rule was already present in that tag: a non-Q2_0 `blk.1.ple_key.weight` is written as BF16, so the IQ3_XXS GGUF tensor is not treated as a native matrix and the packed row loads. `v0.1.25` widened that check in commit `daa121b` (PR #121, the AMD HIP backend, 2026-09-29). `eligible()` now also accepts IQ3_XXS (type 18) and IQ4_XS (type 23): ```cpp return include_ple_key && (tensor.type == 42 || tensor.type == 18 || tensor.type == 23); ``` The packer was not changed. The Orca GGUF key is type 18, so from `v0.1.25` onward the loader skips the packed BF16 row and then rejects it. The same check is still in `v0.1.26`, `v0.1.27`, and `v0.1.30`. ## Workaround I tested Two edits on `v0.1.27` (`a790805`). The packer, the GGUF, and `src/kernels/cuda/ple.cu` stay as they are. The PLE wiring later in `generate.cpp` already uses `wk->data` as BF16 when the pack row is not quantized. **1. Keep a BF16 key in the weight arena** (`src/program/generate.cpp`). After `served_names` fills the skip set, read the `blk.1.ple_key.weight` row of `<pack>/index.txt`. The `code_bits` field is the same value `WeightRef::quantized()` uses. `code_bits == 0` means the pack stored BF16. Remove that name from the skip set so those bytes are loaded. A nonzero `code_bits` stays skipped, and `NativeDense` uploads the GGUF matrix as before. ```cpp if (native_pack && skip.count("blk.1.ple_key.weight")) { int code_bits = 0; if (!pack_index_code_bits(o.pack, "blk.1.ple_key.weight", code_bits, err)) return 1; if (code_bits == 0) skip.erase("blk.1.ple_key.weight"); } ``` **2. Do not upload the GGUF key over that BF16 row** (`src/core/native_dense.cpp`). `eligible()` still matches the GGUF tensor, because it is IQ3_XXS. In `NativeDense::load`, before the shape check that returns `incompatible matrix`, skip only this key when the pack row is not quantized: ```cpp if (tensor.name == "blk.1.ple_key.weight" && !ref.quantized()) continue; ``` A Q2_0, IQ3_XXS, or IQ4_XS key whose pack row is still quantized falls through and keeps the current native upload, shape check, and kernel path. The same `load` function covers the layer-split call. After both edits the engine reports `PLE on` and serves the packed BF16 key. One edit alone does not: leaving the key skipped means the arena has no key, and loading the BF16 bytes without the `continue` still dies on `incompatible matrix`. I'm not 100% sure this is the way to go, to be honest with you, but the patch worked fine and I've been able to test the model without running into the `native dense: incompatible matrix blk.1.ple_key.weight` error. ## Possible intended fix Since `v0.1.25` intentionally added native IQ3_XXS and IQ4_XS PLE support, another possible solution may be to update the packer instead. For example, the PLE-key part of `needs_bf16()` could treat every currently supported native PLE format as native: ```python NATIVE_PLE_TYPES = {"Q2_0", "IQ3_XXS", "IQ4_XS"} return name.endswith(BF16_PROJECTIONS) or ( name == "blk.1.ple_key.weight" and type_name not in NATIVE_PLE_TYPES ) ``` Then a newly generated OrcaRouter IQ3_XXS pack would leave that PLE key on the native path rather than dequantizing it to BF16. That seems consistent with the `v0.1.25` `eligible()` change and avoids unnecessarily converting a tensor that the runtime can now execute natively. It would, however, leave existing `--compat-bf16` packs unloadable unless the loader also accepts a resident BF16 PLE key as a fallback. So preserving the BF16 fallback in the loader may still be useful for backward compatibility. At the moment the three pieces appear to disagree: - `native_dense.cpp`: Q2_0 / IQ3_XXS / IQ4_XS are native PLE types. - `iq_pack.py`: only Q2_0 is considered native for the PLE key. - `docs/ORCA.md`: the IQ3_XXS key is converted to BF16 and the native loader retains that converted key. ## Additional info (which to be fair, you already know, but might as well post it here) ### What the packer does `tools/iq_pack.py` converts a non-Q2_0 PLE key to BF16: ```python # The existing native PLE key supports Q2_0 only. Other key encodings use the BF16 path. return name.endswith(BF16_PROJECTIONS) or (name == "blk.1.ple_key.weight" and type_name != "Q2_0") ``` OrcaRouter IQ3_XXS stores `blk.1.ple_key.weight` as IQ3_XXS (GGML type 18), not Q2_0 (type 42). `--compat-bf16` dequantizes it and writes a BF16 row (`code_bits == 0`, 52,428,800 bytes) into the pack. The GGUF file is left unchanged. Official GSQ-RCO files that already store a Q2_0 key are not converted and stay on the native key path. `docs/ORCA.md` states that the native loader retains this converted PLE key, and that the existing native Q2_0 path remains available for the original model. ### What the loader does With `--native`, startup fails in two steps. Either step alone still leaves this pack unloadable. 1. `NativeDense::served_names` sees the GGUF key. `eligible()` accepts Q2_0, IQ3_XXS, and IQ4_XS (`native_dense.cpp`). The IQ3_XXS name is added to the skip set, so the packed BF16 copy is not loaded into the weight arena. For a native pack, `generate.cpp` only erases `blk.1.ple_key.weight` from that set when the pack is not native: ```cpp if (!native_pack) skip.erase("blk.1.ple_key.weight"); ``` 2. `NativeDense::load` then requires the pack's `WeightRef` to be quantized and to match the GGUF shape. The pack row is BF16, so the check fails and the engine returns `native dense: incompatible matrix blk.1.ple_key.weight`. Keeping the BF16 bytes in the arena without the second change still hits that error. Skipping the native upload without putting the BF16 bytes in the arena leaves PLE with no key. The wiring later in `generate.cpp` already selects the right pointer once a resident row exists: `wk->data` as BF16 when `!wk->quantized()`, and the native upload when the pack row is still quantized.
Author
Owner

@Niko1221 commented on GitHub (Oct 1, 2026):

Confirmed - thanks for the analysis and the fallback. 0.1.32 keeps a non-quantized ple_key row in the weight arena instead of uploading the GGUF matrix over it, so OrcaRouter IQ3_XXS packs load again.

<!-- gh-comment-id:5925967215 --> @Niko1221 commented on GitHub (Oct 1, 2026): Confirmed - thanks for the analysis and the fallback. 0.1.32 keeps a non-quantized ple_key row in the weight arena instead of uploading the GGUF matrix over it, so OrcaRouter IQ3_XXS packs load again.
Author
Owner

@dazld commented on GitHub (Oct 1, 2026):

for the fix testing - Bartowski's IQ4_XS also has the same issue, which I patched up locally.

<!-- gh-comment-id:5935003099 --> @dazld commented on GitHub (Oct 1, 2026): for the fix testing - Bartowski's IQ4_XS also has the same issue, which I patched up locally.
Author
Owner

@Niko1221 commented on GitHub (Oct 1, 2026):

Fixed in 0.1.32: an unquantized ple_key row stays in the weight arena. Thanks!

<!-- gh-comment-id:5936871784 --> @Niko1221 commented on GitHub (Oct 1, 2026): Fixed in [0.1.32](https://github.com/Niko1221/Strata/releases/tag/v0.1.32): an unquantized ple_key row stays in the weight arena. Thanks!
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#155
No description provided.