fix(graph): remove duplicate wo_s scale after build_attn (Qwen3, LLaMA)#22421
Merged
Conversation
Signed-off-by: Yash Nankani <ynankani@nvidia.com>
danbev
approved these changes
Apr 27, 2026
IntelNav
pushed a commit
to IntelNav/llama.cpp
that referenced
this pull request
Apr 29, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
IntelNav
pushed a commit
to IntelNav/llama.cpp
that referenced
this pull request
Apr 29, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
rsenthilkumar6
pushed a commit
to rsenthilkumar6/llama.cpp
that referenced
this pull request
May 1, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
samuraieng
pushed a commit
to samuraieng/llama.cpp
that referenced
this pull request
May 6, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
ljubomirj
pushed a commit
to ljubomirj/llama.cpp
that referenced
this pull request
May 6, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
meh
pushed a commit
to meh/llama.cpp
that referenced
this pull request
May 10, 2026
…gml-org#22421) Signed-off-by: Yash Nankani <ynankani@nvidia.com>
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
Observed that build_attn present in llama-graph already applies NVFP4 per tensor scale (wo_s) via
llama-graph.cpp (build_lora_mm(wo, cur, wo_s) or explicit wo_s mul).
Also observed these model builders(qwen3, qwen3moe, llama) are also multiplied the
result by wo_s again, so wo_s was applied twice whenever companion
blk.*.attn_output.scale tensors were present.
That crushed the attention residual (roughly wo_s^2 per layer) and broke
NVFP4 GGUFs for LLM_ARCH_QWEN3, LLM_ARCH_QWEN3MOE, and LLM_ARCH_LLAMA /
LLM_ARCH_LLAMA_EMBED.
Remove the redundant ggml_mul blocks in:
Non-NVFP4 GGUFs keep wo_s == nullptr, so behavior is unchanged there.
Additional information
This issue was observed when running inference on https://huggingface.co/nvidia/Qwen3-8B-NVFP4 converted GGUF model
Requirements