Paper

SparseDecoding: Decoding-Aware Pruning, and a Kernel Born for Decoding

TL;DR

Observing that LLM autoregressive decoding is memory-bound, this work collects the calibration for pruning not from “fixed text” but from “tokens the model generates itself,” and attaches a decoding-specific (SpMV) $N{:}M$ kernel to it, achieving up to $1.48\times$ end-to-end decoding speedup.

Key Idea

The blind spots of existing training-free pruning fall into two branches. One is the mismatch of data distribution. OBS-family pruning such as SparseGPT computes the Hessian from activations collected over fixed text like C4 and WikiText. In actual inference, however, the model feeds its own just-generated tokens back as input. The Hessian computed from fixed text and the Hessian computed from generated tokens diverge, and as a result the activation distribution of the pruned model drifts further and further from what it was at pruning time (source: §1, Fig. 1a).

The other is a gap at the system layer. Existing $2{:}4$ Sparse Tensor Core kernels (cuSPARSELt, etc.) are optimized for SpMM (matrix×matrix), delivering $1.31\sim1.46\times$ speedup in the prefill stage, but in SpMV (matrix×vector), which dominates decoding, they actually become slower than dense, at $0.85\sim0.87\times$ (source: §1, Fig. 1b).

SparseDecoding solves both problems at once along the algorithm axis (decoding-aware calibration) and the system axis (N:M SpMV kernel).

Background: The Problem They Solved

In long-output applications such as document writing and code generation, autoregressive decoding accounts for most of the LLM inference cost. Decoding processes hidden states one token at a time, so it is bound by memory bandwidth. Pruning is the most natural remedy: it zeros out low-importance weights, reducing the number of nonzero elements that must be read from memory during decoding (source: §1).

The problem is that, because of training cost and data constraints, training-free (one-shot) pruning is effectively the standard for LLMs. The OBS (Optimal Brain Surgeon) framework, the best-known member of this family, minimizes the per-layer reconstruction error via a second-order Taylor approximation, where the calibration activations determine “which weights to remove and how to correct the remaining weights” through the Hessian $H = 2X_\ell X_\ell^\top$ (source: §3.1). In other words, the calibration data is what governs pruning quality.

Yet existing methods feed fixed sequences via teacher forcing to collect activations. This suits static-input inference, but in autoregressive decoding, pruning errors in the early stages change the subsequent context, and the effect accumulates so that the activation distribution gradually drifts away. The authors measured that this divergence grows quickly enough that every layer reaches 90% of its peak within 12 decoding steps (source: §1, Fig. 1a).

The New Approach: SparseDecoding

Algorithm Axis: Decoding-Aware Calibration

The core idea is simple. Collect the activations used for pruning from the dense model’s own autoregressive generation process — but discard the prefill-stage activations and keep only the decoding-stage activations (source: §3.2).

Concretely, for a prompt set $\mathcal{C}=\{q_m\}_{m=1}^{K}$ from the target task, the dense model generates the continuation of each prompt by itself.

