model : support NVFP4 tensors for Gemma4#21971
Merged
Conversation
ggerganov
approved these changes
Apr 16, 2026
Comment on lines
2238
to
+2246
| if (arch == LLM_ARCH_GLM4 || arch == LLM_ARCH_GLM4_MOE) { | ||
| // GLM4 and GLM4_MOE seem to have numerical issues with half-precision accumulators | ||
| cur = build_lora_mm(wo, cur); | ||
| ggml_mul_mat_set_prec(cur, GGML_PREC_F32); | ||
| if (wo_s) { | ||
| cur = ggml_mul(ctx0, cur, wo_s); | ||
| } | ||
| } else { | ||
| cur = build_lora_mm(wo, cur, wo_s); |
Member
There was a problem hiding this comment.
Maybe a follow-up PR to fix the order of the build_lora_mm arguments (e.g. cur, wo, wo_s) and add an optional precision argument to avoid this branching.
Member
Author
There was a problem hiding this comment.
Yes, will be more manageable after merging #21245
Member
Author
|
@ngxson gentle ping, merge this, then |
6 tasks
cnsiva
pushed a commit
to saas-home/llama.cpp
that referenced
this pull request
Apr 17, 2026
* support nvfp4 tensors for Gemma4 * add wo_s to build_attn * add wo_s to build_attn * fix glm4
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.
Overview
Add support for NVFP4 Gemma4.
Additional information
Also adds
wo_stobuild_attnto be able to pass it on tobuild_lora_mm.GGUF: CISCai/gemma-4-31B-it-NVFP4-turbo-GGUF
Requirements