Repository navigation
quant: improve the Q1_0 recipe - #275
baraxnaxgaming-commits wants to merge 1 commit into
Conversation
q1_0 represents every weight in a block at the same magnitude with a sign, so it cannot express that a weight is small. Give it the same treatment the other sub-2-bit types get: keep enough range on the projections every later layer reads through (attn v / MLA kv_b up-proj, attn k on MoE, first eighth of ffn_down, attn output), bulk of the model stays at 1 bit. Also route Q1_0 through the TQ1_0/TQ2_0/Q2_0 Q4_K special-tensor case. Extracted from the dsv41 runtime port (5213136) as its own change.
|
Measurements for the Q1_0 recipe change, on Strix Halo (CPU, deterministic): Setup — Qwen2.5-0.5B base (
So the recipe improves Q1_0 by ~18% PPL at ~1.4x size. To be clear about what that means: Q1_0 remains a format for probing the quantization floor, not a usable model at any size — the PR makes the floor lower, not the format practical. If the size regression is a blocker for the sub-1-bit tier I'd understand; happy to add a version gate or keep it behind a flag if there's a compatibility concern with existing Q1_0 files (the recipe changes tensor contents, not the format, so old files still load, they just quantize differently going forward). |
dzannotti
left a comment
There was a problem hiding this comment.
Verdict
We recommend not merging this. The recipe lowers Q1_0 perplexity as you say, but every dense Q1_0 file, before and after, stays worse than uniform guessing, and IQ1_M at the same size has 900x to 2000x lower PPL. On a native 1-bit model, where Q1_0 has real users, the change makes the file 11.7% larger and gives nothing back.
Direction
Decline. Q1_0 exists here for native 1-bit checkpoints (the Bonsai family), and for those the current default is the right one. If you want to share the recipe for experiments, post it as a --tensor-type / --token-embedding-type command line, which needs no code change. A Q1_0 recipe is not specific to this fork, so upstream is the better place to propose it. We would look at an opt-in ftype only with a measurement where the result is usable.
Asks
If you want to reopen this, these are the points to address:
- Blocking:
src/llama-quant.cpp:734-756changes the default for native Q1_0 models. Requantizing Bonsai-1.7B gives +53.9 MB (+11.7%), KLD against the original goes from 0.00062 to 0.00108, and PPL does not change. Keep the master output for these models. - Blocking: show one case where the new Q1_0 beats both the old Q1_0 and a type of the same size (IQ1_S, IQ1_M), with PPL or KLD in a usable range.
- Should fix,
:748-753: the "first eighth of ffn_down" counts tensors, not layers, so it is wrong when a layer has bothffn_down_expsandffn_down_shexp. Uselayer_info(qs.i_ffn_down, qs.n_ffn_down, name.c_str())as the generic FFN_DOWN arm does (:884). For attn_v (:740-744), copy the IQ arm'sn_gqa() >= 4 || n_expert >= 4gate. Also state that 8-expert models drop attn_v/attn_k from Q8_0 to Q4_K. - Should fix,
:702-703: this edits a line that is identical upstream. Add Q1_0 to the fork-only PTQ1_0 line at:706instead. The kv_b comment at:741does not apply to current GGUFs, because the converters writeattn_k_b/attn_v_b, which stay Q1_0. - Should fix: add
{ "Q1_0", LLAMA_FTYPE_MOSTLY_Q1_0 }totests/test-quant-type-selection.cppand regenerate the snapshots. If an agent helped write this, addAssisted-by:and say so in the body (AGENTS.md). Replace the commit reference to5213136de6, which is not in this repo, with "split from #273", and update the "in progress" note in the body.
Nits: the comment block at :735-739 is longer than the 1-2 lines AGENTS.md asks for, and on models with n_embd % 256 == 128 the shape fallback turns Q4_K into Q5_0 and Q2_K into Q4_0.
Correctness
PASS for the mechanics. All 19 base/head pairs of other ftypes are byte-identical (sha256), including Q4_K_M, Q2_K, TQ1_0, TQ2_0, IQ2_XXS (with imatrix) and two MoE pairs. The Q1_0 changes reach exactly the tensors described. The MoE attn_k branch and the layer cutoff are correct on OLMoE (64 experts, ffn_down_exps in layers 0-1). We did not run an 8-expert, MLA or shared-expert model.
Performance
The PR changes which type each tensor gets, not any kernel, so we measured size and quality, not speed (CPU, wikitext-2 test, -c 512).
| model | file | size | PPL | Mean KLD |
|---|---|---|---|---|
| Qwen2.5-0.5B | Q1_0 master / PR | 220 / 307 MB | 394,381 / 323,224 | 10.12 / 9.78 |
| Qwen2.5-1.5B | Q1_0 master / PR | 415 / 538 MB | 964,955 / 181,784 (*) | 11.49 / 9.88 |
| Qwen2.5-1.5B | IQ1_M (imatrix) | 541 MB | 92.07 (*) | 2.20 |
| Qwen3-0.6B | Q1_0 master / PR | 196 / 221 MB | 3,219,978 / 1,413,263 (*) | 12.62 / 11.76 |
| Qwen3-0.6B | IQ1_M (imatrix) | 216 MB | 1,512 (*) | 4.63 |
| OLMoE-1B-7B | Q1_0 master / PR | 1,053 / 1,216 MB | 271,412 / 23,491 (*) | 11.04 / 8.60 |
| Bonsai-1.7B | Q1_0 requant master / PR | 459 / 513 MB | 24.047 / 24.045 (*) | 0.00062 / 0.00108 |
(*) first 100 chunks; KLD always on the first 100 chunks against the source model. The uniform-guess PPL for the Qwen vocab is 151,936.
Verification
CPU only, on Strix Halo. We compared the PR merged into master 093c552d7 (the PR was 27 commits behind, clean merge) against master. Master has moved since, but no later commit touches src/llama-quant.cpp.
Not tested
GPU runs (no kernel changes), 8-expert, MLA and shared-expert MoE models, IQ1 baselines on OLMoE, and full-test-set PPL for the rows marked (*).
Thank you for splitting this out and posting the measurement.
Review made with AI on behalf of the strix-llama.cpp maintainers.
Full verification (for reproduction and agents)
Environment
Ubuntu 26.04.1 LTS, kernel 7.0.0-43-generic, gcc 15.2.0, cmake 4.2.3, Ninja. CPU backend only (AVX512), 16 threads. No ROCm or Vulkan build: the change runs only at quantize time.
Compared
- master tip (base):
093c552d7296418265ce396ece0e8a824a449ed0 - PR head:
9c7c66d287a017993e734697a0c46fb812bec683 - merged (PR into master, local only):
edd04b77dfdd0ae8b0990a515cbc9f03c3f531f9, clean merge - merge base:
0c1021e1f685531fcdcc7f28d81b7b534adc508f, 27 commits behind the tested master - master later moved to
1dd4c926c;git diff 093c552d7 1dd4c926c -- src/llama-quant.cppis empty.
Build
cmake -G Ninja -S <tree> -B <tree>/build-cpu -DCMAKE_BUILD_TYPE=Release -DGGML_VULKAN=OFF -DGGML_HIP=OFF
cmake --build <tree>/build-cpu -j --target llama-quantize llama-perplexity llama-imatrix llama-gguf test-quant-type-selection
Same flags for both trees.
Models
| repo | file | sha256 | note |
|---|---|---|---|
| Qwen/Qwen2.5-0.5B-Instruct-GGUF | qwen2.5-0.5b-instruct-fp16.gguf | 8e0ae26000627ed62de0e78e41860af70094558b9d2913385c842a6aa06cf3fc | untied output, n_embd 896 |
| Qwen/Qwen2.5-1.5B-Instruct-GGUF | qwen2.5-1.5b-instruct-fp16.gguf | fc89e330deb3fd8fa560f1c0f35a1e2b8da96d59e13445559ed190307a6f5649 | untied output |
| Qwen/Qwen3-0.6B-GGUF | Qwen3-0.6B-Q8_0.gguf | 9465e63a22add5354d9bb4b99e90117043c7124007664907259bd16d043bb031 | tied; dequantized to F16 with master llama-quantize --allow-requantize <q8> <f16> F16 |
| allenai/OLMoE-1B-7B-0125-Instruct-GGUF | OLMoE-1B-7B-0125-Instruct-F16.gguf | b9258178b1bbab5726901d4d25ef54be8e68bf93ad26af4bbab50400bc8da20e | 64 experts, 16 layers, vocab 50304 |
| prism-ml/Bonsai-1.7B-gguf | Bonsai-1.7B-Q1_0.gguf | 3d7c6c90dd98717a203adb22d5eacd2581850e40aa5327e144b97766cae5f7e3 | native Q1_0, tied token_embd |
| ggml-org/ci (dataset) | wikitext-2-raw-v1.zip | wiki.test.raw for PPL/KLD, wiki.train.raw for imatrix |
Commands
# imatrix (master build), one per dense model
llama-imatrix -m <f16> -f wiki.train.raw --chunks 100 -c 512
# quantize, same args on both builds
<build>/bin/llama-quantize [--imatrix <im>] [--token-embedding-type <t>] [--allow-requantize] <src> <out> <FTYPE> 16
sha256sum <out>
# PPL, full test set (master llama-perplexity for every file)
llama-perplexity -m <q> -f wiki.test.raw -c 512 -ngl 0 -t 16
# KLD, first 100 chunks
llama-perplexity -m <src> -f wiki.test.raw -c 512 -ngl 0 -t 16 --chunks 100 --kl-divergence-base <src>.kld
llama-perplexity -m <q> -f wiki.test.raw -c 512 -ngl 0 -t 16 --chunks 100 --kl-divergence-base <src>.kld --kl-divergence
# test
ctest --test-dir <tree>/build-cpu -R quant-type
Determinism: a second KLD base run and a second score of master Q1_0 gave identical Mean PPL(Q) and KLD to all printed digits (Qwen2.5-0.5B and 1.5B). Master A/A quantize of Q4_K_M and IQ2_XXS gave identical sha256.
Results
Byte identity, master vs PR (all MATCH):
| model | ftype | bytes | sha256 |
|---|---|---|---|
| Qwen2.5-0.5B | Q4_K_M | 491400032 | e367f9277d5bd544cc5e8432ee87b7498574df40e8f0784793e2288e9229b971 |
| Qwen2.5-0.5B | Q2_K | 415182688 | a4e04f3a8d9ceebdb0a66b74ccaf3ed78a77bf124e839509fc5f3a98dd97ef9b |
| Qwen2.5-0.5B | Q2_K_S | 407624352 | aa433079ed154155d4d22cb09fa72119bab1a351e45292d6e45baa176ae9b535 |
| Qwen2.5-0.5B | TQ1_0 | 408975200 | 46e9a5999442ce865eae0d55cc4e024601f4a89c9894c696b1d3dcc6d44536bd |
| Qwen2.5-0.5B | TQ2_0 | 413878112 | 6a4af29abdc9991b035c0ce2b754a1aaf0a5d06aa8fa95a87227caa9515b685a |
| Qwen2.5-0.5B | Q2_0 | 345108320 | 64c825e98385cb30adff9be67f0f9f33d24b3d50d0d47e57d8ba8dc11493219c |
| Qwen2.5-0.5B | PTQ1_0 | 322744160 | dbcc674d8ad01cdc6e9c9f5b59df14a14ef4327134c960c8f9d858cef8c9278d |
| Qwen2.5-0.5B | IQ1_S (im) | 392404896 | a762eebffcf39a202ca2b7e6af4f16fc5f5fb2996937321df1fd069e31ddac1e |
| Qwen2.5-0.5B | IQ1_M (im) | 394549920 | e81c0f85ffb18abe9a4237f08d583cf269a19aa18e36a7d1cdc9acc2ebe467f8 |
| Qwen2.5-0.5B | IQ2_XXS (im) | 398124960 | 6ce70f46796f92f46f15f09b69e8ebe5771c4d04690cc1278422ae96373825ec |
| Qwen2.5-0.5B | IQ2_XS (im) | 400984992 | bf52689fc740cde91c7773cb3becd29f3133bb21d8e851532982652a894d1173 |
| Qwen2.5-0.5B | Q3_K_M | 432041824 | 345d93eec761668c88b7ad81452698495fce4000bba1b8149d2d24ecba21c2bf |
| Qwen2.5-0.5B | Q4_0 | 428730208 | 105cea7000558d2321ed5ff4ac67645c6cf43077604fa2180504010c59add5b8 |
| Qwen2.5-0.5B | Q8_0 | 675710816 | 51b344f6dbf12a9e0d7557453f1b115e72277727231b3198dc2f3e5331fb7616 |
| Qwen3-0.6B | Q2_K | 296237728 | d0d7ba5c06290eb3449c50f9b97ce9437f28098cc30273a4e77e35c5de76a8b9 |
| Qwen3-0.6B | TQ1_0 | 226736800 | 12ec63e3cb539a1fd653f8cfc945d67fc26e195350d19a8ee4479fe1dd30675a |
| Qwen3-0.6B | IQ2_XXS (im) | 229445568 | ac0f097aa3a0412573c3819d1fe542ad583e1bfd45b92b08546f91b0a62133a5 |
| OLMoE-1B-7B | Q2_K | 2562762752 | 2c00fc1d9e391534d5782a9b2c77ac15f52b9c1deccf1c4330ebf78fe85f6b70 |
| OLMoE-1B-7B | TQ1_0 | 1568741376 | dc542d233f4b8f52d15cba46b8a145286218b10f737027406e937017ee0f0ab3 |
Tensor types that change with ftype Q1_0, master -> PR:
- Qwen2.5-0.5B (n_embd 896, so the shape fallback applies): token_embd Q1_0 -> Q5_0; attn_v Q1_0 -> Q5_0 (24 layers); attn_output Q1_0 -> Q4_0 (24); ffn_down Q1_0 -> Q2_K (layers 0-2).
- Qwen2.5-1.5B: token_embd -> Q4_K; attn_v -> Q4_K (28); attn_output -> Q2_K (28); ffn_down -> Q2_K (layers 0-2).
- Qwen3-0.6B (tied): attn_v -> Q4_K (28); attn_output -> Q2_K (28); ffn_down -> Q2_K (layers 0-2). token_embd follows output (Q6_K) on both.
- OLMoE: token_embd -> Q4_K; attn_k -> Q4_K (16); attn_v -> Q4_K (16); attn_output -> Q2_K (16); ffn_down_exps -> Q2_K (layers 0-1).
- Bonsai requant (tied): attn_v -> Q4_K (28); attn_output -> Q2_K (28); ffn_down -> Q2_K (layers 0-2).
Qwen2.5-0.5B (F16 PPL 15.7264 +/- 0.11956). PPL is the full test set; PPL100, KLD and same top p are the first 100 chunks.
| variant | build | bytes | PPL | PPL100 | Mean KLD | same top p |
|---|---|---|---|---|---|---|
| Q1_0 | master | 220340320 | 394381.04 +/- 3351.64 | 343631.36 | 10.121134 +/- 0.015551 | 0.000 % |
| Q1_0 | PR | 306874208 | 323224.06 +/- 3724.22 | 230653.23 | 9.782226 +/- 0.020596 | 3.451 % |
Q1_0, --token-embedding-type q1_0 |
PR | 232425568 | 456140.63 +/- 5307.40 | 294126.11 | 10.022857 +/- 0.020878 | 3.784 % |
Q1_0, --token-embedding-type q5_0 |
master | 294788960 | 335199.23 +/- 2918.71 | 296989.39 | 9.967153 +/- 0.015989 | 0.000 % |
| Q1_0, imatrix | PR | 306874528 | 259197.99 +/- 2768.41 | 207781.23 | 9.682961 +/- 0.018971 | 1.820 % |
| PTQ1_0 | master | 322744160 | 4137937.10 +/- 34797.91 | 4128140.09 | 12.595255 +/- 0.017311 | 0.035 % |
| Q2_0 | master | 345108320 | 2280779.17 +/- 19623.55 | 2200878.24 | 11.971845 +/- 0.017156 | 0.075 % |
| IQ1_S, imatrix | master | 392404896 | 31.5109 +/- 0.25258 | 30.6664 | 0.663911 +/- 0.004784 | 61.380 % |
| IQ1_M, imatrix | master | 394549920 | 26.8675 +/- 0.21393 | 26.0434 | 0.506232 +/- 0.003942 | 66.067 % |
| IQ2_XXS, imatrix | master | 398124960 | 23.7988 +/- 0.18785 | 23.5329 | 0.400634 +/- 0.003207 | 69.961 % |
| TQ1_0 | master | 408975200 | 8048.29 +/- 90.76 | 6422.54 | 6.035464 +/- 0.018805 | 9.949 % |
| Q2_K | master | 415182688 | 17.8091 +/- 0.13703 | 17.9971 | 0.137439 +/- 0.001349 | 81.020 % |
Qwen2.5-1.5B (F16 PPL 10.3051 +/- 0.07206 full, 10.3284 +/- 0.17173 on 100 chunks):
| variant | build | bytes | PPL | PPL100 | Mean KLD | same top p |
|---|---|---|---|---|---|---|
| Q1_0 | master | 415033888 | 1314776.72 +/- 21641.10 | 964954.86 | 11.487318 +/- 0.029398 | 1.929 % |
| Q1_0 | PR | 538261024 | 212898.73 +/- 3261.99 | 181784.12 | 9.875488 +/- 0.028293 | 4.855 % |
Q1_0, --token-embedding-type q1_0 |
PR | 439806496 | 287594.29 +/- 4417.28 | 252316.25 | 10.206441 +/- 0.028711 | 4.576 % |
Q1_0, --token-embedding-type q4_k |
master | 513488416 | 1282897.93 +/- 21207.37 | 909767.14 | 11.419625 +/- 0.029497 | 2.682 % |
| Q1_0, imatrix | PR | 538261344 | 83212.39 +/- 1162.38 | 65029.85 | 8.870152 +/- 0.024885 | 4.792 % |
| IQ1_S, imatrix | master | 513103200 | not run | 461.445 +/- 11.459 | 3.860737 +/- 0.016968 | 20.227 % |
| IQ1_M, imatrix | master | 541036896 | not run | 92.068 +/- 1.808 | 2.199235 +/- 0.010676 | 35.957 % |
| IQ2_XXS, imatrix | master | 587593056 | not run | 40.574 +/- 0.764 | 1.377548 +/- 0.007960 | 49.094 % |
| TQ1_0 | master | 605611552 | 14065969.28 +/- 115742.08 | 14105801.32 | 14.208847 +/- 0.017543 | 0.000 % |
| PTQ1_0 | master | 615847456 | not run | 2217079.60 | 12.402747 +/- 0.018531 | 0.016 % |
| Q2_0 | master | 697734688 | 3273905.32 +/- 29620.20 | 3083560.92 | 12.689694 +/- 0.018556 | 0.024 % |
| Q2_K | master | 752880160 | not run | 16.980 +/- 0.291 | 0.510697 +/- 0.004085 | 67.035 % |
Qwen3-0.6B (F16 from Q8_0, PPL100 22.1685 +/- 0.46076), first 100 chunks only:
| variant | build | bytes | PPL100 | Mean KLD | same top p |
|---|---|---|---|---|---|
| Q1_0 | master | 195771040 | 3219977.78 +/- 76851.00 | 12.619350 +/- 0.018260 | 0.000 % |
| IQ1_S, imatrix | master | 208015296 | 5632.11 +/- 152.25 | 5.964905 +/- 0.019922 | 7.290 % |
| IQ1_M, imatrix | master | 216051648 | 1512.28 +/- 39.42 | 4.627269 +/- 0.017455 | 14.620 % |
| Q1_0 | PR | 220936864 | 1413262.88 +/- 41893.71 | 11.761569 +/- 0.021999 | 0.345 % |
| Q1_0, imatrix | PR | 220937152 | 107700398.15 +/- 4014734.70 | 15.897730 +/- 0.028521 | 0.008 % |
| TQ1_0 | master | 226736800 | 39744198.25 +/- 970789.26 | 15.210773 +/- 0.022013 | 0.000 % |
| IQ2_XXS, imatrix | master | 229445568 | 702.50 +/- 19.67 | 3.804212 +/- 0.016754 | 22.216 % |
| PTQ1_0 | master | 230177440 | 63356277.77 +/- 1703770.51 | 15.667070 +/- 0.024411 | 0.004 % |
| Q2_0 | master | 257702560 | 44537384.59 +/- 1088440.40 | 15.286017 +/- 0.022877 | 0.004 % |
| Q2_K | master | 296237728 | 235.77 +/- 6.19 | 2.598886 +/- 0.013545 | 34.459 % |
OLMoE-1B-7B (F16 PPL100 11.0843 +/- 0.21192), first 100 chunks only:
| variant | build | bytes | PPL100 | Mean KLD | same top p |
|---|---|---|---|---|---|
| Q1_0 | master | 1053419520 | 271411.79 +/- 3965.16 | 11.038440 +/- 0.014365 | 0.008 % |
| Q1_0 | PR | 1216419840 | 23490.92 +/- 555.42 | 8.596071 +/- 0.020397 | 1.200 % |
| TQ1_0 | master | 1568741376 | 645306.04 +/- 7985.92 | 11.902754 +/- 0.012429 | 0.000 % |
| Q2_0 | master | 2040600576 | 262915.02 +/- 3444.25 | 10.998018 +/- 0.012863 | 0.000 % |
Bonsai-1.7B, Q1_0 -> Q1_0 with --allow-requantize, first 100 chunks, KLD against the original file:
| variant | bytes | PPL100 | Mean KLD | same top p |
|---|---|---|---|---|
| original | 248302272 | 24.0896 +/- 0.52775 | ||
| requant, master | 459425536 | 24.0473 +/- 0.52600 | 0.000616 +/- 0.000004 | 98.757 % |
| requant, PR | 513296128 | 24.0445 +/- 0.52567 | 0.001077 +/- 0.000009 | 98.294 % |
On master, 309 of 310 tensors are byte-identical to the original. Only the tied token_embd changes (Q1_0 -> Q6_K, because tied embeddings follow output.weight; this is existing behaviour). The PR also re-encodes 59 binary tensors into Q4_K and Q2_K.
test-quant-type-selection: passes on both trees. Q1_0 is not in its ftype table, so it does not cover this change.
Correctness
| check | method | result |
|---|---|---|
| Other ftypes unchanged | sha256 of 19 master/PR quantize pairs on 3 models, A/A first | PASS, all identical |
| Q1_0 tensor routing | tensor-type diff master vs PR on 5 models | matches the PR description; kv_b not present in any tested model |
| Author's claim (lower PPL, larger file) | Qwen2.5-0.5B full wikitext-2 | reproduced: 394,381 -> 323,224 at 1.39x (author: 394,224 -> 323,526) |
| Two more dense models and one MoE | Qwen2.5-1.5B, Qwen3-0.6B, OLMoE | same direction on all three |
| Same-size baseline | IQ1_S, IQ1_M, IQ2_XXS, TQ1_0, Q2_0, PTQ1_0, Q2_K on master | IQ1_M at equal or smaller size has 900x to 2000x lower PPL |
| Native 1-bit model | Bonsai-1.7B requant | regression: +11.7% size, KLD 1.75x, PPL unchanged |
| ffn_down layer cutoff | tensor types on OLMoE (no shared expert) | correct there (layers 0-1); shared-expert case not run |
| 8-expert attn_v/attn_k (Q8_0 -> Q4_K) | not run | no 8-expert model tested; from code reading |
| MLA kv_b | not run | current converters write split tensors; from code reading |
| GPU load of the mixed file | not run | no kernel or loader change |
Findings in full
- Native Q1_0 models: the new arm applies to every Q1_0 quantize, whatever the source. For a model that is already 1-bit, re-encoding the binary tensors into Q4_K/Q2_K adds bytes and cannot add information. Measured on Bonsai-1.7B above.
- Per-bit value: every dense Q1_0 file, with or without the recipe, has PPL above the vocab size (151,936). In this range a lower PPL mostly reflects flatter logits, not a better model, so it does not rank recipes. IQ1_S and IQ1_M at the same size are usable.
- What gives the gain depends on the model. On Qwen2.5-0.5B the token_embd line gives most of it: the recipe without the token_embd change is worse than master (456,141 vs 394,381). On Qwen2.5-1.5B the per-layer part gives most of it (287,594 without the token_embd change; 1,282,898 with only the token_embd change).
:748-753:qs.i_ffn_down < qs.n_ffn_down/8counts every tensor whose name containsffn_down. Withffn_down_expsplusffn_down_shexpper layer, it covers about n_layer/16 layers and can split a layer. The existing IQ1_S snapshots of qwen3.5-397b-a17b and deepseek-v3.1 show this pattern for the same code in the IQ arm.layer_infoat:884handles it.:740-744: attn_v goes to Q4_K on every model. The IQ arm gives Q4_K only whenn_gqa() >= 4 || n_expert >= 4, else Q2_K. On MHA models attn_v is n_embd x n_embd, so this costs much more than on the GQA models tested.- Before this PR, Q1_0 on an 8-expert model put attn_v and attn_k at Q8_0 (generic arms). The new arm puts them at Q4_K. This matches the IQ arm, but the PR does not state it.
:741: in-tree MLA converters (deepseek, glm, kimi, bailingmoe3, dots3) writeattn_k_b/attn_v_b, notattn_kv_b, so on current files the up-projections stay Q1_0.:702-703: the edited condition is identical to upstream. The fork-only PTQ1_0 line at:706already gives Q4_K; adding Q1_0 there leaves the upstream line alone.--pureand--tensor-typeskip the new arm as expected. With--tensor-typeon some ffn_down tensors, the counter is not incremented for those, so the cutoff moves (same as the IQ arm).- Unrelated, existing on master:
--token-embedding-type q4_kon a model withn_embd % 256 != 0(Qwen2.5-0.5B) fails with "quantized data validation failed", because the explicit type skips the shape fallback.
Claims
- "Smaller PPL at a larger size" on Qwen2.5-0.5B: reproduced.
- The recipe gives Q1_0 "the same treatment" as the other sub-2-bit types: the files grow as stated, but they stay far behind IQ1_S/IQ1_M at the same size.
- "Also covers the MLA kv_b up-projection": true only for older GGUFs with a fused
attn_kv_b; not tested on a model. - The PR body mentions measurements in progress on the target hardware. The posted numbers are CPU (
-ngl 0), and so are ours.
Not tested
- GPU (ROCm, Vulkan): the PR changes only the type chosen per tensor at quantize time.
- 8-expert, MLA and shared-expert MoE models.
- IQ1_S/IQ1_M on OLMoE (needs an imatrix for the 7B model).
- Full-test-set PPL for Qwen3-0.6B, OLMoE, Bonsai and some Qwen2.5-1.5B baselines; those use the first 100 chunks.
- Bonsai from unpacked weights; we requantized the published Q1_0 file.
|
Accepting the decline. I re-ran the decisive checks on halo-A (gfx1151, CPU,
The recipe as a command line — the approach the review suggested, no code change. Verified on Qwen3-0.6B: master Notes for experimental use:
All should-fix items (layer_info cutoff, attn_v gate, PTQ1_0 line, stale kv_b comment, Q1_0 in test-quant-type-selection, Thanks for the thorough review — the Bonsai and IQ1_M baselines settle it. An AI agent (Hermes) wrote this PR and ran the checks above. |
|
Closing per review: declined on the merits (see my comment with the verified Bonsai/IQ1_M numbers and the --tensor-type command-line recipe). |
Split from #273 per review — Q1_0 recipe extracted as its own change (it rode along in the dsv41 runtime commit there).
What
Q1_0 represents every weight in a block at the same magnitude with a sign, so it cannot express that a weight is small. The other sub-2-bit types stay usable by spending bits unevenly; this gives Q1_0 the same treatment:
Also routes Q1_0 through the TQ1_0/TQ2_0/Q2_0 special-tensor -> Q4_K case.
Measurements (in progress — will post in comments)
Same base model quantized at Q1_0 with the merge-base master build vs this branch, perplexity + file size, on Strix Halo.