Skip to content

Pruning LLMs: SparseGPT, Wanda, 2:4 sparsity and Minitron-style structured pruning

Skip →Over-training scaling laws
LLM stage 2 #13corefundamentalpaperrubric 11/122023 · ICLR 2024 · ~55 min

Mingjie Sun, Zhuang Liu, Anna Bair, J. Zico Kolter

Read first: Distilling the Knowledge in a Neural Network · QLoRA: Efficient Finetuning of Quantized LLMs

Status

TL;DR. Pruning sets weights of a trained model to zero (or removes whole rows, heads or layers) to cut memory and compute. On LLMs the naive rule, “drop the smallest weights”, collapses: LLaMA-7B perplexity goes from 5.68 to 17.29 at 50% sparsity. The reason is outlier activations: a few input features are huge, so a small weight on them still matters. SparseGPT (2023) fixes this by solving a per-layer reconstruction problem with an Optimal-Brain-Surgeon-style weight update. Wanda (2023, the anchor) shows that most of the gain comes from a better score alone: rank each weight by ∣Wij∣⋅∥Xj∥2\lvert W_{ij}\rvert \cdot \lVert X_j \rVert_2 within its output row, with no weight update. It matches SparseGPT at 50% and computes its mask about 300× faster. Neither method speeds up a GPU much: unstructured sparsity needs special kernels, and 2:4 semi-structured sparsity gives about 1.5–1.8× per matmul but only 1.24× end-to-end on LLaMA-7B. Real speedups come from structured pruning (fewer heads, channels or layers), which hurts quality more and therefore usually needs retraining or distillation: LLM-Pruner, Sheared LLaMA and NVIDIA’s Minitron.

Why it matters for you. If you ship a retriever, reranker or RAG reader, the choice is usually between a smaller dense model, a quantised model and a pruned+distilled model. Minitron-style “prune then distill” is how several current small open models were made. Pruning also explains the “trim” and “drop” steps inside model merging: TIES and DARE prune deltas, not weights, and a sparse delta added back to a dense base still gives a dense model.

Sources. Anchor: Wanda. Also read: SparseGPT, LLM.int8() (outliers), LLM-Pruner, Sheared LLaMA, Minitron: Compact LMs via Pruning and KD, LLM Pruning and Distillation in Practice, ShortGPT, The Unreasonable Ineffectiveness of the Deeper Layers (Gromov et al.), and briefly REAP (2025 preprint; ICLR 2026 version) for MoE experts.

First read. Design space → Wanda worked example → speed measurements → width/depth + distillation decision (TL;DR, “The pruning design space”, “Why magnitude pruning collapses”, “Wanda”, the worked example, “Does it get faster?” and the Minitron part of “Structured pruning”). Skip on a first read: SparseGPT’s OBS and column-by-column Hessian bookkeeping, the LLM.int8 outlier statistics, the smaller survey methods (LLM-Pruner, Sheared LLaMA’s Lagrangian mask training) and the MoE section.

Plain words first. A linear layer computes Y=XW⊤Y = X W^\top, where WW has shape Cout×CinC_\text{out} \times C_\text{in} (one row per output neuron). Let BB be the number of calibration sequences and TT their length, so there are N=B⋅TN = B \cdot T token positions; stack them into X∈RN×CinX \in \mathbb{R}^{N \times C_\text{in}}, and write XjX_j for its jj-th column (input feature jj over all tokens). Pruning chooses a mask of weights to set to zero. Three questions define a method: what shape the zeros take, how you score which ones to drop, and whether you retrain afterwards.

GranularityWhat is removedSpeedup on GPUsQuality costExample
Unstructuredany individual weight≈ none with dense kernels; real on CPUs with sparse runtimes (DeepSparse: 1.57–2.16× at 40–60% on OPT-2.7B, SparseGPT App. E)lowestSparseGPT, Wanda at 50%
Semi-structured N:Mat most N nonzeros in every M consecutive weights (2:4 = 2 of every 4)up to 2× in theory on Ampere-and-later sparse tensor cores; measured 1.5–1.8× per layermediumSparseGPT, Wanda at 2:4 / 4:8
Structured (width)whole attention heads, MLP neurons, embedding channelsyes: the matrices simply get smallerhigh, needs retrainingLLM-Pruner, Sheared LLaMA, Minitron-width
Depthwhole transformer blocksyes, roughly proportional to layers removedhigh on generation and reasoningShortGPT, Gromov et al., Minitron-depth

One-shot vs retrain. One-shot post-training pruning uses a small calibration set (128 sequences of 2,048 tokens from C4 for both SparseGPT and Wanda), takes minutes to hours, and does no gradient training. Pruning + retraining (fine-tuning, continued pre-training, or distillation from the unpruned teacher) has widely varying budgets: LLM-Pruner uses about 50K instruction examples and three hours of LoRA recovery, whereas Sheared LLaMA and Minitron use tens to hundreds of billions of tokens. Large dense depth/width reductions generally benefit from recovery, but structured pruning is not universally training-dependent: REAP’s expert pruning, for example, is one-shot. IR analogy: one-shot pruning is like static index pruning (drop postings with low impact scores, no re-indexing); structured pruning + distillation is like training a smaller student retriever from a big teacher.

