Repository navigation
Conversation
Dorijan10
force-pushed
the
fix/quant-tensor-type-non-quantized
branch
from
October 30, 2026 10:27
465ee1f to
c8948eb
Compare
llama_tensor_get_type() only checked the --tensor-type patterns when the default type was quantized. With an F32, F16 or BF16 target every override was dropped without a message and the tensor kept the target type. Check the patterns for every target type and keep the mixture rules for quantized targets only. --token-embedding-type and --output-tensor-type already worked with these targets.
Dorijan10
force-pushed
the
fix/quant-tensor-type-non-quantized
branch
from
October 30, 2026 10:31
c8948eb to
b68f460
Compare
Dorijan10
marked this pull request as ready for review
October 30, 2026 10:34
This branch has not been deployed
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
llama-quantizecurrently ignores--tensor-typeoverrides when the target type is F32, F16, or BF16. The command exits successfully (code 0), does not print anapplying manual overridemessage, and leaves every tensor in the target type. By contrast,--token-embedding-typeand--output-tensor-typealready work as expected with these targets.The issue is in
llama_tensor_get_type(), where the override loop is nested insideif (ggml_is_quantized(default_type)). This PR moves that loop outside the condition so overrides are checked for all target types. The mixture rules inllama_tensor_get_type_implremain restricted to quantized targets.tensor_type_fallback()also now runs for every target type; for F32, F16, and BF16, it has no effect because the block size is 1.This is existing behavior rather than a regression. The condition has been present since
--tensor-typewas introduced in #12511. Subsequently, #25716 removed the--pureportion of that same condition.Additional information
The issue can be reproduced using the public
Qwen3.5-0.8B-BF16.gguffile fromunsloth/Qwen3.5-0.8B-GGUF(revision6ab4614):llama-quantize --tensor-type 'blk\.3\.ffn_down=q4_k' Qwen3.5-0.8B-BF16.gguf probe.gguf BF16On
master, the resulting file still contains all 187 tensors in BF16. With this PR, onlyblk.3.ffn_down.weightis converted from BF16 to Q4_K. The output file is 5,275,648 bytes smaller, exactly matching the difference between that tensor's BF16 and Q4_K sizes. A 32-token greedy completion also matches the BF16 input. When using a quantized target (Q8_0), the output remains byte-identical before and after the change.For testing, a new local section in
test-quant-type-selectionapplies one override to a mock model for each of F32, F16, BF16, Q8_0, and Q4_K_M. Without the fix, the F32, F16, and BF16 cases fail. With the fix, all five cases pass, and the 11 snapshot models continue to pass as well.Related work: draft #24408 contains a similar change for ftype COPY, but that change is not included in its split PRs.
Logs
master:
this PR:
test, without and with the fix:
Requirements