feat(gguf): add Qwen3.5 (qwen3-next) hybrid MoE GGUF loader#2049
Open
emanueleDiVizio wants to merge 3 commits intoEricLBuehler:masterfrom
Open
feat(gguf): add Qwen3.5 (qwen3-next) hybrid MoE GGUF loader#2049emanueleDiVizio wants to merge 3 commits intoEricLBuehler:masterfrom
emanueleDiVizio wants to merge 3 commits intoEricLBuehler:masterfrom
Conversation
Add GGUF quantized model support for the Qwen3.5 architecture (qwen3-next), which combines: - Full attention layers with GDN (Gated DeltaNet) recurrent layers - Mixture-of-Experts with shared experts - Support for both MoE (Qwen3.5-35B) and dense variants Key implementation details: - QRmsNorm casts weights to input dtype for GGUF BF16 compatibility - RoPE uses model dtype instead of F32 for GGUF BF16 - GDN conv1d weight layout transposed from (kernel,dim) to (dim,1,kernel) - V-head expansion uses tiled layout for both MoE and dense - Local hybrid cache (GDN + attention KV) with proper cleanup - SharedExpert gate dequantized and reshaped for Linear Registers `Qwen35` and `Qwen35Moe` GGUF architecture variants.
3f88cdc to
bbd4272
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.
Summary
This PR adds full GGUF support for the Qwen3.5 architecture (internally
qwen3-next), including hybrid GDN (GatedDeltaNet) + attention layers and MoE variants.Qwen3.5 is not a standard transformer: it combines recurrent GDN layers, attention blocks, and mixture-of-experts routing. Supporting it in GGUF required implementing both the architecture and its tensor layout/dtype semantics.
This enables inference of quantized Qwen3.5 models (e.g. Qwen3.5-35B-Instruct GGUF) on both Metal and CUDA backends.
Key changes
Model support
quantized_qwen3_next.rsimplementing:GGUF compatibility fixes
Runtime state
Testing