$$ y_t^{(m)} \sim P_\theta\big(\cdot \mid q_m,\, y_{After distinguishing the prefill positions $\mathcal{P}_m$ and the decoding positions $\mathcal{D}_m$ of prompt $q_m$, it records the input activation $x_{\ell,t}^{(m)}$ of each linear layer $\ell$ targeted for pruning, and gathers only those with $t\in\mathcal{D}_m$ to form the matrix.

$$ X_\ell^{\mathrm{AR}} = \big[\,x_{\ell,t}^{(m)}\,\big]_{m=1,\ldots,K;\; t\in\mathcal{D}_m} $$

Then the same per-layer reconstruction objective as before is defined over these activations.

$$ \widehat{W}_{\ell} = \operatorname_{argmin}_{\widetilde{W}_{\ell}} \left\lVert \left( W_{\ell} - \widetilde{W}_{\ell} \right) X_{\ell}^{\mathrm{AR}} \right\rVert_{F}^{2} \quad \text{s.t.} \quad \operatorname{sparsity}(\widetilde{W}_{\ell}) = S_{\ell} $$

The pruning solver itself is left untouched; only the calibration matrix changes. The authors confirmed that the same gains appear with either the SparseGPT or Wanda solver (source: §4.4, Tab. 5). No additional training and no new optimizer are required.

System Axis: N:M SpMV Kernel

For pruning to translate into real speed, the sparse pattern must be executed efficiently on hardware. Decoding processes a single vector at batch-one or small batch, so it is closer to GEMV/SpMV. Inspired by nmSPARSE, the authors designed a decoding-specific $N{:}M$ SpMV kernel (source: §3.3). Two design principles stand out.

  1. Bitmask indexing: By representing each row’s sparse pattern as a bitmask, instead of storing a separate 32-bit int32 index for every nonzero element, one bit maps to one column. At 50% sparsity, 2 bits of metadata per nonzero element suffices. That is 16× less than nmSPARSE’s int32 and 4× less than a uint8 offset, which is especially favorable for memory-bound batch-one decoding (source: §3.3).
  2. Fixed-step traversal: For 50% $N{:}M$ with $M\le32$, each aligned 32-bit mask has exactly 16 set bits. Every row then has the same number of traversal steps, evening out the workload across GPU threads and letting the compiler fully unroll the loop. Each step finds the column of the next nonzero via bit-scan and clears that bit.

How It Works: A Concrete Example

Intuition for Bitmask Traversal

Suppose one row of the weight matrix has 8 weights and $4{:}8$ sparsity is applied (2 kept per group of 4). Say the original weights are as follows.

PLAINTEXT
column index:   0    1    2    3    4    5    6    7
weight:       0.8  0.1  0.9  0.2  0.7  0.3  0.6  0.4

If after pruning 0.1, 0.2, 0.3, and 0.4 are removed and only 0.8, 0.9, 0.7, and 0.6 remain, the bitmask with “keep=1, remove=0” becomes as follows.

PLAINTEXT
bitmask:     1    0    1    0    1    0    1    0   → 10101010 (0xAA)
stored values: [0.8, 0.9, 0.7, 0.6]   (ascending column order)

During decoding, this row is multiplied with the input vector. With the traditional scheme, the column index would have to be read separately for each stored value, but in the bitmask scheme the position of a set bit is itself the column index. The kernel finds the lowest set bit via bit-scan in a fixed-length loop to learn the column, clears that bit, and moves on. The traversal of a row is fixed at the number of stored values (=16), so every thread carries the same workload.

Intuition for Calibration

Conventional C4 calibration feeds “ground-truth text” to collect activations. SparseDecoding instead gives the prompt (“Write the preface to a long fantasy novel”), lets the dense model actually write the novel, and then builds the Hessian from the decoding activations of that generation process. Pruning is then aligned with “the state the model actually encounters.” The reason for discarding prefill activations is that decoding is a special state of token-level self-conditioning (source: §3.2).

Performance Validation: Main Results

1) Decoding Speedup (Speed)

N:MLlama-3.1-8B (tok/s)Llama-3.3-70BQwen3-14BQwen3-32B
Dense96.2621.6739.7619.15
2:4136.30 (1.42×)30.17 (1.39×)53.18 (1.34×)27.69 (1.45×)
4:8136.43 (1.42×)31.64 (1.46×)53.86 (1.35×)27.83 (1.45×)
8:16136.89 (1.42×)29.90 (1.38×)53.42 (1.34×)27.77 (1.45×)
16:32136.89 (1.42×)32.13 (1.48×)53.73 (1.35×)27.81 (1.45×)

Since every pattern keeps 50% of the weights, the differences between patterns are differences in kernel efficiency, and all patterns are faster than dense. Context 512, A100 80GB, GPT-Fast (source: §4.3, Tab. 3). This is the exact opposite of the earlier finding that the existing $2{:}4$ Sparse Tensor Core was slower than dense at decoding (Fig. 1b).

2) Generation Quality (WritingBench, 1–10 points)

WritingBench is a long-form writing benchmark spanning 6 domains, 100 subdomains, and 1,000 prompts (source: §4.1). SparseDecoding beats C4 calibration across every model and every sparsity.

