Datasets:
layer_component stringclasses 7
values | quantization_scheme stringclasses 4
values | layers_quantized int64 24 24 | weight_sqnr_db float64 3.8 41 | linear_layer_compression float64 0.94 8 | perplexity float64 4.77 124k | perplexity_delta_pct float64 -0.15 2.59M |
|---|---|---|---|---|---|---|
Attention Query (q_proj) | INT8 per-channel | 24 | 40.2 | 1.99 | 4.77 | -0.15 |
Attention Query (q_proj) | INT4 G=128 | 24 | 17.4 | 3.75 | 4.816 | 0.81 |
Attention Query (q_proj) | 2:4 structured sparsity | 24 | 9.2 | 0.94 | 5.235 | 9.59 |
Attention Query (q_proj) | Ternary (post-hoc) | 24 | 3.8 | 7.94 | 18.009 | 276.99 |
Attention Key (k_proj) | INT8 per-channel | 24 | 40.7 | 1.99 | 4.774 | -0.07 |
Attention Key (k_proj) | INT4 G=128 | 24 | 17.6 | 3.75 | 4.83 | 1.12 |
Attention Key (k_proj) | 2:4 structured sparsity | 24 | 9.1 | 0.94 | 5.259 | 10.1 |
Attention Key (k_proj) | Ternary (post-hoc) | 24 | 3.9 | 7.94 | 23.522 | 392.41 |
Attention Value (v_proj) | INT8 per-channel | 24 | 39.4 | 1.99 | 4.774 | -0.06 |
Attention Value (v_proj) | INT4 G=128 | 24 | 16.6 | 3.75 | 4.923 | 3.06 |
Attention Value (v_proj) | 2:4 structured sparsity | 24 | 9.8 | 0.94 | 6.711 | 40.49 |
Attention Value (v_proj) | Ternary (post-hoc) | 24 | 4.7 | 7.94 | 1,922.912 | 40,154.18 |
Attention Output (o_proj) | INT8 per-channel | 24 | 40 | 1.99 | 4.777 | 0 |
Attention Output (o_proj) | INT4 G=128 | 24 | 17.9 | 3.76 | 4.871 | 1.96 |
Attention Output (o_proj) | 2:4 structured sparsity | 24 | 8.9 | 0.94 | 7.857 | 64.47 |
Attention Output (o_proj) | Ternary (post-hoc) | 24 | 4.5 | 8 | 8,879.985 | 185,793.31 |
MLP Gate (gate_proj) | INT8 per-channel | 24 | 41 | 1.99 | 4.779 | 0.05 |
MLP Gate (gate_proj) | INT4 G=128 | 24 | 17.9 | 3.76 | 4.867 | 1.88 |
MLP Gate (gate_proj) | 2:4 structured sparsity | 24 | 9 | 0.94 | 6.268 | 31.22 |
MLP Gate (gate_proj) | Ternary (post-hoc) | 24 | 5.1 | 8 | 1,731.011 | 36,136.94 |
MLP Up (up_proj) | INT8 per-channel | 24 | 41 | 1.99 | 4.774 | -0.07 |
MLP Up (up_proj) | INT4 G=128 | 24 | 17.9 | 3.76 | 5.063 | 5.99 |
MLP Up (up_proj) | 2:4 structured sparsity | 24 | 9.1 | 0.94 | 7.547 | 57.99 |
MLP Up (up_proj) | Ternary (post-hoc) | 24 | 5.4 | 8 | 123,931.849 | 2,594,285.27 |
MLP Down (down_proj) | INT8 per-channel | 24 | 38.1 | 2 | 4.783 | 0.14 |
MLP Down (down_proj) | INT4 G=128 | 24 | 17.6 | 3.76 | 5.171 | 8.25 |
MLP Down (down_proj) | 2:4 structured sparsity | 24 | 9.1 | 0.94 | 8.705 | 82.22 |
MLP Down (down_proj) | Ternary (post-hoc) | 24 | 5.1 | 8 | 80,369.897 | 1,682,360.8 |
QuantBench: measured quantization quality vs compression
Every number in this dataset was measured on a real model in a single run by
scripts/measure_real_pareto.py.
Nothing is estimated or typed in. Re-run the script to reproduce it on your own GPU.
| Model | Qwen/Qwen2.5-0.5B-Instruct (bfloat16) |
| Hardware | NVIDIA GeForce RTX 3050 6GB Laptop GPU |
| Software | torch 2.6.0+cu124, transformers 5.24.1, quantbench 0.1.2 |
| Measured | 2026-11-26T06:19:28+00:00 |
| Perplexity text | Python standard-library source of argparse, statistics and textwrap (2 windows of 1024 tokens) |
| Decode speed | 64 greedy tokens, median of 3 interleaved repeats |
Pareto frontier
| Config | Weight SQNR (dB) | Linear-layer compression | Model VRAM (MB) | Whole-model compression | Perplexity | Perplexity change (%) | Decode speed vs BF16 |
|---|---|---|---|---|---|---|---|
| BF16 baseline | 1.0 | 950 | 1.0 | 4.777 | 0.0 | 1.0 | |
| INT8 per-channel | 40.0 | 1.99 | 611 | 1.56 | 4.794 | 0.36 | 0.68 |
| INT4 G=32 | 19.8 | 3.2 | 483 | 1.97 | 5.656 | 18.4 | 0.23 |
| INT4 G=64 | 18.7 | 3.55 | 464 | 2.05 | 5.905 | 23.61 | 0.23 |
| INT4 G=128 | 17.8 | 3.76 | 451 | 2.11 | 6.215 | 30.09 | 0.23 |
| 2:4 structured sparsity | 9.1 | 0.94 | 1001 | 0.95 | 3391.622 | 70900.11 | 0.34 |
| Ternary (post-hoc) | 5.0 | 8.0 | 364 | 2.61 | 2456215.501 | 51418234.99 | 0.24 |
Layer sensitivity
One projection type is quantized at a time; everything else stays in bfloat16. With INT4 G=128, quantizing MLP Down (down_proj) hurt perplexity most (+8.25%) and Attention Query (q_proj) least (+0.81%).
| Layer | Scheme | Layers | Weight SQNR (dB) | Perplexity change (%) |
|---|---|---|---|---|
| Attention Query (q_proj) | INT8 per-channel | 24 | 40.2 | -0.15 |
| Attention Query (q_proj) | INT4 G=128 | 24 | 17.4 | 0.81 |
| Attention Query (q_proj) | 2:4 structured sparsity | 24 | 9.2 | 9.59 |
| Attention Query (q_proj) | Ternary (post-hoc) | 24 | 3.8 | 276.99 |
| Attention Key (k_proj) | INT8 per-channel | 24 | 40.7 | -0.07 |
| Attention Key (k_proj) | INT4 G=128 | 24 | 17.6 | 1.12 |
| Attention Key (k_proj) | 2:4 structured sparsity | 24 | 9.1 | 10.1 |
| Attention Key (k_proj) | Ternary (post-hoc) | 24 | 3.9 | 392.41 |
| Attention Value (v_proj) | INT8 per-channel | 24 | 39.4 | -0.06 |
| Attention Value (v_proj) | INT4 G=128 | 24 | 16.6 | 3.06 |
| Attention Value (v_proj) | 2:4 structured sparsity | 24 | 9.8 | 40.49 |
| Attention Value (v_proj) | Ternary (post-hoc) | 24 | 4.7 | 40154.18 |
| Attention Output (o_proj) | INT8 per-channel | 24 | 40.0 | 0.0 |
| Attention Output (o_proj) | INT4 G=128 | 24 | 17.9 | 1.96 |
| Attention Output (o_proj) | 2:4 structured sparsity | 24 | 8.9 | 64.47 |
| Attention Output (o_proj) | Ternary (post-hoc) | 24 | 4.5 | 185793.31 |
| MLP Gate (gate_proj) | INT8 per-channel | 24 | 41.0 | 0.05 |
| MLP Gate (gate_proj) | INT4 G=128 | 24 | 17.9 | 1.88 |
| MLP Gate (gate_proj) | 2:4 structured sparsity | 24 | 9.0 | 31.22 |
| MLP Gate (gate_proj) | Ternary (post-hoc) | 24 | 5.1 | 36136.94 |
| MLP Up (up_proj) | INT8 per-channel | 24 | 41.0 | -0.07 |
| MLP Up (up_proj) | INT4 G=128 | 24 | 17.9 | 5.99 |
| MLP Up (up_proj) | 2:4 structured sparsity | 24 | 9.1 | 57.99 |
| MLP Up (up_proj) | Ternary (post-hoc) | 24 | 5.4 | 2594285.27 |
| MLP Down (down_proj) | INT8 per-channel | 24 | 38.1 | 0.14 |
| MLP Down (down_proj) | INT4 G=128 | 24 | 17.6 | 8.25 |
| MLP Down (down_proj) | 2:4 structured sparsity | 24 | 9.1 | 82.22 |
| MLP Down (down_proj) | Ternary (post-hoc) | 24 | 5.1 | 1682360.8 |
How to read this honestly
- One model, one GPU, one run. Results describe
Qwen/Qwen2.5-0.5B-Instructon this hardware; other models differ. - Perplexity is measured on Python source code, chosen because it is license-free and ships with Python. Use it to compare configs with each other, not as a general language-modeling score.
- Decode speed reflects quantbench's reference runtime, which dequantizes full weights on every forward pass. Quantization saves memory here but does not speed decoding up; that needs fused dequant-matmul kernels.
- Whole-model compression includes the embedding and
lm_head, which are not quantized, so it is lower than the linear-layer compression. - 2:4 sparsity does not save memory here. quantbench stores the kept values in the source dtype plus a mask, so the model gets slightly larger. Savings need a sparse storage format and sparse kernels.
- Ternary is post-hoc quantization of a model not trained for it, unlike BitNet models trained ternary from the start.
Files
pareto_frontier.json/.csv: one row per configlayer_sensitivity.json/.csv: one row per (layer type, scheme)run_metadata.json: model, hardware, software versions, and evaluation settings
- Downloads last month
- 162