llama: Wire up Qwen3.5/Qwen3.5MoE tensors for NVFP4 support#20506
Merged
CISC merged 2 commits intoggml-org:masterfrom Mar 14, 2026
Merged
llama: Wire up Qwen3.5/Qwen3.5MoE tensors for NVFP4 support#20506CISC merged 2 commits intoggml-org:masterfrom
CISC merged 2 commits intoggml-org:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR wires Qwen3.5 and Qwen3.5MoE tensor scale metadata into the model build path so NVFP4 GGUFs load correctly (including linear-attention/recurrent and MoE/shared-expert FFN scale handling).
Changes:
- Pass per-tensor scale tensors into
build_lora_mmfor attention and linear-attention (SSM) projections. - Pass per-tensor and per-expert scale tensors into FFN / MoE FFN builders (including shared experts).
- Extend
llama_layerand tensor loading to create optional scale tensors for the newly wired weights.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/models/qwen35moe.cpp | Threads newly loaded scale tensors through Qwen3.5MoE attention, linear-attention, and MoE/shared-expert FFN paths. |
| src/models/qwen35.cpp | Threads newly loaded scale tensors through Qwen3.5 attention, linear-attention, and dense FFN paths. |
| src/llama-model.h | Adds layer members to store new scale tensors (QKV mixed, gate, SSM, shared-expert FFN scales). |
| src/llama-model.cpp | Creates optional scale tensors for the new layer scale members during tensor loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CISC
approved these changes
Mar 14, 2026
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.
PR #20505 fixes the conversion errors for making Qwen3.5 NVFP4 GGUF files and properly reorders the Qwen3.5 linear attention layers, but without this update, those models will not load.
This update wires up the Qwen3.5 tensors so they are properly loaded from Qwen3.5 NVFP4 gguf files and follows the same design intent using
build_lora_mm:This links up the:
recurrent / linear-attention tensors
FFN tensors that were loading but were not using scales
MoE shared-expert FFN scales