Layer-wise reconstruction. Both SparseGPT and Wanda prune one linear layer at a time and judge a mask by how much it changes that layer’s output on calibration data:

min⁡M, W^ ∥WX⊤−(M⊙W^)X⊤∥F2.\min_{M,\ \hat W} \ \big\lVert W X^\top - (M \odot \hat W) X^\top \big\rVert_F^2 .

The norm is the Frobenius norm: sum the squared output changes over all calibration tokens and output neurons. The target sparsity is a constraint on MM; without it, the trivial optimum is the unpruned model. MM is the 0/1 mask, ⊙\odot is elementwise product and W^\hat W are (possibly updated) remaining weights. Choosing MM and W^\hat W jointly is NP-hard, so methods split it into “pick the mask” and “optionally repair the remaining weights”.

Magnitude pruning keeps the largest ∣Wij∣\lvert W_{ij}\rvert. It ignores the input. LLM.int8() (Dettmers et al., 2022) found that transformers develop emergent outlier features: a few hidden dimensions whose values are up to about 20× larger than the rest. From about 6.7B parameters they appear in all layers and in about 75% of sequence positions; at 6.7B there were about 150,000 outliers per sequence, concentrated in just 6 feature dimensions. Zeroing those features (≈0.1% of all features) worsened perplexity by 600–1000%, while zeroing the same number of random features changed it by about 0.1%. (Wanda’s introduction cites the outliers as about 100× larger; the 20× figure here is LLM.int8’s own.)

So a small weight on an outlier channel multiplies a huge activation and contributes a lot to the output. Magnitude pruning deletes it. Results: on OPT-175B, SparseGPT reports magnitude pruning holds up only to about 10% sparsity and collapses beyond 30% (WikiText2 perplexity 4.3e4 at 50%, dense 8.35). On LLaMA-7B at 50% Wanda reports 17.29 vs 5.68 dense.

SparseGPT: reconstruct the layer (Frantar & Alistarh, ICML 2023)

Section titled “SparseGPT: reconstruct the layer (Frantar & Alistarh, ICML 2023)”

Plain words first. When you delete a weight, nudge the other weights in the same row to compensate, using second-order information about how input features co-vary. This is the classic Optimal Brain Surgeon (OBS) recipe, made fast enough for 175B parameters.

For one row ww, use the damped Gram matrix H=X⊤X+λIH = X^\top X + \lambda I, with λ\lambda set to 1% of the mean diagonal for numerical stability. Without damping, X⊤XX^\top X is the curvature of the row-reconstruction loss (up to the conventional factor of 2) and the OBS formulas below are exact for that quadratic problem; with damping they solve the corresponding regularised approximation. Removing weight mm costs, and is best repaired by:

εm=wm2[H−1]mm,δ=−wm[H−1]mm H:,m−1.\varepsilon_m = \frac{w_m^2}{[H^{-1}]_{mm}}, \qquad \delta = -\frac{w_m}{[H^{-1}]_{mm}} \, H^{-1}_{:,m}.

δm=−wm\delta_m = -w_m sets the selected coordinate to zero; the off-diagonal entries of H−1H^{-1} decide which other coordinates move to compensate. Wanda (below) uses only a diagonal approximation to rank deletions and leaves the surviving weights unchanged.

The obstacle: every row has its own mask, and the inverse of the masked Hessian is not the masked inverse, so exact per-row reconstruction costs O(drow dcol3)O(d_\text{row} \, d_\text{col}^3), roughly the 4th power of hidden size. SparseGPT’s trick is to process columns left to right and update only weights to the right of the current column, so all rows share one sequence of inverse Hessians, each obtained from the previous one by one Gaussian-elimination step. Total cost: O(dcol3+drowdcol2)O(d_\text{col}^3 + d_\text{row} d_\text{col}^2). The mask is chosen adaptively per block of 128 columns (or per group of MM for N:M) using ε\varepsilon, and it reuses GPTQ’s machinery, so 50% sparsity + 4-bit quantisation can be done in one pass.

Results (OPT-175B, WikiText2 perplexity): dense 8.35; SparseGPT 50% 8.21, 4:8 8.45, 2:4 8.74; magnitude 50% 4.3e4. Zero-shot average: dense 70.29, SparseGPT 50% 70.52, magnitude 31.10. It takes about 4 hours on a single 80 GB A100 for the 175B models. Larger models are easier to prune: OPT-2.7B goes from 12.47 to 13.48 at 50%.

Wanda: pruning by weights and activations (the anchor)

Section titled “Wanda: pruning by weights and activations (the anchor)”

Plain words first. Score each weight by “how big is it” times “how big is the input it multiplies”, compare only weights feeding the same output neuron, drop the lowest, and do not touch the rest. That is the whole method.

Sij=∣Wij∣⋅∥Xj∥2,S_{ij} = \lvert W_{ij} \rvert \cdot \lVert X_j \rVert_2 ,

where ∥Xj∥2\lVert X_j \rVert_2 is the L2 norm of input feature jj across all N=B⋅TN = B \cdot T calibration token positions. Within each output row ii, remove the s%s\% of weights with the lowest SijS_{ij}. The paper’s Algorithm 1 is three lines of PyTorch: metric = W.abs() * X.norm(p=2, dim=0), sort along the input dimension, zero the lowest int(C_in * s). Layers are pruned in sequence, so later layers are scored with inputs that already passed through pruned earlier layers. For N:M, the same score is compared within every MM consecutive weights of a row.

Connection to SparseGPT. SparseGPT’s saliency is ∣Wij∣2/[(X⊤X+λI)−1]jj\lvert W_{ij}\rvert^2 / [(X^\top X + \lambda I)^{-1}]_{jj}. Set λ=0\lambda = 0 and keep only the diagonal of X⊤XX^\top X: the diagonal entries are ∥Xj∥22\lVert X_j\rVert_2^2, the inverse of a diagonal matrix is elementwise, and the saliency becomes (∣Wij∣⋅∥Xj∥2)2(\lvert W_{ij}\rvert \cdot \lVert X_j\rVert_2)^2, the square of Wanda’s score. So Wanda is to SparseGPT roughly what Optimal Brain Damage (diagonal Hessian) is to Optimal Brain Surgeon, minus the weight update. Two design choices matter: L2 beat L1 and L∞ for the norm, and the per-output comparison group beat per-layer for LLMs (but not for ConvNeXt or DeiT image models).

Worked example: magnitude vs Wanda on a 2×4 layer

Section titled “Worked example: magnitude vs Wanda on a 2×4 layer”

Setup. Two output neurons, four input features. Calibration input norms ∥Xj∥2=(8,1,2,1)\lVert X_j\rVert_2 = (8, 1, 2, 1): feature 1 is an “outlier” channel.

W=(0.5−1.02.0−0.2−0.30.10.4−0.25)W = \begin{pmatrix} 0.5 & -1.0 & 2.0 & -0.2 \\ -0.3 & 0.1 & 0.4 & -0.25 \end{pmatrix}

Scores. Magnitude score = ∣Wij∣\lvert W_{ij}\rvert; Wanda score = ∣Wij∣⋅∥Xj∥2\lvert W_{ij}\rvert \cdot \lVert X_j\rVert_2.

WeightWijW_{ij}∥Xj∥\lVert X_j\rVertMagnitudeWanda
(1,1)0.580.54.0
(1,2)−1.011.01.0
(1,3)2.022.04.0
(1,4)−0.210.20.2
(2,1)−0.380.32.4
(2,2)0.110.10.1
(2,3)0.420.40.8
(2,4)−0.2510.250.25

50% per output row (drop 2 of 4 in each row).

  • Row 1: magnitude drops (1,4) and (1,1); Wanda drops (1,4) and (1,2). They disagree: magnitude throws away the 0.5 weight on the outlier channel.
  • Row 2: both drop (2,2) and (2,4).

Output error. Assume orthogonal calibration columns (diagonal X⊤XX^\top X). Then the squared change in a row’s output is ∑j∈pruned(Wij∥Xj∥)2\sum_{j \in \text{pruned}} (W_{ij} \lVert X_j\rVert)^2, i.e. the sum of squared Wanda scores of the pruned weights. Row 1: magnitude 0.52⋅64+0.22=16.040.5^2 \cdot 64 + 0.2^2 = 16.04; Wanda 1.02+0.22=1.041.0^2 + 0.2^2 = 1.04. Row 2: 0.01+0.0625=0.07250.01 + 0.0625 = 0.0725 for both. Wanda’s choice has about 15.4× lower squared reconstruction error in row 1 (the error norm is only about 3.9× lower). With non-orthogonal columns there are cross terms; handling them is exactly what SparseGPT’s full H−1H^{-1} and weight update are for.

Under 2:4. A 4-wide row is a single group of 4, so 2:4 here gives exactly the same masks as per-row 50%. The difference shows up on wider rows. Take one 8-wide row with Wanda scores (5,4,3,6,0.1,0.2,0.3,0.4)(5, 4, 3, 6, 0.1, 0.2, 0.3, 0.4). Unstructured 50% drops the last four (squared error 0.01+0.04+0.09+0.16=0.300.01+0.04+0.09+0.16 = 0.30). 2:4 must drop two from each group of four, so it is forced to drop 3 and 4 from the first group: error 9+16+0.01+0.04=25.059 + 16 + 0.01 + 0.04 = 25.05. When important weights cluster, N:M pays a large price, which is why 2:4 perplexities in the tables below are much worse than 50% unstructured.

Comparison group. Layer-wise 50% magnitude (drop the 4 smallest of all 8) removes (2,2), (1,4), (2,4) and (2,1): row 2 loses three of four weights, including the outlier-channel one. Per-row grouping prevents any single output neuron from being gutted. (In this toy, layer-wise Wanda has a slightly lower total error, 0.75 vs 1.11; the per-output advantage is an empirical LLM finding, Table 7 below, not a theorem.) All numbers above were checked with a short NumPy script; see “If you want to try it”.

WikiText perplexity (lower is better), Wanda Table 3.

MethodSparsityLLaMA-7BLLaMA-13BLLaMA-65BLLaMA-2-7BLLaMA-2-70B
Dense0%5.685.093.565.123.12
Magnitude50%17.2920.215.9014.894.98
SparseGPT50%7.226.214.576.513.98
Wanda50%7.266.154.576.423.98
SparseGPT2:411.009.116.2810.175.40
Wanda2:411.539.586.2511.025.16

Mean zero-shot accuracy over 7 tasks (Table 2). At 50%: LLaMA-7B dense 59.99, magnitude 46.94, SparseGPT 54.94, Wanda 54.21; LLaMA-65B dense 66.97, SparseGPT 66.30, Wanda 66.67. A 50%-sparse LLaMA-65B (66.67) beats a dense LLaMA-30B (65.38), which is the argument for “large-sparse over small-dense”, but only for unstructured sparsity, which does not give the matching GPU speedup.

Cost of computing the mask (Table 4, seconds). SparseGPT 203.1 / 339.0 / 810.3 / 1353.4 for LLaMA-7B/13B/30B/65B; Wanda 0.54 / 0.91 / 2.9 / 5.6. That is the ≈300× speedup, measured as pruning-metric time excluding the shared forward passes, not end-to-end compression time.

Ablations.

LLaMA-7B, 50%, perplexityper layerper (output, 1) = per row
Magnitude17.2913.41
SparseGPT metric7.917.41
Wanda7.957.26

Adding SparseGPT-style weight updates to Wanda (Table 8) barely helps at 50% (7.26 → 7.32 sequential) but helps under 2:4 (11.53 → 10.89, now better than SparseGPT’s 11.00) and a lot at 70% sparsity (84.50 → 29.65). With a single calibration sample, Wanda is far more robust than SparseGPT (≈7.5 vs 10.22); both reach 7.26 at 128 samples. BERT-era criteria fail outright on LLaMA-7B at 50% (SNIP 231.48, movement pruning 349.33).

Recovering with fine-tuning (Table 6, LLaMA-7B, mask frozen). LoRA (rank 8 on q and v, 1 GPU, 12 h) and full fine-tuning (4 GPUs, 3 days) close part of the gap:

SparsityZero-shot: none / LoRA / fullPerplexity: none / LoRA / full
50%54.21 / 56.53 / 58.157.26 / 6.84 / 5.98
2:448.53 / 54.46 / 56.1911.53 / 8.24 / 7.02

Dense is 59.99 / 5.68. Even full fine-tuning does not return to dense at 2:4.

NVIDIA Ampere-and-later GPUs have sparse tensor cores that skip the zeros of a 2:4 matrix, a theoretical 2× on the matmul. Measured:

SourceSetupMatmul speedupEnd-to-end
Wanda Table 5LLaMA-65B layer shapes, A6000, CUTLASS, batch 1q/k/v/o 1.63×, up/gate 1.61×, down 1.54×LLaMA-7B: 312 → 251 ms, 1.24×
SparseGPT App. EOPT-175B shapes, 2,048 tokens1.79× / 1.67× / 1.54דslightly lower” (not measured)

End-to-end is lower because attention, normalisation, sampling and memory traffic are not sped up. Unstructured 50% gives essentially nothing on GPUs without special kernels; it does help memory only if stored in a sparse format, and that format’s index overhead eats much of the saving at 50%. Quantisation (QLoRA’s NF4, GPTQ) usually gives more memory reduction per point of quality lost, and SparseGPT showed the two compose: 50% + 4-bit OPT-175B gets 8.29 perplexity vs 8.68 for 3-bit GPTQ at a similar size.

Structured pruning: smaller matrices, then retrain

Section titled “Structured pruning: smaller matrices, then retrain”

For dense deployment, the object we want is a smaller tensor shape, not merely a mask. For example, deleting an MLP hidden channel means deleting its row in up_proj and gate_proj and its column in down_proj; otherwise the channel still costs dense compute.

LLM-Pruner (Ma et al., NeurIPS 2023). Builds a dependency graph so coupled structures are removed together (an attention head with its q/k/v/o slices, an MLP neuron with its up/gate/down slices, an embedding channel across all layers). Importance is a Taylor expansion of the loss change, ∣∂L∂WW−12W⊤HW∣\lvert \tfrac{\partial L}{\partial W} W - \tfrac12 W^\top H W\rvert with a Fisher approximation of HH, computed on only 10 samples. Recovery is LoRA on ~50k Alpaca samples for 3 hours. LLaMA-7B at 20% fewer parameters keeps 89.8% of its (own-eval) zero-shot average without tuning and about 95% after LoRA; WikiText2 perplexity goes from 12.62 to 17.37. At 50%, accuracy degrades a lot. Latency gain is modest: 69.32 s → 58.55 s on its benchmark at 20%.

Sheared LLaMA (Xia et al., ICLR 2024). Targeted structured pruning: learn masks over layers, heads, hidden dims and MLP dims (hard-concrete, L0-style) under Lagrangian constraints that force the result to an exact target shape such as Pythia-1.4B or INCITE-3B. Then continued pre-training with dynamic batch loading: every few steps, raise the sampling weight of domains whose loss is furthest above a reference loss, wi←wiexp⁡(max⁡(ℓi−ℓiref,0))w_i \leftarrow w_i \exp(\max(\ell_i - \ell_i^\text{ref}, 0)), renormalised. From LLaMA2-7B with 0.4B pruning tokens plus 50B continued-pretraining tokens (50.4B additional tokens in total, excluding the source model’s pre-training; the paper rounds this to “50B”): Sheared-LLaMA-2.7B averages 56.7 vs OpenLLaMA-3B-v2 (1T tokens) 55.7; Sheared-1.3B 51.0 vs TinyLlama-1.1B (3T tokens) 50.0. The paper claims about 3% of the compute of training such models from scratch. Pruning longer helps less than you’d think: with a fixed 5B-token budget, 0.2B → 1.6B pruning tokens improves post-pruning perplexity from 12.99 to 8.04 but final perplexity only from 7.46 to 7.08.

Minitron (NVIDIA, 2024). Prune Nemotron-4 15B to 8B and 4B along width (heads, MLP neurons, embedding channels) and depth, with activation-only importance from 1,024 calibration samples (e.g. a neuron’s importance is its summed activation; aggregate over batch with L2 and over sequence with mean), then distill from the unpruned teacher with forward KL on logits. Table 1 (15B → 8B, after ~1.8B tokens of retraining) shows why retraining is part of the method:

Axes prunedTeacher-student KL before → afterLM val loss
all axes5.35 → 0.382.062
width only (no depth)6.33 → 0.372.049
depth only8.35 → 0.492.155
random init (no pruning)12.27 → 2.343.953

Minitron-8B uses 94B tokens and reaches 63.8 MMLU (teacher 66.6; Nemotron-3 8B trained from scratch 54.7), with 40× fewer training tokens than from scratch. Its best practices include: prefer width over depth at this scale, compute importance once, and use KL-based distillation rather than ground-truth LM loss, with logit-only distillation when depth changes little and intermediate-state plus embedding losses when depth is reduced significantly.

Minitron in practice (Llama-3.1-8B → 4B, Mistral NeMo 12B → 8B). Adds teacher correction: fine-tune the teacher on ~100B tokens of the distillation dataset first, because the original pre-training data is unavailable; this gives over 6% lower LM validation loss. Include correction in the compute budget: reproducing ~100B teacher-correction tokens plus 94B student-distillation tokens is not a 100B-total-token recipe, and teacher and student tokens have different FLOP costs. For depth, dropping a contiguous block (layers 16–31) beat dropping the 16 individually least-important layers on Winogrande (0.595 vs 0.5, i.e. chance), even though validation loss preferred the non-contiguous choice. Width vs depth for the 4B base: MMLU 60.5 vs 58.7, GSM8K 41.2 vs 16.8. On one H100 80 GB with TensorRT-LLM FP8, the paper reports mean throughput gains over Llama-3.1-8B of 1.8× (width) and 2.7× (depth), using batch 64 for the 4B models versus batch 32 for the 8B–12B models across its input/output-length sweep. These are deployment-throughput comparisons, not fixed-batch or single-request latency speedups. (The paper’s own summary list says 1.7× for width.) The width model keeps 32 layers, 8 KV groups and head dimension 128 (Table 3), so its KV cache per token is unchanged from the teacher (128 KiB in bf16); the 16-layer depth model halves it (64 KiB). MN-Minitron-8B scores 69.5 MMLU, at or near its 12B teacher.

ShortGPT (Men et al., 2024). Score each layer by Block Influence, BIi=1−E[cos⁡(xi,xi+1)]\text{BI}_i = 1 - \mathbb{E}[\cos(x_i, x_{i+1})]: if a layer barely rotates its input hidden state, it does little. Delete the lowest-BI layers, no retraining. For Llama2-13B, the introduction reports MMLU 55.0 → 52.2 after removing 10 of 40 layers, whereas the main comparison table reports 55.00 → 54.69 at a 24.6% parameter-pruning ratio; do not combine these into one uniquely specified measurement. On Llama2-7B with 9 of 32 blocks removed (28.125% of blocks; the paper reports a 27.1% parameter-pruning ratio), MMLU stays near dense (43.96 vs 45.39) while XSum summarisation collapses (19.40 → 0.67). In a separate GPTQ-quantised setting with 23 layers left, perplexity jumps from 8.03 to 40.78 with only 1.19× throughput. Layer removal stacks with quantisation.

Gromov et al. (ICLR 2025). For a block of nn layers, find the start ℓ∗\ell^* that minimises the angular distance 1πarccos⁡\tfrac{1}{\pi}\arccos of the cosine between the last-token hidden state entering layer ℓ\ell and entering layer ℓ+n\ell+n; drop that block and heal with QLoRA on 164M or 328M C4 tokens (one 40 GB A100). Findings: MMLU and BoolQ stay near unpruned until a model-dependent 20–55% of layers are removed, then drop sharply to random; Llama-2-70B tolerates removing roughly half its layers. Healed C4 loss, by contrast, rises smoothly, so QA accuracy and loss are decoupled. An even simpler rule (drop the deepest layers except the last, then heal) nearly matches. GSM8k is hurt by any amount of depth pruning, a hint that deep layers matter for multi-step reasoning more than for stored knowledge.

IR analogy. BI and angular distance are “how much does this stage rerank the list?” A late reranking stage that rarely changes the top-k can be dropped for recall@k, but may still matter for the hard queries a summary metric under-weights.

In mixture-of-experts models (Mixtral, MoE handbook) the natural structured unit is a whole expert. REAP (Lasby et al., 2025 preprint; ICLR 2026 version) analyses fixed mixtures of experts with summed gates: merging loses the independently input-dependent routing weights and can create an irreducible approximation error when the original expert outputs differ. (This is not a theorem that every possible learned expert compression is inferior to pruning.) It proposes one-shot pruning of the experts with the lowest average router-weighted output norm, Sj=1∣Xj∣∑x∈Xjgj(x)∥fj(x)∥2S_j = \tfrac{1}{\lvert\mathcal{X}_j\rvert}\sum_{x \in \mathcal{X}_j} g_j(x) \lVert f_j(x)\rVert_2, averaged only over tokens where expert jj is active, so rarely used specialists are not penalised for low frequency. It is the MoE cousin of Wanda’s “weight times activation” idea.

How pruning relates to merging, quantisation and distillation

Section titled “How pruning relates to merging, quantisation and distillation”
  • Merging. TIES “trim” keeps the top-k% entries of each task vector τ=θft−θbase\tau = \theta_\text{ft} - \theta_\text{base} by magnitude; DARE randomly drops a fraction pp of delta entries and rescales the rest by 1/(1−p)1/(1-p). These are pruning operators, but on deltas. In DARE’s tested settings, SFT deltas are tiny and redundant (mostly within 0.002) and dropping 90% or more with rescaling can preserve performance; with large deltas or the wrong ancestor it fails. Merging a sparse delta into a dense base still yields a dense model, so delta sparsity by itself does not shrink or speed up deployment. Pruning the weights themselves removes pretrained function, so even 50% needs an activation-aware score. TIES trim is the delta analogue of magnitude pruning. See also MergeKit and merging in practice.
  • Quantisation reduces bits per weight; pruning reduces the number of weights. They compose (SparseGPT 50% + 4-bit), and QLoRA is the standard way to fine-tune or heal a compressed model cheaply (Gromov et al. heal with it).
  • Distillation is the recovery step for structured pruning: Minitron’s “prune, then distill with logit KL” is knowledge distillation where the student starts from the teacher’s own pruned weights instead of a random init (random init ends at 3.953 LM loss vs 2.062 in Minitron Table 1).
  • Serving. Fewer layers reduce weight reads and remove those layers’ KV caches. Width pruning reduces the affected weight matrices, but reduces KV-cache size only if it reduces the number of KV heads or their head dimension; pruning MLP neurons or residual/embedding width alone need not reduce KV cache (Llama-3.1-Minitron-4B-Width keeps the teacher’s per-token cache, while the depth model halves it). See serving systems.
  • Benchmarks hide damage. Multiple-choice QA can look flat while generation, summarisation, math and perplexity degrade (ShortGPT XSum, Gromov GSM8k). Always check generative and long-context tasks.
  • Speed claims need hardware detail. Unstructured sparsity rarely speeds up GPUs; 2:4 gives ≈1.2× end-to-end at batch 1 in Wanda’s measurement; structured and depth pruning give real but recipe-dependent gains.
  • “Large-sparse beats small-dense” holds for unstructured sparsity, where the speed benefit is weakest; Wanda reports the trend reverses under structured sparsity.
  • Uniform sparsity across layers is a simplification; SparseGPT found later layers more sensitive to 2:4.
  • Paper-internal inconsistencies: Wanda’s text gives 7.66 for 1-sample calibration while its Table 17 lists 7.46; Wanda Table 8 lists the per-layer magnitude baseline as 17.59 vs 17.29 elsewhere; Minitron-in-practice gives width throughput as 1.8× and 1.7×; SparseGPT says about 4 hours in the experiments and under 4.5 hours in the abstract.
  • Structured-pruning comparisons use different budgets and evals (LLM-Pruner’s own evaluation gives dense LLaMA-7B 63.25, not Wanda’s 59.99), so numbers across papers are not directly comparable.

The official Wanda repo prunes LLaMA models with --prune_method wanda (or sparsegpt, magnitude) and --sparsity_type unstructured / 2:4. The worked example can be checked in a few lines:

import numpy as np
W = np.array([[0.5, -1.0, 2.0, -0.2], [-0.3, 0.1, 0.4, -0.25]])
xnorm = np.array([8., 1., 2., 1.])
for name, S in [("magnitude", np.abs(W)), ("wanda", np.abs(W) * xnorm)]:
pruned = np.argsort(S, axis=1)[:, :2] # 50% per output row
err = [sum((W[i, j] * xnorm[j])**2 for j in pruned[i]) for i in range(2)]
print(name, pruned.tolist(), err) # magnitude [[3,0],[1,3]] [16.04, 0.0725]
# wanda [[3,1],[1,3]] [1.04, 0.0725]
  • Distinguish unstructured, N:M and structured/depth pruning, and say which give real GPU speedups.
  • Explain why magnitude pruning collapses on LLMs using outlier features.
  • Derive Wanda’s score from SparseGPT’s OBS saliency and say what SparseGPT’s weight update adds.
  • Compute magnitude vs Wanda masks by hand for a small layer, per row and under 2:4.
  • Choose between width and depth pruning plus distillation for a target size and latency, citing Minitron’s trade-offs.
  • Relate TIES/DARE trimming of deltas to weight pruning, and design an evaluation that does not hide pruning damage.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    Start from SparseGPT's per-weight saliency, the squared weight divided by the matching diagonal entry of the inverse of (X-transpose X + lambda I). Show which two simplifications turn it into the square of Wanda's score, and then apply Wanda to a row with weights 0.5, -1.0, 2.0, -0.2 and input-feature norms 8, 1, 2, 1 at 50% sparsity. Which weights go, and how does the output error compare with magnitude pruning? Assume the calibration columns are orthogonal and compare squared reconstruction error.

    What a strong answer covers
    • Set lambda to 0 and keep only the diagonal of X-transpose X. The inverse of a diagonal matrix is elementwise, so the diagonal entry of the inverse is 1 over the squared norm of input feature j, and the saliency becomes (|W_ij| times ‖X_j‖) squared.
    • Squaring is monotone, so ranking by the saliency equals ranking by Wanda's score; Wanda is the per-output, diagonal-Hessian (OBD-like) special case, and it never applies the compensating weight update.
    • Wanda scores are 4, 1, 4, 0.2, so it prunes -0.2 and -1.0. Magnitude scores are 0.5, 1.0, 2.0, 0.2, so magnitude prunes -0.2 and 0.5, the weight sitting on the large-norm feature.
    • With orthogonal calibration columns (diagonal X-transpose X) the squared reconstruction error is the sum of (w times norm) squared over pruned weights: 1.04 for Wanda versus 16.04 for magnitude, about 15.4 times lower (the error norm is only about 3.9 times lower).
  2. Mechanism

    Explain why plain magnitude pruning, which works acceptably for small vision and BERT-era models, collapses on billion-parameter LLMs (LLaMA-7B perplexity from 5.68 to 17.29 at 50%, OPT-175B to tens of thousands), and why multiplying by the input-feature norm and comparing within each output row can protect the contributions that magnitude pruning destroys.

    What a strong answer covers
    • LLM.int8 found emergent outlier features: a handful of hidden dimensions with magnitudes up to about 20 times larger, present in all layers beyond about 6.7B parameters; zeroing them hurts perplexity by 600-1000% although they are about 0.1% of features.
    • A small weight on an outlier input channel contributes w times a huge activation to the output, so its true importance can be large even though |w| is small; magnitude pruning can delete exactly these.
    • Weighting by the L2 norm of the input feature over calibration tokens estimates each weight's contribution to the output, which explains why activation-aware ranking can protect those contributions; outliers do not prove every magnitude-selected deletion is harmful.
    • Per-output-row comparison keeps every output neuron at the same sparsity, so no row is gutted; Wanda's Table 7 shows the per-output group gives 7.26 vs 7.95 per-layer on LLaMA-7B, while for image classifiers per-layer is as good or better.
  3. What if…

    Wanda's ablations vary the comparison group (layer, input, output) and whether pruned weights are compensated by a weight update. Summarise what Tables 7-8 and the calibration-size study show, and argue what these controlled mask/update ablations establish at 50% versus 2:4 or 70% sparsity, and what remains confounded.

    What a strong answer covers
    • Comparison group: per-output-row is best for both Wanda (7.26) and the SparseGPT metric (7.41) on LLaMA-7B at 50%. At (input, 1) all three metrics give the same 8.86, because the feature-dependent factor is constant within that group; this is worse than the best row grouping for Wanda and SparseGPT but is the best grouping for magnitude pruning, far better than its 17.29 per-layer and 13.41 per-output results.
    • Weight update barely matters at 50% for Wanda (7.26 with none vs 7.32 sequential), but helps under 2:4 (11.53 to 10.89, beating SparseGPT's 11.00) and hugely at 70% (84.50 to 29.65).
    • Calibration size: with a single calibration sample Wanda is far more robust than SparseGPT (about 7.5 vs 10.22 perplexity); both reach 7.26 at 128 samples, because SparseGPT must estimate a full Hessian.
    • Implication: at moderate unstructured sparsity the mask (which weights) is what matters, and a good activation-aware score suffices; when constraints are tight or sparsity is high, reconstruction (the OBS update) is where SparseGPT earns its extra cost. Confound: the sequential update also changes the weights later masks are chosen from, so mask selection and reconstruction are not fully separated.
  4. Critique

    A vendor reports "95% quality retention and 2x faster inference" for a pruned RAG reader, measured only by a multiple-choice average and isolated matmuls. Use the Wanda, ShortGPT and Gromov et al. results to construct a deployment counterexample, then specify the minimum quality and systems evaluation that would decide whether to accept the model.

    What a strong answer covers
    • Retention needs a stated denominator and per-task numbers: ShortGPT removes 9 of 32 Llama2-7B blocks (27.1% of parameters) and keeps MMLU near dense (43.96 vs 45.39) while XSum collapses from 19.40 to 0.67; Gromov et al. find GSM8k hurt by any depth pruning, so a multiple-choice average hides generation failure.
    • Isolated matmul speedups are not deployment speedups: Wanda's 2:4 kernels give 1.54-1.63x per layer but 1.24x end-to-end on LLaMA-7B, unstructured sparsity needs sparse-kernel support to give any GPU gain, and ShortGPT's GPTQ variant with 23 layers left gains only 1.19x throughput while perplexity rises from 8.03 to 40.78.
    • Measure fixed-batch latency (time to first token and per-token decode) and saturation throughput separately, on stated hardware, kernels, precision and sequence lengths.
    • Compare against matched baselines: a dense model of the same size or training compute and a quantised version of the parent, not only the unpruned parent.
    • Report confidence intervals over seeds and test sets, plus held-out RAG generation: answer accuracy with gold and noisy passages, faithfulness to retrieved context and long-context behaviour.
  5. Design

    You need a roughly 4B RAG reader from an 8B model and have about 100B student-training tokens, with teacher adaptation charged separately. Compare width, depth and 2:4 pruning using the reported quality results. Which latency and KV-cache measurements would you collect before choosing, given that Minitron's published throughput ratios used different batch sizes from the teacher?

    What a strong answer covers
    • Minitron-in-practice (Llama-3.1-8B to 4B, 94B distillation tokens): the width-pruned base beats depth on MMLU (60.5 vs 58.7) and GSM8K (41.2 vs 16.8). 2:4 keeps the dense shape and loses more quality without fine-tuning (LLaMA-7B 2:4 perplexity about 11 vs 5.68 dense); its 1.24x end-to-end in Wanda is one measurement, not a universal bound.
    • KV cache: the width model keeps 32 layers, 8 KV groups and head dimension 128, so its per-token KV cache equals the teacher's (128 KiB in bf16); the 16-layer depth model halves it (64 KiB). Width pruning helps decode memory traffic only through smaller weights.
    • The reported 2.7x (depth) and 1.8x (width) throughput gains used batch 64 for the 4B models versus batch 32 for the 8B teacher on one H100 in FP8, so they mix model speed with batch size; measure fixed-batch latency and saturation throughput at your own sequence lengths.
    • Teacher correction (about 100B tokens on the distillation data) is extra compute on top of the student budget; charge it explicitly, or try a lighter correction.
    • Pipeline: activation-based importance from about 1K calibration samples, prune to the target shape, distil with logit KL (add intermediate-state losses if depth is cut a lot), then evaluate on held-out RAG QA with gold and noisy passages, long-context tasks and generation faithfulness, not only MMLU.
  6. Research idea

    TIES trims small task-vector entries and DARE randomly drops most of them before merging, while Wanda and SparseGPT prune base-model weights. Explain why dropping and rescaling 90% of a small SFT delta can preserve performance in some models, whereas applying the same operation to pretrained weights is much more destructive. Identify conditions under which even delta pruning fails, then propose an activation-aware delta-merging experiment.

    What a strong answer covers
    • With DARE's fixed rescaling by 1/(1-p), a linear layer's delta contribution is unbiased conditional on a fixed input, but its variance grows with p/(1-p) times the squared delta contributions. This does not guarantee unchanged nonlinear outputs or task performance: DARE works when SFT deltas are small (mostly within 0.002), but measuring WizardCoder-Python-13B against Llama-2-13b instead of its real parent CodeLlama (deltas often above 0.01) drops HumanEval pass@1 from 63.41 to 0.0 at only 10% drop. The surviving base weights, which carry the pretrained function including outlier channels, explain why delta pruning is usually less destructive.
    • TIES trims by delta magnitude only, which is the analogue of magnitude pruning; Wanda suggests weighting delta entries by input-feature norms could pick better entries to keep.
    • Experiment: for two or more fine-tunes of one base, compare TIES trim by |delta| vs by |delta| times ‖X_j‖ from a shared calibration set, at matched density, measuring per-task accuracy and interference; also test whether a Wanda-pruned base still merges well with deltas trained on the dense base.
    • Controls: same density and sign-election, same calibration data across tasks, several random seeds for DARE, and report whether gains persist when task count grows.
    • Falsifier: if activation-aware delta selection lowers reconstruction error but consistently loses held-out per-task quality at matched density and tuning budget, reject the hypothesis that local output preservation is the right merge criterion.

Done with this page?

Status