Deploying Large Language Models (LLMs) is a massive challenge due to their immense memory and computational requirements. While network pruning—removing redundant weights—is a promising solution, existing post-training pruning (PTP) methods often suffer from significant performance degradation.
Researchers have identified a specific culprit for this degradation: channel corruption. Standard pruning metrics often accidentally wipe out entire input or output channels. In a highly optimized LLM, losing a channel entirely is akin to removing a critical node from a complex network, leading to a collapse in model proficiency. Furthermore, hardware-friendly N:M semi-structured sparsity (e.g., requiring 2 out of every 4 weights to be zero) is often sub-optimal because important weights might be "stuck" in the same block, forcing the algorithm to prune one of them.
To address this, a new "plug-and-play" post-training pruning method achieves state-of-the-art sparsity without the need for expensive retraining. By introducing a new metric called Relative Importance and Activations (RIA) and a Channel Permutation strategy, models like LLaMA2-70B can be compressed to 50% sparsity while maintaining—and sometimes exceeding—the performance of the original dense model.
Core Innovations
1. Relative Importance and Activations (RIA)
Instead of looking at absolute weight magnitudes, RIA evaluates a weight's significance relative to its specific input and output channels. This ensures that even if a channel has generally smaller weights, its most important connections are preserved, preventing channel corruption. RIA treats channels as nodes, ensuring no "node" is completely disconnected. It also incorporates the $\ell_2$-norm of activations to account for "outlier" features that are known to be critical in LLMs.
Interestingly, activation outliers are remarkably consistent across different datasets. This stability means a small amount of calibration data (as few as 128 samples) provides a signal that generalizes well to many tasks.
2. Channel Permutation (CP)
To optimize N:M sparsity, the authors reorder the weight channels before applying the pruning mask. Channel permutation doesn't change the mathematical output of a dense layer (provided you permute the corresponding activations), but it dramatically changes which weights "survive" the N:M mask.
This combinatorial optimization problem is solved efficiently in two steps: a Heuristic Channel Allocation (distributing high-importance channels across different blocks) followed by a Linear Sum Assignment (using the Hungarian algorithm) to fine-tune the matching. This ensures that "heavy hitter" weights are spread out and not forced to compete for the same non-zero slots in an N:M block.
Key Results and Performance
The authors evaluated their methods on prominent open-source LLM families, including LLaMA (7B to 65B), LLaMA2 (7B to 70B), and OPT (1.3B), testing language modeling perplexity and zero-shot performance on common-sense reasoning datasets.
- Unstructured Pruning: RIA consistently outperformed prior state-of-the-art methods like SparseGPT and Wanda. For LLaMA2-70B at 50% sparsity, RIA achieved an average zero-shot score of 62.97, nearly matching the dense model's 63.32. Crucially, while methods like Wanda can corrupt up to 10% of channels in certain layers, RIA ensures zero channel corruption.
- N:M Sparsity Breakthrough: By combining RIA with Channel Permutation, the authors achieved 2:4 sparsity (50% reduction) on LLaMA2-70B that actually outperformed the original dense model on the BoolQ task (85.14% vs 83.70%).
- Efficiency and Hardware Speedup: The method is truly "plug-and-play." Pruning a 70B model takes about 10 minutes for RIA and under 2 hours for Channel Permutation on standard hardware. Using NVIDIA's
cuSPARSELtlibrary, the 2:4 sparse models achieved a practical 1.63x inference speedup on an A100 GPU.
Limitations
While highly effective, the practical speedups for N:M sparsity are currently tied to specific hardware architectures (like NVIDIA Ampere or Hopper) that support sparse tensor cores. Additionally, the study focused on linear layers; embeddings and the final head were left dense. Finally, although robust, RIA still requires a small set of calibration data to estimate activation norms, leaving room for future completely data-free variants.
Summary updated