ModelDenseC4 (50%)Ours (50%)C4 (2:4)Ours (2:4)
Llama-3.1-8B3.702.252.541.341.52
Llama-3.3-70B4.653.824.013.103.29
Qwen3-14B5.974.625.351.854.18
Qwen3-32B6.485.346.092.995.31

The most dramatic point is $2{:}4$ sparsity in the Qwen family. C4 effectively collapses quality, at 1.85 for Qwen3-14B and 2.99 for Qwen3-32B, whereas SparseDecoding lifts them to 4.18 and 5.31, respectively (source: Tab. 1). In the Llama family the gains are relatively small (1.34→1.52, etc.), which ties into the limitations discussed below.

3) Code Generation Generalization (ClassEval)

The same procedure works for code generation as well (only the calibration prompts are swapped for LiveCodeBench problems). It leads by 4–15 points across all 8 model-sparsity combinations. Notably, at $2{:}4$ sparsity, while C4 gives Pass@1 = 0.0% on Llama-3.1-8B and Qwen3-14B, SparseDecoding recovers 4.0% and 6.0% (source: §4.2, Tab. 2). This is evidence that “how the calibration is collected” is as decisive as “which text the calibration is.”

4) Theoretical Justification

In the appendix, the authors define the calibration discrepancy $\epsilon_{\ell,C}^{(k)}$ and prove that it is exactly equal to “the worst-case relative error between the calibration objective and the reconstruction objective at decoding time” (source: Appx. A, Thm. 1). Empirically, the fraction of modules where AR calibration shows a smaller discrepancy than C4 reaches 87%–99%, with a median discrepancy ratio $\hat{\epsilon}_{\mathrm{C4}}/\hat{\epsilon}_{\mathrm{AR}}$ of 1.81–3.26. This is quantitative evidence that decoding-aware calibration is consistently closer to the decoding objective than fixed text is (source: Appx. A, Tab. 6–7).

5) Ablation: The Source of the Gain Is Not “What” but “Whom and How”

  • Self-generation vs cross-generation: Pruning a 14B model with a 32B model’s generated tokens underperforms self-generation (4.13 vs 4.18 at 2:4). Sequences produced by another model reintroduce the distribution gap (source: Tab. 4).
  • Solver-invariance: Even with Wanda, SparseDecoding leads consistently (Qwen3-14B at 2:4: C4 2.41 vs 3.30). The gain comes from the calibration activations, not the solver (source: Tab. 5).
  • Corpus-invariance: SparseDecoding also outperforms fixed corpora such as Pile and RedPajama (source: Tab. 9).

Our View: Strengths, Limitations, and Why This Research Matters

Strengths

The most praiseworthy aspect is that it aims precisely at the problem. It dismantles the long-taken-for-granted assumption that pruning presupposes “static input,” shifting to the perspective that “pruning must be aligned with the decoding state.” On top of that, its system design focuses on SpMV rather than SpMM to secure speed — a model example of not losing sight of the “measured wall-clock” that academic research often omits. The flow is clean: it shows with data that existing $2{:}4$ kernels became slower at decoding (Fig. 1b), then closes that gap with its own kernel.

Also, the low barrier to adoption — swap only the calibration matrix and it can sit on top of either the SparseGPT or Wanda solver — raises its practical value. The fact that it attaches theory (Thm. 1) to quantify “why it works” is also notable.

Limitations

There are several points worth fairly noting.

  1. Small gains on the Llama family. At $2{:}4$, Llama-3.1-8B goes 1.34→1.52 and Llama-3.3-70B 3.10→3.29, in contrast to the multi-point jumps of the Qwen family. This means calibration sensitivity varies greatly by model family and size, and there is a lack of condition analysis for “when it is effective” (source: Tab. 1).
  2. Calibration cost is quietly expensive. Since it must actually generate 1M tokens with the dense model, the upfront stage is heavier than streaming C4. No quantitative comparison of the gain against this cost is provided.
  3. Reliance on the evaluation judge. WritingBench is an LLM-as-judge benchmark using DeepSeek-V4-Flash as the judge, so the absolute scores (low values like 3.70) need to be interpreted with caution. Relative comparisons within the same judge and setting, however, remain valid.
  4. Sparsity is limited. Only $N{:}M$ 50% and unstructured 50% were covered. Whether this framework holds up under more aggressive sparsity (e.g., 75%+) is left open.
  5. Single GPU, A100 only. Even 70B was run on an A100, but it is unverified whether the SpMV kernel’s gain persists in a multi-GPU tensor-parallel environment (source: §4.1).

