Is 2:4 Sparsity Still Worth It? Semi-Structured Sparsity versus Quantization in LLM Inference
Organizations: Independent Researcher, San Jose, CA, USA.
Abstract
NVIDIA tensor cores have supported 2:4 semi-structured sparsity since Ampere, and the pattern composes with quantization. When the two are combined, the practical question is which step to take next: from a given precision, add 2:4 sparsity or drop to the next lower precision? We compare the two at equal bits, with sparsity metadata counted, and at equal nominal tensor-core tiers, over all six GEMM operands of a transformer layer, with kernels measured on three GPU generations and online pruning and quantization included. Our results show that as long as a lower precision is available, adding 2:4 is the worse step, both less accurate and slower, because the energy that 2:4 discards from each group of four along the hardware-forced axis does not shrink with bits, while quantization error does. Once quantization reaches the lowest precision the hardware supports, 2:4 still speeds up linear layers by 1.3--1.7\x{}, and on an H100 a retrained 2:4 model served in FP8 by vLLM reaches 27% higher prefill throughput than the dense FP8 model, with GSM8K accuracy on par. Its quality has to be won back by retraining, however, which restores perplexity long before reasoning; on Blackwell, whose sparse FP4 uses a pairwise 4:8 pattern, the loss is larger and our retraining budget did not recover it.
Figures & tables
| Tensor | GEMM | Forced axis | Static | |
|---|---|---|---|---|
| W | linear weights | input features | yes | |
| X | linear inputs | hidden | no | |
| Q | queries | head dim | no | |
| K | keys | head dim | no | |
| V | values | tokens | no | |
| P | attention probs. | keys | no |
| 2 : vs FP8 | 4 : vs NVFP4 | floor: 2:4 added | ||||
|---|---|---|---|---|---|---|
| GPU | W | X | W | X | FP8 | NVFP4 |
| L40S | 0.89 | 0.89 | – | – | 1.65 | – |
| H100 | 0.74 | 0.80 | – | – | 1.42 | – |
| RTX PRO 6000 | 0.84 | 0.85 | 0.66 | 0.70 | 1.33 | 1.40 |
| Bits | 2:4 side | error | dense rival | error |
|---|---|---|---|---|
| 9 / 8.1 | 2:4 + FP16 | 36.4% | INT8 | 0.6% |
| 5.1 | 2:4 + INT8 | 36.4% | INT5 | 5.5% |
| 4.1 | 2:4 + INT6 | 36.4% | INT4 | 11.7% |
| 3.1 | 2:4 + INT4 | 37.3% | INT3 | 27.4% |
| Floor | Dense | + one-shot 2:4 | + retrained 2:4 (13B tok.) | + retrained, ours (1B tok.) |
|---|---|---|---|---|
| BF16 | 6.31 / 0.600 | – | 8.13 / 0.612 | 8.19 / 0.300 (2:4), 9.41 / 0.160 (4:8p) |
| INT4 weights (W4A16) | 6.90 / 0.540 | 18.61 / 0.032 | 8.45 / 0.580 | 8.53 / 0.292 |
| FP8 (W8A8) | 6.36 / 0.552 | 17.82 / 0.028 | 8.19 / 0.632 | 8.25 / 0.308 |
| NVFP4 (W4A4), pairwise 4:8 | 6.98 / 0.460 | 108.83 / 0.020 | – | 10.22 / 0.132 |
| NVFP4, element-wise 2:4 † | 6.98 / 0.460 | 21.74 / 0.020 | 8.72 / 0.516 | 8.82 / 0.192 |
| weights | prefill | decode (tok/s) | |||
|---|---|---|---|---|---|
| serving | (GiB) | (k tok/s) | GSM8K | ||
| dense BF16 | 15.0 | 41.4 | 136 | 6,424 | 0.596 |
| 2:4 BF16 | 9.3 | 40.7 | 115 | 6,477 | 0.624 |
| dense FP8 | 8.5 | 58.9 | 198 | 8,556 | 0.568 |
| 2:4 FP8 | 6.1 | 74.6 | 234 | 9,914 | 0.612 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Configuration | Formula | Bits |
|---|---|---|
| Dense INT , symmetric | 8.125 / 5.125 / 4.125 / 3.125 | |
| Dense INT , asymmetric | INT4: 4.25 | |
| FP8, per-row or per-channel scale | 8.0 | |
| MXFP4 (E8M0 scale per 32) | 4.25 | |
| NVFP4 (E4M3 per 16, FP32 per tensor) | 4.5 | |
| 2:4 + FP16 | 9.0 |
| Model | Family | 9 / 8.1 b | 5.1 b | 4.1 b | 3.1 b |
|---|---|---|---|---|---|
| Llama | W | 13.27 (FP8-row) | 3.69 (NVFP4-g16) | 2.90 (INT4-g128) | 1.27 (INT3-g128) |
| Llama | K | 10.28 (FP8-row) | 2.96 (NVFP4-g16) | 1.58 (MXFP4-g32) | 1.05 (INT3-g128) |
| Llama | V | 21.71 (FP8-row) | 5.54 (NVFP4-g16) | 3.25 (INT4-g128) | 1.55 (INT3-g128-asym) |
| Qwen3 | W | 13.00 (FP8-row) | 3.61 (NVFP4-g16) | 2.77 (INT4-g128) | 1.22 (INT3-g128) |
| Qwen3 | K | 10.43 (FP8-row) | 2.62 (NVFP4-g16) | 1.41 (MXFP4-g32) | 1.27 (INT3-g128) |
| Qwen3 | V | 19.36 (FP8-row) | 5.13 (NVFP4-g16) | 3.10 (INT4-g128) | 1.49 (INT3-g128) |
| Model | Family | 2 vs FP8 | 2 vs INT8 | 4 vs NVFP4 | 4 vs MXFP4 |
|---|---|---|---|---|---|
| Llama | W | 7.50 | 7.70 | 2.13 | 1.48 |
| Llama | X | 7.70 | 9.25 | 2.21 | 1.48 |
| Llama | Q | 5.17 | 19.05 | 1.72 | 0.85 |
| Llama | K | 5.33 | 20.33 | 1.88 | 0.91 |
| Llama | V | 15.83 | 2.31 | 3.18 | 2.07 |
| Llama | P | 6.12 | 0.78 | 1.28 | 0.78 |
| 2:4 | accuracy | balanced | recall of | AUC | Spearman | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Points | wins | always quant. | criterion | accuracy | 2:4 wins | criterion | kurtosis | criterion | kurtosis | |
| W, X, Q, K, V | 3400 | 3.2% | 96.8% | 96.8% | 0.56 | 12% | 0.945 | 0.776 | 0.93 | 0.10 |
| P | 272 | 47.4% | 52.6% | 66.2% | 0.66 | 71% | 0.773 | 0.627 | 0.54 | 0.29 |
| W–V, within 25% of parity | 152 | 41.4% | 58.6% | 56.6% | 0.49 | 5% | – | – | – | – |
| Family | Cell | (operator) | PPL, 2:4 side | PPL, quantized side | Agree |
|---|---|---|---|---|---|
| K | storage 3.1 b, vs INT3-g128 | 0.969 | 7.86 | 8.03 | yes |
| K | storage 9/8.1 b, vs INT8-g128 | 40.6 | 7.82 | 7.23 | yes |
| P | compute 4 , 2:4-FP8 vs MXFP4 | 0.848 | 7.29 | 7.52 | yes |
| P | compute 2 , 2:4-FP16 vs FP8 | 6.18 | 7.29 | 7.23 | yes |
| Q | compute 4 , 2:4-FP8 vs MXFP4 | 0.777 | 10.80 | 9.34 | no |
| Q | compute 2 , 2:4-FP16 vs INT8 | 17.4 | 10.65 | 7.23 | yes |
| same precision | equal tier | |||||||
|---|---|---|---|---|---|---|---|---|
| GPU | operand | BF16 | FP8 | INT8 | 2 /FP8 | 2 /INT8 | 4 /NVFP4 | 8 /NVFP4 |
| L40S | W, kernel | 1.63 [1.49, 1.98] | 1.65 [1.52, 1.90] | 1.27 [1.14, 1.41] | 0.89 [0.78, 0.92] | 0.72 [0.62, 0.77] | – | – |
| L40S | X, + prep. | 1.43 [1.25, 1.95] | 1.59 [1.50, 1.75] | 1.24 [1.12, 1.35] | 0.89 [0.70, 0.92] | 0.70 [0.56, 0.78] | – | – |
| H100 | W, kernel | 1.44 [1.37, 1.57] | 1.42 [1.34, 1.57] | 2.39 [2.16, 2.62] | 0.74 [0.62, 0.78] | 1.29 [1.02, 1.39] | – | – |
| H100 | X, + prep. | 1.32 [1.18, 1.44] | 1.31 [1.24, 1.47] | 2.03 [1.84, 2.30] | 0.80 [0.68, 0.89] | 1.28 [1.18, 1.37] | – | – |
| RTX PRO 6000 | W, kernel | 1.43 [1.32, 1.75] | 1.33 [1.23, 1.50] | 1.34 [1.17, 1.42] | 0.84 [0.73, 0.92] | 0.76 [0.70, 0.85] | 0.66 [0.61, 0.70] | 1.40 [1.36, 1.46] |
| GPU | 2:4-FP16 side | 2:4-FP8 side | dense FP8 side | dense NVFP4 side |
|---|---|---|---|---|
| L40S | 0.04 [0.01, 0.17] | 0.11 [0.03, 0.23] | 0.06 [0.02, 0.16] | – |
| H100 | 0.10 [0.04, 0.14] | 0.24 [0.09, 0.34] | 0.16 [0.05, 0.26] | – |
| RTX PRO 6000 | 0.04 [0.01, 0.13] | 0.09 [0.03, 0.18] | 0.06 [0.02, 0.17] | 0.15 [0.06, 0.23] |
| GPU | operand | fused 2:4 | fused 2:4+FP8 | FP8 | NVFP4 | cuSPARSELt | PyTorch tile | HieraSparse |
|---|---|---|---|---|---|---|---|---|
| L40S | P | 6753 (0.74) | 3806 (1.10) | 4714 (1.01) | 4714 (0.86) | 26948 | 9777 | 5189 |
| L40S | V | 10 (1.00) | 12 (0.70) | 10 (0.91) | 15 (0.55) | 35 | 11 | 8 |
| L40S | X | 48 (1.61) | 51 (1.28) | 48 (1.56) | 49 (1.29) | 396 | 56 | 54 |
| L40S | X | 1269 (0.86) | 823 (1.11) | 978 (1.07) | 907 (0.98) | 5950 | 1961 | 1100 |
| H100 | P | 1530 (0.84) | 1728 (0.63) | 1742 (0.71) | 2263 (0.47) | 47354 | 4796 | – |
| H100 | V | 6 (0.45) | 10 (0.22) | 7 (0.33) | 14 (0.15) | 275 | 13 | – |
| GPU | family | same prec. FP16 | same prec. FP8 | 2 vs FP8 | 4 vs NVFP4 | prep. share |
|---|---|---|---|---|---|---|
| L40S | Q | 0.83 0.82 / 0.83 0.82 | 0.96 0.96 / 0.99 0.99 | 0.84 0.84 / 0.92 0.92 | – / – | 0.01 / 0.00 |
| L40S | K | 0.84 0.84 / 1.01 1.01 | 1.04 1.04 / 0.95 0.95 | 1.03 1.03 / 0.88 0.88 | – / – | 0.01 / 0.00 |
| L40S | P | 3.90 0.51 / 1.77 0.38 | 1.55 1.25 / 1.63 1.31 | 0.72 0.79 / 0.92 0.74 | – / – | 0.87 / 0.78 |
| L40S | V | 1.02 1.01 / 1.03 1.03 | 2.94 2.73 / 1.01 1.01 | 0.41 0.42 / 0.58 0.59 | – / – | 0.01 / 0.00 |
| H100 | Q | 0.84 0.80 / 0.88 0.87 | 0.96 0.95 / 0.98 0.98 | 0.84 0.87 / 0.82 0.82 | – / – | 0.05 / 0.01 |
| H100 | K | 0.84 0.82 / 0.86 0.86 | 1.10 1.09 / 1.14 1.14 | 0.98 0.98 / 0.95 0.95 | – / – | 0.03 / 0.00 |
| GPU | operand | BF16 | FP8 | 2 /FP8 | 4 /NVFP4 | 8 /NVFP4 |
|---|---|---|---|---|---|---|
| L40S | W, kernel | 1.72 [1.58, 1.79] | 1.46 [1.33, 1.70] | 0.90 [0.86, 1.04] | – | – |
| L40S | X, + prep. | 0.98 [0.90, 1.02] | 1.03 [1.02, 1.04] | 0.62 [0.61, 0.63] | – | – |
| H100 | W, kernel | 0.77 [0.63, 1.11] | 1.15 [0.95, 1.30] | 0.76 [0.67, 0.84] | – | – |
| H100 | X, + prep. | 0.72 [0.55, 0.92] | 0.93 [0.91, 0.95] | 0.80 [0.65, 0.84] | – | – |
| RTX PRO 6000 | W, kernel | 1.63 [1.20, 2.61] | 1.28 [0.98, 1.55] | 0.85 [0.71, 0.98] | 1.35 [0.99, 1.59] | 1.65 [1.21, 2.65] |
| RTX PRO 6000 | X, + prep. | 1.02 [0.97, 1.56] | 0.95 [0.83, 1.22] | 0.67 [0.58, 0.92] | 0.92 [0.71, 1.05] | – |
| Mask on the weights | activation scale per 16 | per 32 |
|---|---|---|
| element-wise 2:4 | 21.74 | 22.39 |
| pairwise 4:8 | 105.23 | 108.83 (hardware) |
| dense NVFP4 floor | 6.98 | – |
| Start | One-shot SparseGPT on Llama-3.1-8B, all linear weights; pairwise 4:8 and element-wise 2:4 |
|---|---|
| Objective | Fixed-mask SquareHead distillation: KL divergence to the dense teacher on the next token plus the mean over layers of ; pruned positions reset to zero after every step |
| Data | FineWeb-Edu sample-10BT, packed into 2048-token sequences with BOS per document; both students see the same sequences in the same order |
| Budget | 7,629 steps (999,948,288 tokens); checkpoints at steps 1,908, 3,815 and 7,629 |
| Optimizer | AdamW ( = 0.9, 0.95; no weight decay), peak learning rate , 100 warm-up steps, cosine decay to 10%, gradient clipping 1.0; batch tokens; FSDP2 with FP32 master weights and BF16 compute |
| Hardware | 4 H100 per student, about 16 hours |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,084 papers