[PR #3925] [Engine] q36: load GGUFs whose ssm_alpha / ssm_beta are K-quants or IQ4_XS #4838

Open
opened 2026-11-07 15:39:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3925
Author: @schmittcn
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: pr/q36-kquant-small-tensors


📝 Commits (2)

  • f03b60e strata-q36: widen K-quant and IQ4_XS small tensors in upload_f32
  • 93f73f5 strata-q36: reword the upload_f32 comment

📊 Changes

1 file changed (+9 additions, -1 deletions)

View changed files

📝 src/qwen35/q36_engine.cu (+9 -1)

📄 Description

Problem and result

The Qwen3.6 path refuses mixed GGUFs at load. Their small GDN gates (ssm_alpha, ssm_beta) are stored in the file's
main format rather than F32 / Q8_0:

strata-q36: blk.0.ssm_alpha.weight is IQ4_XS, expected F32, BF16, F16 or Q8_0

Seen with third-party mixed GGUFs:

The official Qwen3.6-35B-A3B files store these gates as F32 or Q8_0, so they do not hit this failure.

#3699 reports the same for Sage-A1.5's Q4_K_M, where the gates are Q4_K, and leaves it out of that PR. With this
change, upload_f32 widens Q3_K, Q4_K, Q5_K, Q6_K and IQ4_XS on the host with the reference dequantizers that are
already in strata/artifact/dequant.hpp, the same way it widens Q8_0. These tensors are small (30 layers x 2
tensors). A file whose expert formats the engine takes then loads and runs.

  • #3699 names this obstacle and leaves it out of its PR.
  • #3678 (draft, quantized KV caches) carries a similar branch for Q3_K..Q6_K inside a larger change, without IQ4_XS.
    This PR is the loader part alone. It is a focused fix, so there is no scope issue. If #3678 lands first, this PR
    reduces to the IQ4_XS case.

Approach

One more branch in upload_f32, for types 11-14 and 23 with a size that is a multiple of 256. It calls
dequantize_q3_K / q4_K / q5_K / q6_K / iq4_xs per 256-value super-block. The error message lists the new
formats. Files the loader already took never reach the new branch, so their path is unchanged.

Validation

Environment:

  • RX 6900 XT 16 GB (gfx1030), Ryzen 9 5950X, 64 GB, Arch Linux, ROCm 7.2.4.
  • HIP build of 8183c6b6 + f03b60e4 (the later commit changes a code comment only): -DSTRATA_ENABLE_HIP=ON -DGPU_TARGETS=gfx1030, target strata-q36.

Passed:

  • Build: HIP build of strata-q36. q36_engine.cu has the same 6 warnings as at 8183c6b6, none new.
  • The failure, reproduced: strata-q36 --native <IQ4_XS-gate file> --max-context 8192 --tokens <2,540 ids> --n 32 stops at 8183c6b6 with the message above. With this commit it loads and continues the prompt
    coherently.
  • Determinism: two runs give byte-identical --dump-full-logits output.
  • Real use: the same code served an IQ4_XS-gate file (256K) and a Q6_K-gate file (128K) through serve/server.py
    on this machine for a day. That covered chat, agent sessions and the community benchmark suite, with coherent answers
    throughout.
  • Independent check by hermeticvm, RX 6700 XT (gfx1031), HIP build of f03b60e4: with the Qwen3.6 heretic IQ4_XS
    file and an F32 copy of it, the same 14-token prompt and forced continuation gave byte-identical --dump-full-logits
    output across original → F32 copy → original (9 vectors of 248,320 logits, 21 of 256 experts per layer in VRAM).
    The expanded gates matched the Python GGUF dequantizer. See their comment.
  • CUDA build by AndyAnttle, 93f73f5f: clean build of strata-q36 on Windows, MSVC 2022 + CUDA 13.0,
    -DCMAKE_CUDA_ARCHITECTURES=86, with and without -DSTRATA_Q6K_EXPERTS=ON (warning set not compared to the base).
    An Ornith-1.5 Q4_K_M file (Q4_K gates) stops at the expert check from #3699 on this head alone; with Q4_K expert-down
    support also in the tree it loads and serves on an RTX 3090 (131K context, MTP 2). That tree carries other changes,
    so this counts as "loads and serves", not as a speed result. See their comment.

Failed: none observed.

Not run:

  • SYCL build: I have no Intel toolchain. The change is host C++ in q36_engine.cu and adds one include.
  • Q3_K and Q5_K gates on hardware: not run. Q4_K gates only ran in AndyAnttle's tree with expert-down support added (above).
  • KL against llama.cpp (tools/qwen35/kl.py): not run. The dequantizers are the existing reference ones.

Limits

Only upload_f32 changes. A file whose routed experts use a format the native expert kernels do not take, such as a
Q4_K down projection (#3699), is still refused at that check.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3925 **Author:** [@schmittcn](https://github.com/schmittcn) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/q36-kquant-small-tensors` --- ### 📝 Commits (2) - [`f03b60e`](https://github.com/Niko1221/Strata/commit/f03b60e40ed7ac0943ec62d70807d5f848bb9656) strata-q36: widen K-quant and IQ4_XS small tensors in upload_f32 - [`93f73f5`](https://github.com/Niko1221/Strata/commit/93f73f5f40ce360a172e40f76b8e427a9e0329c4) strata-q36: reword the upload_f32 comment ### 📊 Changes **1 file changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/qwen35/q36_engine.cu` (+9 -1) </details> ### 📄 Description ## Problem and result The Qwen3.6 path refuses mixed GGUFs at load. Their small GDN gates (`ssm_alpha`, `ssm_beta`) are stored in the file's main format rather than F32 / Q8_0: ``` strata-q36: blk.0.ssm_alpha.weight is IQ4_XS, expected F32, BF16, F16 or Q8_0 ``` Seen with third-party mixed GGUFs: - IQ4_XS gates, including [hermeticvm's Qwen3.6-35B-A3B heretic IQ4_XS](https://huggingface.co/hermeticvm/Qwen3.6-35B-A3B-heretic-MTP-IQ4_XS-GGUF). - A file with Q6_K gates. The official Qwen3.6-35B-A3B files store these gates as F32 or Q8_0, so they do not hit this failure. #3699 reports the same for Sage-A1.5's Q4_K_M, where the gates are Q4_K, and leaves it out of that PR. With this change, `upload_f32` widens Q3_K, Q4_K, Q5_K, Q6_K and IQ4_XS on the host with the reference dequantizers that are already in `strata/artifact/dequant.hpp`, the same way it widens Q8_0. These tensors are small (30 layers x 2 tensors). A file whose expert formats the engine takes then loads and runs. ## Related discussion - #3699 names this obstacle and leaves it out of its PR. - #3678 (draft, quantized KV caches) carries a similar branch for Q3_K..Q6_K inside a larger change, without IQ4_XS. This PR is the loader part alone. It is a focused fix, so there is no scope issue. If #3678 lands first, this PR reduces to the IQ4_XS case. ## Approach One more branch in `upload_f32`, for types 11-14 and 23 with a size that is a multiple of 256. It calls `dequantize_q3_K` / `q4_K` / `q5_K` / `q6_K` / `iq4_xs` per 256-value super-block. The error message lists the new formats. Files the loader already took never reach the new branch, so their path is unchanged. ## Validation Environment: - RX 6900 XT 16 GB (gfx1030), Ryzen 9 5950X, 64 GB, Arch Linux, ROCm 7.2.4. - HIP build of `8183c6b6` + `f03b60e4` (the later commit changes a code comment only): `-DSTRATA_ENABLE_HIP=ON -DGPU_TARGETS=gfx1030`, target `strata-q36`. **Passed:** - **Build:** HIP build of `strata-q36`. `q36_engine.cu` has the same 6 warnings as at `8183c6b6`, none new. - **The failure, reproduced:** `strata-q36 --native <IQ4_XS-gate file> --max-context 8192 --tokens <2,540 ids> --n 32` stops at `8183c6b6` with the message above. With this commit it loads and continues the prompt coherently. - **Determinism:** two runs give byte-identical `--dump-full-logits` output. - **Real use:** the same code served an IQ4_XS-gate file (256K) and a Q6_K-gate file (128K) through `serve/server.py` on this machine for a day. That covered chat, agent sessions and the community benchmark suite, with coherent answers throughout. - **Independent check by hermeticvm, RX 6700 XT (gfx1031), HIP build of `f03b60e4`:** with the Qwen3.6 heretic IQ4_XS file and an F32 copy of it, the same 14-token prompt and forced continuation gave byte-identical `--dump-full-logits` output across original → F32 copy → original (9 vectors of 248,320 logits, 21 of 256 experts per layer in VRAM). The expanded gates matched the Python GGUF dequantizer. See [their comment](https://github.com/Niko1221/Strata/pull/3925#issuecomment-6558936955). - **CUDA build by AndyAnttle, `93f73f5f`:** clean build of `strata-q36` on Windows, MSVC 2022 + CUDA 13.0, `-DCMAKE_CUDA_ARCHITECTURES=86`, with and without `-DSTRATA_Q6K_EXPERTS=ON` (warning set not compared to the base). An Ornith-1.5 Q4_K_M file (Q4_K gates) stops at the expert check from #3699 on this head alone; with Q4_K expert-down support also in the tree it loads and serves on an RTX 3090 (131K context, MTP 2). That tree carries other changes, so this counts as "loads and serves", not as a speed result. See [their comment](https://github.com/Niko1221/Strata/pull/3925#issuecomment-6573811263). **Failed:** none observed. **Not run:** - **SYCL build:** I have no Intel toolchain. The change is host C++ in `q36_engine.cu` and adds one include. - **Q3_K and Q5_K gates on hardware:** not run. Q4_K gates only ran in AndyAnttle's tree with expert-down support added (above). - **KL against llama.cpp** (`tools/qwen35/kl.py`): not run. The dequantizers are the existing reference ones. ## Limits Only `upload_f32` changes. A file whose routed experts use a format the native expert kernels do not take, such as a Q4_K down projection (#3699), is still refused at that check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#4838
No description provided.