Why This Research Matters

Now that LLM inference cost has become the bottleneck in real-world use, this work strikes back at the perception that “pruning only makes things faster while ruining quality.” In particular, reframing the pruning quality problem not as a matter of “data selection” but as a matter of “how data is collected” is a general insight that can be reused for all “calibration-based compression” research — pruning, distillation, quantization, and beyond.

What’s Next?: The Road Ahead

The authors do not lay out a long list of explicit future plans, but in light of the limitations above, the natural next steps are visible.

  • Extending sparsity: Explore the quality-speed Pareto frontier beyond 50%, at 2/3 and 3/4 sparsity. The fixed-step property of bitmask traversal remains usable.
  • Condition analysis: Predict and verify “on which models and tasks decoding-aware calibration matters most” using the theoretical frame (the discrepancy of Thm. 1).
  • Multi-GPU scaling: Validate the SpMV kernel’s performance under tensor parallelism and pipeline parallelism, and check whether it can be integrated into production serving stacks (vLLM, etc.).
  • Combining with other compression techniques: Apply the “decoding-aware” principle to a broader pipeline, for example jointly with quantization or in interaction with speculative decoding.

This research, in which a single simple principle — collect calibration from “the state the model actually lives in” — lifts both quality and speed together, reminds us once again that in inference optimization the real goal is “measured wall-clock” rather than “theoretical FLOPs.”

Tables from the paper

Tables converted mechanically from the arXiv e-print LaTeX source. The numbers are the paper’s own and did not pass through a model.

Table 1. Results on the WritingBench benchmark under $50\%$ and $2{:}4$ sparsity. SparseDecoding (ours) calibrates on autoregressive generations conditioned on LongWriter prompts; C4 uses fixed C4 sequences. densegrayDense is the unpruned reference. Columns report the overall score, the six domain scores, and the three requirement scores for style (R1), format (R2), and length (R3); ``C’’ indicates the corresponding category-specific score. The six domains are Academic & Engineering (D1), Finance & Business (D2), Politics & Law (D3), Literature & Arts (D4), Education (D5), and Advertising & Marketing (D6). All scores are on a scale of 1-10. Bold marks the better overall score between SparseDecoding and C4 within each sparsity setting, based on unrounded values.

ModelSparsityMethodOverallDomains D1Domains D2Domains D3Domains D4Domains D5Domains D6Requirements R1Requirements CRequirements R2Requirements CRequirements R3Requirements C
Llama-3.1-8Bdensegray0%densegrayDensedensegray3.70densegray3.7densegray3.6densegray3.5densegray3.3densegray4.1densegray4.3densegray3.8densegray3.9densegray3.7densegray4.3densegray3.8densegray3.6
2-16$50\%$C42.252.42.22.11.92.42.62.22.22.22.52.22.1
SparseDecoding2.542.72.52.52.02.73.02.52.52.52.92.52.4
2-16$2{:}4$C41.341.51.31.31.11.41.61.31.31.31.41.31.2
SparseDecoding1.521.71.61.51.31.51.61.51.51.51.51.41.4
Llama-3.3-70Bdensegray0%densegrayDensedensegray4.65densegray4.6densegray4.5densegray4.5densegray4.5densegray5.1densegray5.2densegray4.7densegray4.9densegray4.6densegray5.2densegray4.8densegray4.5
2-16$50\%$C43.823.73.83.73.54.14.33.84.03.84.33.83.7
SparseDecoding4.014.03.93.83.84.44.54.04.24.04.54.13.8
2-16$2{:}4$C43.103.13.23.02.63.33.53.13.03.13.63.02.8
SparseDecoding3.293.23.33.03.13.73.83.33.43.23.63.32.9
Qwen3-14Bdensegray0%densegrayDensedensegray5.97densegray6.0densegray5.8densegray6.1densegray5.7densegray6.3densegray6.1densegray6.1densegray6.4densegray6.0densegray6.8densegray6.0densegray6.3
2-16$50\%$C44.624.64.44.64.05.45.24.85.04.65.24.54.6
SparseDecoding5.355.35.35.44.95.95.65.55.85.46.25.45.6
2-16$2{:}4$C41.852.01.81.71.62.02.31.91.91.81.71.91.7
SparseDecoding4.184.24.34.33.34.84.64.24.44.24.94.14.2
Qwen3-32Bdensegray0%densegrayDensedensegray6.48densegray6.5densegray6.4densegray6.5densegray6.3densegray6.7densegray6.6densegray6.6densegray6.8densegray6.5densegray7.2densegray6.6densegray6.8
2-16$50\%$C45.345.25.25.44.95.95.85.55.75.36.05.35.4
SparseDecoding6.096.06.06.15.86.56.36.26.56.16.86.16.4
2-16$2{:}4$C42.993.02.92.92.33.53.93.03.13.03.32.92.8
SparseDecoding5.315.25.35.44.75.85.75.45.65.36.05.35.5

