Repository navigation
model: apply .scale tensors automatically + fix correctness - #32669
Merged
Merged
Conversation
ggerganov
reviewed
Nov 20, 2026
Comment on lines
+3575
to
+3576
| const bool acc_bf16 = arch == LLM_ARCH_GLM4 || arch == LLM_ARCH_GLM4_MOE; | ||
| cur = build_lora_mm(wo, cur, wo_s, acc_bf16 ? GGML_PREC_BF16 : GGML_PREC_UNDEFINED); |
Member
There was a problem hiding this comment.
Instead of doing it like this, I was thinking we can now utilize the llama_prec_policy:
Lines 739 to 742 in e626db7
WDYT?
Collaborator
Author
There was a problem hiding this comment.
ah yeah that's better, I didn't know about this new api
ggerganov
approved these changes
Nov 20, 2026
CISC
reviewed
Nov 20, 2026
Collaborator
Author
|
@CISC ok so I used an agent + slice-model skill to slice some safetensors, convert to gguf then load them. results are follow: Legend
Totals:
Note: The PR fixes five models: glm4, glm4moe, jais2 and kolibri1 produce all-NaN output on master, and deepseek41 ignores its expert scales there. All other models that load give bit-identical logits on PR and master. Notes
|
CISC
approved these changes
Nov 21, 2026
# Conflicts: # src/models/inkling2.cpp # tests/fusion/MTL.csv
someaka
pushed a commit
to someaka/llama.cpp
that referenced
this pull request
Nov 22, 2026
origin/master c622f62..e6d624b: mtmd Parakeet rel-pos OOB fix (ggml-org#32722), model .scale auto-application + correctness fix (ggml-org#32669), sycl CONV_TRANSPOSE_1D bound (ggml-org#31109), ggml mul_mat chunk memory access (ggml-org#30846). Zero conflicts; fork seams verified intact (capture ladder, t_hidden_layers, gemma4 extraction guard, public API, server endpoint). Receipts (fresh tool output, 2026-11-21): - build rc=0, zero compiler warnings (ccache/NCCL cmake notices only) - gate_batch.py check vs committed anchor: ALL_BYTE_IDENTICAL (10/10) - self-test 33/33; test-hidden-states C++ and C PASS - logits-probe MATCH; hs-extract-batch-test mode 2 bitwise IDENTICAL - audit_integrity.sh 20/20 (census unchanged); check_doc_claims PASS Assisted-by: Hermes Agent
kinchahoy
added a commit
to kinchahoy/llama-of-vega.cpp
that referenced
this pull request
Nov 22, 2026
…inkling2_loop scales) Assisted-by: Claude Sonnet
4 of 11 tasks
kinchahoy
added a commit
to kinchahoy/llama-of-vega.cpp
that referenced
this pull request
Nov 22, 2026
…inkling2_loop scales) Assisted-by: Claude Sonnet
Annieren
pushed a commit
to Annieren/llama.cpp-upstream
that referenced
this pull request
Nov 23, 2026
…#32669) * model: apply .scale tensors automatically * rm build_moe_ffn "_s" overload * use llama_prec_policy * fix ci * build_lora_mm_id: rm w_s
canonrebel04
added a commit
to canonrebel04/llama.cpp
that referenced
this pull request
Nov 23, 2026
- deepseek2/laguna: build_moe_ffn lost the *_exps_s args (upstream ggml-org#32669 applies .scale tensors automatically) - llama-graph: DSA indexer mask uses the fork's build_attn_inp_kq_mask_dense(force_f16) helper - llama-model: new upstream MOSHI kv cache gets the fork's placement argument
Lanilen
added a commit
to Lanilen/llama.cpp
that referenced
this pull request
Nov 24, 2026
… own The base is upstream f4f6f2e. Upstream's weight scales (ggml-org#32669), the lightning indexer always fused (ggml-org#32650), SCALE through the strides (ggml-org#32735, the fork's own change line for line) and the whole copy of a looped model's experts (ggml-org#32807, kept to the shared tensors). docs/inkling2-mini.md no longer lists the loop fix and the SCALE as the fork's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cinderella-Man
added a commit
to Cinderella-Man/miner-llama
that referenced
this pull request
Nov 24, 2026
Upstream's newest tag, 191 commits past b12483, merged on pascal-p106-v5 af00bb1 (the 14 landed branches). 26 files conflicted. Each kept both sides' intent; the list with reasons is the public data folder docs/data/2026-11-24_c912_upstream_b12674/conflicts.tsv. The ones that change code: - ggml.h, ggml.c, ggml-rpc.h: upstream's GGML_OP_SLEEP and GGML_OP_SIGMOID_BACK go after the fork's three ops after GLU, so the fork's op numbers stay; GGML_OP_COUNT 105, RPC patch version 6 (fork 4 + upstream 2). - ggml-rpc.cpp: upstream's single validation step (ggml-org#32651) already rejects unknown ops, so the fork's own check goes; the client's FREE_BUFFER that forgets dropped graphs (C929) sends with upstream's typed call<>. - mmid.cu: upstream's helper with duplicate expert ids (ggml-org#32505) dumps its store in pieces; the legacy tile layout (GGML_CUDA_MMQ_MOE_LEGACY) reads the expert's column count from n_dumped. - mmq.cuh: the kernel takes kq_fp32 (C861) before upstream's force_tiling (GCN only); the force_tiling launch passes kq_fp32 through. - ggml-cuda.cu: ggml-org#32239 (no matrix-vector fusion on any Pascal card) merged without a conflict; the fork keeps the fusion on compute 6.1 as v5 measured it per file, and GGML_CUDA_MMID_GLU_UNFUSE=2 gives upstream's rule (C893). - llama-graph.cpp: upstream's automatic "<name>.scale" lookup (ggml-org#32669) replaces the explicit scale arguments, the cold tier's included (its scales carry their tensors' names); the down projection's rescale is upstream's use_amax rule (ggml-org#32677) and the fork's LLAMA_NO_MOE_DOWN_RESCALE condition; route-once's histogram before upstream's random routing (ggml-org#29539); the device-built KQ mask (LLAMA_GPU_KQ_MASK) moves into upstream's build_attn_iswa_impl (ggml-org#32429) and replaces only the default mask. - llama-memory-hybrid-idx.cpp: ggml-org#32519 scores only the ubatch's sequences' k-pools; with the k-pool tables on the devices (LLAMA_QSA_KPOOL_DEV) the list keeps every sequence's pools, as the tables hold them (get_n_kpool); the pads avoid every pool's rep in both layouts (LLAMA_QSA_PAD_LINEAR's bound kept). - llama-quant.cpp: N2P and N3P's fallbacks go into upstream's fallback_type_for (ggml-org#15550), with the row width; Q4_1_64 in upstream's moved llama_ftype_get_default_type. - glm5-next.cpp, qwen4exp.cpp: the fused lightning indexer is always on (ggml-org#32650): the in-place row variant (LLAMA_QSA_INDEXER_ROWS) without the removed switch. - flint.cpp, qwen4exp.cpp, gemma4.cpp, test-llama-archs.cpp, test-backend-ops.cpp, server-context.cpp: the fork's code with upstream's signature changes, model-name helper, decision groups and label outputs (ggml-org#32553), gemma4's multi-sequence prune (ggml-org#32342) without device-built masks. Carried upstream fixes now merged upstream: ggml-org#32434 (6026911: upstream's version taken, the fork's change kept is only --ctx-checkpoints-share's copy and get_reuse's two trim arguments) and ggml-org#31913 (2b2da8a: upstream's fill, the same change). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 25, 2026
1 task
Mr-J-369
pushed a commit
to Mr-J-369/llama.cpp-Android
that referenced
this pull request
Nov 25, 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.
Overview
Apply
.scaletensor automatically inbuild_moe_ffn, avoid manually adding them similar to these PRs:output_s)build_ffnffn_gate_up_expsscales (the one you gave me)Additional information
Testing covered all models being changed here in this PR: generated dummy gguf and dump logits; tested against master and this PR
For each case, 2 sub-cases are tested:
Results:
Follow-up, worth fixing too
ggml_mul_mat: some models call it directly instead ofbuild_lora_mm, so these scales (and LoRA) are never applied: kimi-k3/k31 (attention, dense FFN, shared experts), bailingmoe3, glm5-next (including MTPattn_output), kimi-linear, hy_v4attn_gate, mistral-large4attn_q. Mostly MLA and linear-attention projections. This change can't reach them; fixing them means routing those calls throughbuild_lora_mm.ssm_in/ssm_outreuse one physical layer's weights across logical layers. My folding can't represent per-logical-layer scales there.Requirements