Repository navigation
feat(gguf): serve Qwen3.5 dense and MoE GGUF checkpoints - #701
Merged
Merged
Conversation
jason-fxz
added this pull request to stack #703
October 16, 2026 05:11
25 of 42 tasks
void-mckenzie
pushed a commit
to void-mckenzie/FreeToken
that referenced
this pull request
Oct 16, 2026
Adds the llama.cpp glm5-next GGUF reader (unsloth GLM-5.3-Flash-GGUF, both the glm5-next and the older glm5next arch spellings) on the GGUF quant kind from FlashML-org#690: - parse_gguf_config derives the text config from the GGUF KV metadata, with per-block attention.head_count_kv laying out the KDA/DSA hybrid (tensor-name census fallback for the pre-list writer), the trailing MTP block dropped like the HF loader drops it, and the MLA head widths from the *_length_mla keys (q_b/v_b rows fallback). - iter_gguf_weights maps every tensor to the glm5_next state dict and undoes the converter transforms: A_log stored as -exp(A_log) is inverted, the per-head attn_k_b/attn_v_b pair (k transposed) fuses into the dense kv_b_proj layout the MLA absorption reads, and the q|k|v conv kernels concatenate on the channel axis. The mixed-type fused KDA in_proj (Q8_0 q|k|v + BF16 b|f_a|g_a) rides FlashML-org#702 segments; the routed experts load as GGUF expert banks at their shipped types (unsloth dynamic quants: IQ3_S gate/up + IQ4_XS down, Q8_0 outlier layers pass through natively). - passes quant_config to embed_tokens so the Q8_0 token_embd serves packed; registers Glm5NextGGUFForCausalLM and claims it in the AOT table (also claims the two qwen3.5 GGUF archs FlashML-org#701 left unclaimed, which broke the claim test on main). - expert banks: load_gguf_expert_banks gains the dense-MLP prefix offset (first_k_dense_replace) glm5-next needs -- banks for MoE layers mid-stack read blk.<first + moe_layer> now. Verified end to end against unsloth GLM-5.3-Flash-IQ4_XS (5 split shards): full 45-layer engine on a 32GB GPU serves coherent output with 43 layers of IQ3_S/IQ4_XS experts off host banks; unit tests cover the config parse, the state-dict mapping and each converter transform on a synthetic miniature glm5-next GGUF. Text-only, TP=1. Part of FlashML-org#671.
void-mckenzie
pushed a commit
to void-mckenzie/FreeToken
that referenced
this pull request
Oct 20, 2026
Adds the llama.cpp glm5-next GGUF reader (unsloth GLM-5.3-Flash-GGUF, both the glm5-next and the older glm5next arch spellings) on the GGUF quant kind from FlashML-org#690: - parse_gguf_config derives the text config from the GGUF KV metadata, with per-block attention.head_count_kv laying out the KDA/DSA hybrid (tensor-name census fallback for the pre-list writer), the trailing MTP block dropped like the HF loader drops it, and the MLA head widths from the *_length_mla keys (q_b/v_b rows fallback). - iter_gguf_weights maps every tensor to the glm5_next state dict and undoes the converter transforms: A_log stored as -exp(A_log) is inverted, the per-head attn_k_b/attn_v_b pair (k transposed) fuses into the dense kv_b_proj layout the MLA absorption reads, and the q|k|v conv kernels concatenate on the channel axis. The mixed-type fused KDA in_proj (Q8_0 q|k|v + BF16 b|f_a|g_a) rides FlashML-org#702 segments; the routed experts load as GGUF expert banks at their shipped types (unsloth dynamic quants: IQ3_S gate/up + IQ4_XS down, Q8_0 outlier layers pass through natively). - passes quant_config to embed_tokens so the Q8_0 token_embd serves packed; registers Glm5NextGGUFForCausalLM and claims it in the AOT table (also claims the two qwen3.5 GGUF archs FlashML-org#701 left unclaimed, which broke the claim test on main). - expert banks: load_gguf_expert_banks gains the dense-MLP prefix offset (first_k_dense_replace) glm5-next needs -- banks for MoE layers mid-stack read blk.<first + moe_layer> now. Verified end to end against unsloth GLM-5.3-Flash-IQ4_XS (5 split shards): full 45-layer engine on a 32GB GPU serves coherent output with 43 layers of IQ3_S/IQ4_XS experts off host banks; unit tests cover the config parse, the state-dict mapping and each converter transform on a synthetic miniature glm5-next GGUF. Text-only, TP=1. Part of FlashML-org#671.
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.
Summary
Serves llama.cpp
qwen35(dense) andqwen35moe(MoE) GGUF files, which cover Qwen3.5, Qwen3.6 and Qwen3.8 (27B and 2.4T-A95B), on the existingqwen3_5_moemodel classes. Text only; MTP blocks in the file are skipped.Changes
models/qwen3_5_moe/gguf.py(new):ffn_gate_up_exps.A_logis restored from-exp(A_log)..scaletensors.gdn.py,model.py:ssm_outkeeps its tiled input columns, because a K-quant superblock spans two heads. Under GGUF the GDN layer permutes its input to that order instead.embed_tokenstakes the quant config, so a quantizedtoken_embdis served packed.gguf/config.py,register.py: register the two archs.Tested models
RTX PRO 6000 Blackwell (sm_120),
ft serve --model-path <file>, AIME25 #1 run greedy to EOS, plus 48 staggered requests at concurrency 16.Staggered requests: no corrupted output on any file.
Results
ggml.dequantize, every float tensor is bf16-exact against the HF checkpoint, and Q8_0 tensors reach cos 0.99998. Dry load against the meta-built model matches 493/493 params (35B-A3B) and 738/738 (27B).tests/moe,tests/kernels/test_ggml.py, and thetests/modelstests for qwen3_5_moe, the registry, the loader and gemma4 GGUF pass.Not covered