Table 2. End-to-end decoding throughput and speedup over the dense baseline. All of the $N{:}M$ patterns retain $50\%$ of the weights, so differences reflect kernel efficiency rather than compression. Every evaluated pattern decodes faster than the dense baseline, with speedups ranging from \(1.34\) to \(1.48\times\). Measurements use a context length of 512 and report the median after 50 warmup and 50 measured iterations on NVIDIA A100 GPUs with GPT-Fast.

$N{:}M$Llama-3.1-8B Token/sLlama-3.1-8B SpeedupLlama-3.3-70B Token/sLlama-3.3-70B SpeedupQwen3-14B Token/sQwen3-14B SpeedupQwen3-32B Token/sQwen3-32B Speedup
densegrayDensedensegray96.26densegray1.00$\times$densegray21.67densegray1.00$\times$densegray39.76densegray1.00$\times$densegray19.15densegray1.00$\times$
1-9 $2{:}4$136.301.42$\times$30.171.39$\times$53.181.34$\times$27.691.45$\times$
$4{:}8$136.431.42$\times$31.641.46$\times$53.861.35$\times$27.831.45$\times$
$8{:}16$136.891.42$\times$29.901.38$\times$53.421.34$\times$27.771.45$\times$
$16{:}32$136.891.42$\times$32.131.48$\times$53.731.35$\times$27.811.45$\times$

Table 3. Empirical comparison of AR and C4 calibration discrepancy on Qwen3 14B. For each retained eigenvector fraction, we report the number and percentage of prunable modules (out of 280) where \(\epsilon_\ell,AR^(k) < \epsilon_\ell,C4^(k)\), together with the median of the discrepancy ratio \(\epsilon_C4/\epsilon_AR\).

Retained eigenvectorsModules with \(\epsilon_AR < \epsilon_C4\)PercentageMedian ratio \(\epsilon_C4/\epsilon_AR\)
1%27497.9%2.30
2%27196.8%2.39
5%26695.0%2.65
10%26494.3%2.83
20%26193.2%3.06
50%24888.6%3.26

Table 4. Empirical comparison of AR and C4 calibration discrepancy on Qwen3 32B. For each retained eigenvector fraction, we report the number and percentage of prunable modules (out of 448) where \(\epsilon_\ell,AR^(k) < \epsilon_\ell,C4^(k)\), together with the median of the discrepancy ratio \(\epsilon_C4/\epsilon_AR\).

Retained eigenvectorsModules with \(\epsilon_AR < \epsilon_C4\)PercentageMedian ratio \(\epsilon_C4/\epsilon_AR\)
1%39087.1%1.81
2%41993.5%1.92
5%44098.2%2.08
10%43998.0%2.16
20%44499.1%2.17
50%44298.7%2.19

