Repository navigation
Add native GGUF load path for Qwen4Exp (Flash-Next) mixed-quant shard sets - #169
Open
crispyging wants to merge 11 commits into
Open
crispyging wants to merge 11 commits into
crispyging wants to merge 11 commits into
Conversation
The test built its toy checkpoint from an external HF config file, which made the suite depend on a file outside the repository. Ship the base config as a fixture next to the other GGUF fixtures and load it relative to the test module, so the loader tests run from a clean checkout. 125 GGUF loader/decoder/mapping tests still pass.
crispyging
force-pushed
the
feat/qwen38-ud-q4-k-xl
branch
from
November 14, 2026 19:22
59b8da5 to
944cd75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A native GGUF load path for the Qwen4Exp (Flash-Next) architecture —
load_format=qwen4exp_gguf— so a mixed-quant GGUF shard set runs through the fork's existing kernels instead of requiring a dequantized checkpoint or an alternative runtime.Formats handled
A_log) at load, bounded row chunksQ4_K/Q5_K/Q5_1/Q8_0blocks, TP-sharded on the output rows (w13) and on the packed input width (w2)IQ4_NLin rank-local pinned host memory, decoded on demand through UVACorrectness-relevant details
(output, input)directly. No transpose — a transpose passes any square-matrix assertion and silently corrupts every non-square one.A_log = log(-ssm_a)with>= 0/non-finite rejected.Vrows,conv1dvalue channels,ssm_alpha/ssm_betamatrix rows and thessm_dt.biasvector;ssm_conv1dgains theunsqueeze(1)to(channels, 1, kernel).Tests
125 passedin the loader/decoder suite, all CPU, no GPU or network required:ggufpackage oracle on frozen fixtures (IQ4_NL codebook indices, sign masks, scales, subnormals, tile tails, row alignment), plus float64 accumulation bounds for the matmul references;general.architecture-only-in-shard-1 pattern that llama.cpp emits;1224 -> 923tensor mapping verified against a meta-deviceQwen4ExpForCausalLM(native parameter existence, constructor gates, final namespace), with one whole-inventory count assertion;load_modelthrough the real model registry in a separate CPU process, asserting exception messages rather than classes.A toy 4-layer artifact (GDN, GDN+PLE, Q5_K/Q8_0 experts, QSA) exercises the loader end to end; its base config ships as a fixture so the suite runs from a clean checkout.
Validation
Beyond the CPU suite the path was run as a served engine on 4x gfx1030 with tensor parallelism 4,
dtype=float16: weights load, all four workers bind the pinned IQ4_NL PLE, the RDNA2 GDN prefill kernel and FlashAttention are selected, and generated output passes a semantic/tool-call gate plus a benchmark-side output-diversity check.Known limitation, unchanged by this PR: gfx1030 has no integer dot-product instruction, so the packed expert MMQ path emulates
dp4awith four multiply-adds. Prefill throughput is therefore below what an int4-to-fp16 GEMM lane reaches on the same cards; a half2 dot path for the packed experts is the natural follow-up.