QUF: Quantized Unified Format
QUF is a single-file container (.quf) for a 4-bit quantized decoder-only LLM. One file holds the model config, tokenizer files, quantization scheme and all tensors. This package provides a reference writer and reader, a native GPTQ converter, a runtime with CPU and CUDA backends, and a benchmark suite.
QUF runs natively on Windows (and any platform with PyTorch). No WSL or Linux environment is needed.
Supported architectures: Qwen2ForCausalLM (first), with Qwen3ForCausalLM addable through the architecture allow-list. By default, weights are 4-bit with group size 32, act-order and clip search. The default preset is size_f (0.4.0): k_proj, v_proj and the whole last layer are stored at int8 and everything else at int4 (down_proj included). The embedding table, and an untied lm_head, are stored as per-row int8 with group size 64 (--embed-precision int8, QUF format version 3). --preset size_b is the 0.3.0 body (last layer int8 only) and --preset sensitive reproduces 0.2.0. --embed-precision fp16 keeps the embedding and lm_head as fp16.
Summary
Qwen2.5 on an RTX 5080 Laptop GPU, native Windows (the 0.5B and 1.5B speed numbers come from one battery-powered session, and the 3B speed numbers from one session on AC power), QUF 0.4.0 defaults against fp16 and five GGUF variants. Perplexity uses the llama protocol over the full WikiText-2 test split and a held-out C4 slice. Full method, per-axis verdicts and caveats: docs/RESULTS.md.
Qwen2.5-0.5B (llama protocol, full WikiText-2 test and the C4 slice)
| Format |
Size MB |
WikiText-2 PPL |
C4 PPL |
Decode tok/s (median, min-max) |
Δ WikiText-2 vs fp16 |
Δ C4 vs fp16 |
Pareto front |
| fp16 (reference) |
988.1 |
11.740 |
18.239 |
not measured |
0 |
0 |
n/a |
| QUF 0.4.0 default |
367.9 |
11.987 |
18.777 |
662 (658-666) |
+2.10% |
+2.94% |
yes |
| GGUF Q4_K_M (no imatrix) |
397.8 |
12.043 |
18.724 |
494 (459-510) |
+2.58% |
+2.66% |
yes |
| GGUF Q4_K_M-imat |
397.8 |
11.959 |
18.593 |
494 (459-510) † |
+1.87% |
+1.94% |
yes |
| GGUF Q4_K_S (no imatrix) |
385.5 |
12.207 |
19.002 |
496 (486-538) |
+3.98% |
+4.18% |
no |
| GGUF IQ4_XS-imat |
349.4 |
12.286 |
19.046 |
496 (489-523) |
+4.65% |
+4.42% |
yes |
| GGUF Q5_K_M (no imatrix) |
420.1 |
11.961 |
18.505 |
506 (483-534) |
+1.88% |
+1.46% |
yes |
QUF against each GGUF variant, Qwen2.5-0.5B (size: smaller wins; perplexity: difference under 0.1% is a tie, otherwise lower wins; speed: overlapping min-max ranges are a tie):
| vs |
Size |
WikiText-2 |
C4 |
Speed |
| GGUF Q4_K_M (no imatrix) |
QUF wins (-7.5%) |
QUF wins (-0.46%) |
QUF loses (+0.28%) |
QUF wins, median ratio 1.340 |
| GGUF Q4_K_M-imat |
QUF wins (-7.5%) |
QUF loses (+0.23%) |
QUF loses (+0.99%) |
QUF wins, median ratio 1.340 † |
| GGUF Q4_K_S (no imatrix) |
QUF wins (-4.6%) |
QUF wins (-1.80%) |
QUF wins (-1.18%) |
QUF wins, median ratio 1.334 |
| GGUF IQ4_XS-imat |
QUF loses (+5.3%) |
QUF wins (-2.43%) |
QUF wins (-1.41%) |
QUF wins, median ratio 1.334 |
| GGUF Q5_K_M (no imatrix) |
QUF wins (-12.4%) |
QUF loses (+0.22%) |
QUF loses (+1.47%) |
QUF wins, median ratio 1.308 |
Beat_Target (size ≤ Q4_K_M, WikiText-2 ≤ Q4_K_M, decode tok/s ≥ Q4_K_M): reached on 0.5B (size ok, WikiText-2 ok, speed ok).
Pareto front (size, WikiText-2, C4, lower is better on all): QUF 0.4.0 default, GGUF Q4_K_M (no imatrix), GGUF Q4_K_M-imat, GGUF IQ4_XS-imat, GGUF Q5_K_M (no imatrix). Dominated: GGUF Q4_K_S (no imatrix) (by QUF 0.4.0 default).
Qwen2.5-1.5B (llama protocol, full WikiText-2 test and the C4 slice)
| Format |
Size MB |
WikiText-2 PPL |
C4 PPL |
Decode tok/s (median, min-max) |
Δ WikiText-2 vs fp16 |
Δ C4 vs fp16 |
Pareto front |
| fp16 (reference) |
3087.4 |
8.296 |
13.476 |
not measured |
0 |
0 |
n/a |
| QUF 0.4.0 default |
1040.0 |
8.420 |
13.763 |
283 (263-285) |
+1.49% |
+2.13% |
yes |
| GGUF Q4_K_M (no imatrix) |
986.0 |
8.600 |
13.954 |
274 (268-279) |
+3.66% |
+3.55% |
no |
| GGUF Q4_K_M-imat |
986.0 |
8.497 |
13.757 |
274 (268-279) † |
+2.42% |
+2.09% |
yes |
| GGUF Q4_K_S (no imatrix) |
940.3 |
8.679 |
14.075 |
282 (270-287) |
+4.61% |
+4.45% |
no |
| GGUF IQ4_XS-imat |
895.7 |
8.577 |
13.879 |
274 (270-278) |
+3.38% |
+3.00% |
yes |
| GGUF Q5_K_M (no imatrix) |
1125.1 |
8.389 |
13.633 |
248 (242-251) |
+1.12% |
+1.17% |
yes |
QUF against each GGUF variant, Qwen2.5-1.5B (size: smaller wins; perplexity: difference under 0.1% is a tie, otherwise lower wins; speed: overlapping min-max ranges are a tie):
| vs |
Size |
WikiText-2 |
C4 |
Speed |
| GGUF Q4_K_M (no imatrix) |
QUF loses (+5.5%) |
QUF wins (-2.09%) |
QUF wins (-1.37%) |
tie (ranges overlap), median ratio 1.033 |
| GGUF Q4_K_M-imat |
QUF loses (+5.5%) |
QUF wins (-0.91%) |
tie (+0.04%) |
tie (ranges overlap), median ratio 1.033 † |
| GGUF Q4_K_S (no imatrix) |
QUF loses (+10.6%) |
QUF wins (-2.99%) |
QUF wins (-2.22%) |
tie (ranges overlap), median ratio 1.003 |
| GGUF IQ4_XS-imat |
QUF loses (+16.1%) |
QUF wins (-1.84%) |
QUF wins (-0.84%) |
tie (ranges overlap), median ratio 1.034 |
| GGUF Q5_K_M (no imatrix) |
QUF wins (-7.6%) |
QUF loses (+0.37%) |
QUF loses (+0.96%) |
QUF wins, median ratio 1.142 |
Beat_Target (size ≤ Q4_K_M, WikiText-2 ≤ Q4_K_M, decode tok/s ≥ Q4_K_M): not reached on 1.5B (size FAILS, WikiText-2 ok, speed ok).
Pareto front (size, WikiText-2, C4, lower is better on all): QUF 0.4.0 default, GGUF Q4_K_M-imat, GGUF IQ4_XS-imat, GGUF Q5_K_M (no imatrix). Dominated: GGUF Q4_K_M (no imatrix) (by GGUF IQ4_XS-imat), GGUF Q4_K_S (no imatrix) (by GGUF IQ4_XS-imat).
Where QUF wins and loses (Qwen2.5-0.5B). Size: smaller than every GGUF variant except IQ4_XS (349.4 MB, 5.3% smaller than QUF). WikiText-2: better than Q4_K_M, Q4_K_S and IQ4_XS, worse than Q4_K_M-imat (+0.23%) and Q5_K_M (+0.22%). C4: better than Q4_K_S and IQ4_XS, worse than Q4_K_M (+0.28%), Q4_K_M-imat (+0.99%) and Q5_K_M (+1.47%). Speed: faster than every variant (ranges do not overlap, median 1.31 to 1.34x). Beat_Target is reached on 0.5B, but only on the WikiText-2 definition: QUF's C4 perplexity is 0.28% worse than Q4_K_M's.
Where QUF wins and loses (Qwen2.5-1.5B). Size: larger than Q4_K_M, Q4_K_M-imat, Q4_K_S and IQ4_XS (5.5% to 16.1%), smaller than Q5_K_M. WikiText-2: better than every variant except Q5_K_M (+0.37%). C4: better than Q4_K_M, Q4_K_S, IQ4_XS, tie with Q4_K_M-imat (+0.04%), worse than Q5_K_M (+0.96%). Speed: tie with every variant except Q5_K_M, which QUF beats (1.14x). Beat_Target is not reached on 1.5B because the QUF file is 5.5% larger than Q4_K_M.
Qwen2.5-3B scaling check (one model, one run per row). QUF 0.4.0 defaults against GGUF Q4_K_M (no imatrix), llama protocol, full WikiText-2 test split and the C4 slice. This session ran on AC power, unlike the 0.5B and 1.5B speed session, so its speed numbers are not comparable with the tables above.
| Format |
Size MB |
WikiText-2 PPL |
C4 PPL |
Decode tok/s (median, min-max) |
| GGUF Q4_K_M (no imatrix) |
1929.9 |
7.465 (±0.047) |
12.311 |
236.0 (225.2-244.4), llama-bench tg128 |
| QUF 0.4.0 default |
1987.4 |
7.291 |
12.154 |
190.7 end-to-end (180.5-198.5); 229.1 steady-state |
Per axis against Q4_K_M: size QUF loses (+3.0%); WikiText-2 QUF wins (-2.3%); C4 QUF wins (-1.3%); speed QUF loses (the ranges do not overlap; the end-to-end median is 19% lower and the steady-state median 3% lower). Beat_Target is not reached on 3B: the QUF file is larger and decode is slower. Both rows drifted down over the session (probably thermal), so the absolute speeds are indicative only.
Other caveats. On 0.5B the only variant QUF beats on size, both perplexities and speed at once is Q4_K_S. On 1.5B no GGUF variant is beaten on all four axes: IQ4_XS and Q4_K_M are smaller and tie on speed. Every tie and win above rests on one speed session and one perplexity run per row (no seeds are involved, but the speed was measured on battery). The QUF file stores k_proj, v_proj and the last layer at int8 and the embedding at int8, and uses group size 32, which accounts for part of its size against Q4_K_M and IQ4_XS. The 0.5B and 1.5B speed numbers come from one battery-powered session and the 3B speed numbers from one AC session; none was repeated in another session.
- † Q4_K_M-imat speed was not measured; it is given Q4_K_M's speed because the tensor types are the same.
- tok/s is from one interleaved session on battery power with throttled clocks; a tie means the min-max ranges overlap. The perplexity tie band is 0.1%.
- Earlier 0.3.0 numbers are in git history and in the 0.3.0 sections of docs/RESULTS.md.
- lm-evaluation-harness (hellaswag and arc_easy, 0-shot, 500 examples each): the 0.4.0 default files are within one standard error of fp16 on every score (largest gap: 1.5B hellaswag acc, 0.470 against 0.486). The older 0.2.1
size_b files were within one standard error except 0.5B arc_easy acc (0.612 against 0.636, 1.1 standard errors). The 0.2.0 sensitive files were within one standard error everywhere. Table below.
| Model |
Variant |
hellaswag acc |
hellaswag acc_norm |
arc_easy acc |
arc_easy acc_norm |
| Qwen2.5-0.5B |
fp16 |
0.410 |
0.502 |
0.636 |
0.586 |
| Qwen2.5-0.5B |
QUF 0.4.0 default |
0.416 |
0.504 |
0.636 |
0.578 |
| Qwen2.5-0.5B |
QUF 0.2.1 size_b |
0.410 |
0.500 |
0.612 |
0.588 |
| Qwen2.5-0.5B |
QUF 0.2.0 sensitive |
0.424 |
0.496 |
0.620 |
0.564 |
| Qwen2.5-1.5B |
fp16 |
0.486 |
0.602 |
0.750 |
0.710 |
| Qwen2.5-1.5B |
QUF 0.4.0 default |
0.470 |
0.588 |
0.740 |
0.730 |
| Qwen2.5-1.5B |
QUF 0.2.1 size_b |
0.480 |
0.590 |
0.744 |
0.704 |
| Qwen2.5-1.5B |
QUF 0.2.0 sensitive |
0.484 |
0.608 |
0.748 |
0.724 |
(stderr is about 0.022 for hellaswag and 0.019 to 0.022 for arc_easy.)
- Not evaluated: int6 and int5 storage. A
torch.compile decode path was tried and skipped (see docs/BACKENDS.md).
Sources: docs/bench_accuracy.json, docs/size_study.json, docs/ACCURACY.md, docs/BACKENDS.md. More tables in Measured results.
Format version 3. The 0.4.0 defaults write QUF format version 3 files, because the embedding table is quantized. Readers of 0.3.0 and older reject them with an unsupported version error. Version 1 and 2 files still open, and --embed-precision fp16 writes a version 1 or 2 file again. See docs/FORMAT.md.
Quickstart
pip install quf
quf convert Qwen/Qwen2.5-0.5B out.quf
quf run out.quf --prompt "The capital of France is" --max-new-tokens 32 --temperature 0
quf bench out.quf --out results.json
quf convert needs the convert extra: pip install "quf[convert]".
Status: what is and is not verified