Table 5. Results on WritingBench for Qwen3-14B and Qwen3-32B under unstructured $50\%$ and semi-structured $8{:}16$ sparsity. SparseDecoding (ours) calibrates on autoregressive generations conditioned on LongWriter prompts; C4 uses fixed C4 sequences. densegrayDense is the unpruned reference. ``C’’ indicates the corresponding category-specific score. Bold marks the best overall score within each sparsity setting.

ModelSparsityMethodOverallDomains D1Domains D2Domains D3Domains D4Domains D5Domains D6Requirements R1Requirements CRequirements R2Requirements CRequirements R3Requirements C
Qwen3-14Bdensegray$0\%$densegrayDensedensegray5.97densegray6.0densegray5.8densegray6.1densegray5.7densegray6.3densegray6.1densegray6.1densegray6.4densegray6.0densegray6.8densegray6.0densegray6.3
2-16$50\%$C44.624.64.44.64.05.45.24.85.04.65.24.54.6
SparseDecoding5.355.35.35.44.95.95.65.55.85.46.25.45.6
2-16$8{:}16$C44.504.54.44.53.85.05.24.64.84.55.04.34.2
SparseDecoding5.315.25.35.34.75.95.75.45.65.46.15.25.4
Qwen3-32Bdensegray0%densegrayDensedensegray6.48densegray6.5densegray6.4densegray6.5densegray6.3densegray6.7densegray6.6densegray6.6densegray6.8densegray6.5densegray7.2densegray6.6densegray6.8
2-16$50\%$C45.345.25.25.44.95.95.85.55.75.36.05.35.4
SparseDecoding6.096.06.06.15.86.56.36.26.56.16.86.16.4
2-16$8{:}16$C45.205.25.15.34.55.65.75.35.55.25.85.15.2
SparseDecoding5.915.85.95.95.56.36.36.06.35.96.76.06.1

Table 6. Results on WritingBench benchmark under $50\%$ and $2{:}4$ sparsity with different calibration data for the Qwen3 model family. Pile and RedPajama use fixed pretraining-corpus sequences; SparseDecoding calibrates on autoregressive generations conditioned on LongWriter prompts.

ModelSparsityCalibrationOverallDomains D1Domains D2Domains D3Domains D4Domains D5Domains D6Requirements R1Requirements CRequirements R2Requirements CRequirements R3Requirements C
Qwen3-14Bdensegray$0\%$densegrayDensedensegray5.97densegray6.0densegray5.8densegray6.1densegray5.7densegray6.3densegray6.1densegray6.1densegray6.4densegray6.0densegray6.8densegray6.0densegray6.3
2-16$50\%$Pile5.005.25.15.14.05.75.35.05.25.05.64.85.0
RedPajama5.045.05.05.14.45.65.65.25.45.15.74.95.0
SparseDecoding5.355.35.35.44.95.95.65.55.85.46.25.45.6
2-16$2{:}4$Pile2.683.02.72.61.93.03.12.72.72.72.92.42.2
RedPajama2.622.82.62.52.12.73.32.72.72.62.72.42.2
SparseDecoding4.184.24.34.33.34.84.64.24.44.24.94.14.2
Qwen3-32Bdensegray0%densegrayDensedensegray6.48densegray6.5densegray6.4densegray6.5densegray6.3densegray6.7densegray6.6densegray6.6densegray6.8densegray6.5densegray7.2densegray6.6densegray6.8
2-16$50\%$Pile5.805.85.85.85.36.26.25.96.15.86.55.86.0
RedPajama5.725.75.75.85.36.16.15.86.15.76.45.75.7
SparseDecoding6.096.06.06.15.86.56.36.26.56.16.86.16.4
2-16$2{:}4$Pile3.323.63.33.32.63.63.93.43.43.33.63.23.2
RedPajama3.743.83.73.73.04.24.53.83.93.84.33.73.5
SparseDecoding5.315.25.35.44.75.85.75.45.65.36.05.35.5

License

Author: Jaehun Ryu

Link: https://jaehun.me/en/posts/paper-2610-12327v1/

License: CC BY 4.0

This work is licensed under the Creative Commons Attribution 4.0 International License. You are free to use it for any purpose, including commercial use, as long as you provide proper attribution.

Comments