Skip to content

quantize : choose quant types to hit a bpw or file size target (re-open of #156) - #170

Merged
pwilkin merged 1 commit into
reapply/upstream-sync-2026-10-08from
reapply/quantize-target-size
Oct 13, 2026
Merged

pwilkin merged 1 commit into
reapply/upstream-sync-2026-10-08from
reapply/quantize-target-size

Conversation

@dzannotti

Copy link
Copy Markdown
Collaborator

Re-opens #156, which was reverted in #168 together with the upstream sync it depends on.

Stacked on 169 (the re-opened sync). Merge that one first; this PR's diff is #156 only.


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

…size"

Brings back #156, reverted in #168 together with the upstream sync it
depends on.

This reverts commit f26016a.
@pwilkin
pwilkin merged commit 257603e into reapply/upstream-sync-2026-10-08 Oct 13, 2026
@pwilkin
pwilkin deleted the reapply/quantize-target-size branch October 13, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants