Skip to content

quantize : choose quant types to hit a bpw or file size target (upstream #15550) - #156

Merged
dzannotti merged 1 commit into
masterfrom
strix/quantize-target-size
Oct 12, 2026
Merged

dzannotti merged 1 commit into
masterfrom
strix/quantize-target-size

Conversation

@dzannotti

Copy link
Copy Markdown
Collaborator

Stacked on #155, because it needs the GGUF imatrix statistics from upstream ggml-org#14891, which #155 brings in. When #155 is merged and its branch is deleted, GitHub retargets this PR to master. This replaces halo-box#35, which can't be closed there because that repository is archived.

This ports ggml-org#15550 (EAddario, still open upstream) at 839a43500. It adds --target-bpw, --target-size, --state-file and --target-exclude to llama-quantize: for each tensor, it picks the quant type that reaches the target at the lowest estimated error, using the activation statistics in GGUF imatrices.

Measured

Qwen3-1.7B, requantized from Q8_0 on Vulkan. The imatrix comes from docs/ (60×512 tokens). Perplexity is measured on held-out tools/ + examples/ READMEs (60×512 tokens).

model size BPW PPL
Q4_K_M + imatrix 1217 MiB 5.03 6.4851 ± 0.169
--target-bpw 5.0262 1217 MiB 5.03 6.4884 ± 0.169
Q4_0_ROCMFP4 + imatrix (strix path still works) 1280 MiB 5.28 6.4739 ± 0.168

The target is hit exactly. At Q4_K_M's size the quality is the same within the error bars: one earlier run on the halo port came out slightly ahead, this one is level. Reusing --state-file cuts re-targeting to seconds.

🤖 Generated with Claude Code

…eam ggml-org#15550)

Port of ggml-org#15550 (EAddario, still open upstream) at
839a435, which adds --target-bpw, --target-size, --state-file and
--target-exclude: llama-quantize picks per-tensor quant types that reach the
target at the lowest estimated error, using the activation statistics that
ggml-org#14891 writes into GGUF imatrices.

Applied as its diff against its upstream base cb7934c, minus the PR's
stray uv.lock (first ported to halo-box/llama.cpp as #35, now closed there).
In common/imatrix-loader.* the PR's stats loading is merged with ggml-org#14891's
n_layer_nextn. In llama-quant.cpp strix's ROCmFPx rules are kept in every
tensor category, renamed to the PR's TENSOR_CATEGORY_* enum, and the ROCmFP4 /
ROCmFPx fallbacks move into the PR's fallback_type_for().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation examples labels Oct 8, 2026
@pwilkin
pwilkin added this pull request to stack #158 October 8, 2026 19:37
@dzannotti
dzannotti marked this pull request as ready for review October 9, 2026 20:11
Base automatically changed from sync/upstream-2026-10-08 to master October 12, 2026 12:23
@dzannotti
dzannotti merged commit 918108a into master Oct 12, 2026
5 checks passed
@dzannotti
dzannotti deleted the strix/quantize-target-size branch October 12, 2026 12:23
dzannotti added a commit that referenced this pull request Oct 12, 2026
Revert the 2026-10-08 upstream sync (#155) and #156, which depends on it
asf0 pushed a commit to asf0/strix-llama.cpp that referenced this pull request Oct 12, 2026
…target-size"

This reverts commit 918108a, reversing
changes made to 172a530.
pwilkin added a commit that referenced this pull request Oct 13, 2026
quantize : choose quant types to hit a bpw or file size target (re-open of #156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant