TL;DR
GBLM-Pruner introduces a training-free pruning technique for large language models (LLMs) that incorporates first-order gradient information alongside weight magnitudes and feature activations. Grounded in a first-order extension of the classical Optimal Brain Surgeon (OBS) framework, it achieves state-of-the-art unstructured pruning performance without requiring expensive inverse-Hessian updates or fine-tuning.
What Problem Does This Paper Address?
Pruning LLMs (reducing parameter counts without degrading capabilities) has become essential for deploying multi-billion-parameter models to resource-constrained devices. Current training-free, post-training pruning methods fall into two main camps:
- Magnitude pruning: Simple and fast, but harms performance at modest sparsity ratios.
- Activation-aware / Second-order methods: Approaches like SparseGPT require expensive Hessian inversions and weight updates, while simpler heuristics like Wanda (combining weight magnitude with activation norms) lack strong theoretical grounding.
Historically, pruning frameworks (like Optimal Brain Damage and OBS) ignored first-order gradient terms under the assumption that a converged model's gradients are close to zero. This paper challenges that assumption, asking: Can the gradient information of a pretrained model on a few calibration samples provide critical signals for one-shot, training-free pruning?
Methods
The authors re-derive the Optimal Brain Surgeon framework to include the first-order Taylor expansion term ($\nabla E^\top \delta w$), yielding a closed-form error approximation when removing weight $w_m$: $$\delta E_m \approx \frac{w_m^2}{2 (H^{-1})_{mm}} - \frac{w_m (g^\top H^{-1} I_m)}{(H^{-1})_{mm}}$$
Under the standard diagonal Hessian approximation ($H \approx 2 \cdot \text{diag}(\|x_j\|_2^2)$), this theoretical insight motivates the GBLM-Pruner metric: $$W_m[i, j] = |W[i, j]| \cdot \left( \alpha \cdot \|G[:, i, j]\|_p + \|X[:, j]\|_2 \right)$$ - $W$: Weight matrix. - $X$: Input activation tensor across calibration tokens. - $G$: Gradient tensor computed on calibration data using standard next-token prediction loss. - $\|\cdot\|_p$: Sample-wise norm across calibration samples ($\ell_1$ or $\ell_2$; $\ell_1$ is selected as best). - $\alpha$: A scaling hyperparameter (empirically set to 100) to balance the small numerical magnitude of gradients against larger activation norms.
Crucially, GBLM-Pruner requires no subsequent retraining or weight updates (unlike SparseGPT) and evaluates pruning scores per output neuron (equivalent to a column-wise comparison in matrix form).
Weights (W) Gradients (G) Activations (X)
[ ... ] [ ... ] [ ... ]
\ \ /
\ \-- (ℓ₁ norm) /
\ \ /
\ [ α·||G|| + ||X||₂ ]
\ /
-----> [ Element-wise Product ] <--
|
[ Pruning Metric ]
|
(Remove bottom p% per row)
Datasets
- Calibration: 128 sequences (2,048 tokens each) randomly sampled from the first shard of the C4 training dataset. For ViT experiments, 4,096 random images from the ImageNet-1k training set.
- Evaluation:
- Perplexity: Evaluated on the WikiText validation dataset.
- Zero-Shot Reasoning: Six tasks from the EleutherAI LM Evaluation Harness: BoolQ, RTE, HellaSwag, WinoGrande, ARC-easy, and OpenBookQA (OBQA).
- Vision: Standard ImageNet-1k top-1 classification accuracy.
Key Insights and Ideas
- Pretrained gradients are informative: Despite convergence during pretraining, gradients computed over a tiny calibration batch reveal which parameters are acutely sensitive to the task objective, serving as a non-redundant complementary signal to activation magnitudes.
- Norm aggregation matters: Direct gradient accumulation ($\sum g$) introduces noise and performs poorly (perplexity jumps to 119.72 on LLaMA-2-7B at 50% sparsity). In contrast, aggregating sample-wise magnitudes using $\ell_1$ or $\ell_2$ norms reveals coherent parameter importance.
- Emergent semi-structure: Visualizing the unstructured masks derived with gradient information shows clearer vertical and horizontal structural alignments than pure magnitude pruning, reflecting the geometric parameter interdependence inside self-attention projections.
- Weight updates are unnecessary: Testing OBS weight updates on top of the GBLM-Pruner metric showed negligible or no benefit, demonstrating that selecting the right pruning metric can render costly weight-update algorithms superfluous.
Key Results
- WikiText Perplexity (50% unstructured sparsity):
- LLaMA-1-7B: GBLM-Pruner achieves 7.15 vs. Wanda's 7.26 and SparseGPT's 7.22 (Dense: 5.68).
- LLaMA-2-70B: GBLM-Pruner achieves 4.17 vs. Wanda's 4.22 and SparseGPT's 4.25 (Dense: 3.32).
- Zero-Shot Tasks (Mean Accuracy across 6 tasks at 50% sparsity):
- LLaMA-1-7B: Dense is 67.47%. GBLM-Pruner reaches 63.07%, outperforming SparseGPT (61.77%) and Wanda (61.17%).
- LLaMA-1-30B: GBLM-Pruner reaches 71.17% (Dense: 72.50%), surpassing SparseGPT (69.33%) and Wanda (70.84%).
- Structured $N$:$M$ Sparsity: Under 4:8 sparsity, GBLM-Pruner outperforms both baselines on larger models (e.g., 4.72 perplexity on LLaMA-2-70B vs. 4.77 for Wanda and 4.91 for SparseGPT). Under restrictive 2:4 sparsity, SparseGPT occasionally performs better on smaller models due to its explicit weight updates.
- Generalization beyond LLMs: When applied to ViT-B on ImageNet-1k at 70% sparsity, GBLM-Pruner ($\ell_1$) maintains 8.89% top-1 accuracy compared to Wanda's 7.92% and Magnitude pruning's 1.88%.
Limitations and Future Work
- $2$:$4$ Semi-Structured Sparsity Gap: SparseGPT still edges out GBLM-Pruner on highly constrained $2$:$4$ sparsity on some smaller models, likely because weight updates become essential when a restrictive structural grid is enforced.
- Backward Pass Requirement: While training-free, computing gradients requires backward passes across the calibration batch, which incurs higher peak memory and computational overhead during the pruning phase compared to purely forward-pass metrics like Wanda.
- Hyperparameter Dependency: The scaling factor $\alpha$ must be tuned (the authors find $\alpha=100$ optimal for their setup) to align gradient scales with activation scales.
- Structured Pruning Unexplored: The paper focuses primarily on unstructured and $N$:$M$ sparsity; extending first-order calibration to full channel or block pruning remains an open direction.
Summary updated