TL;DR
This paper introduces MINI-LLM, a novel method for efficiently pruning large language models (LLMs) by using estimated gradients from forward passes instead of computationally expensive backpropagation. This allows for memory-efficient structured pruning that maintains high performance across various LLMs and tasks, outperforming existing gradient-free methods while using comparable GPU memory.
What Problem Does This Paper Address?
Large Language Models (LLMs) have become incredibly powerful but also prohibitively large, leading to significant computational costs for storage, memory, and processing time. Model compression techniques, particularly pruning, are crucial for making these models more practical. While gradients are known to be effective for identifying important weights in smaller networks, calculating them for LLMs via backpropagation requires immense GPU memory, making it a bottleneck. Consequently, most LLM pruning methods resort to gradient-free criteria like weight magnitudes, which may not be optimal. This paper aims to bridge this gap by enabling gradient-guided pruning in an LLM-friendly, memory-efficient manner.
Methods
The core innovation of MINI-LLM lies in its Memory-effIcieNt structured prunIng (MINI-LLM) procedure. Instead of full backpropagation, it employs Zeroth-Order (ZO) gradient estimation using only forward passes. This significantly reduces memory requirements.
The paper also introduces a novel pruning criterion called Feature Map Sensitivity (FMS) score. This hybrid criterion intelligently combines:
- Weight Magnitude: The inherent importance of a weight.
- Activation: The sensitivity of a feature map to changes, acknowledging that LLMs have outlier activations that significantly impact performance.
- Estimated Gradients: Information derived from forward passes to approximate the impact on the global loss.
MINI-LLM performs structured pruning, focusing on removing entire channels in Feed-Forward Networks (FFNs) and attention heads in Multi-Head Attention (MHA) modules, which directly reduces model size and enables hardware acceleration. After pruning, a low-rank approximation (LoRA) fine-tuning step is used for performance recovery, further minimizing memory usage.
Datasets
The paper evaluates MINI-LLM on several standard datasets for various NLP tasks:
- Language Generation/Modeling: WikiText2, PTB (Penn Treebank)
- Classification/Multiple-Choice (Common Sense Reasoning): BoolQ, PIQA, HellaSwag, WinoGrande
- Few-Shot Learning: MMLU (Massive Multitask Language Understanding)
- Fine-tuning: Alpaca-cleaned dataset
Key Insights and Ideas
- Gradient-Guided Pruning is Possible (and Beneficial) without Backprop: The most significant insight is demonstrating that valuable gradient information can be approximated using forward passes (ZO gradients), making it feasible for LLM pruning without prohibitive memory costs.
- Feature Map Sensitivity (FMS) is a Powerful Criterion: Combining magnitude, activation, and estimated gradients provides a more nuanced understanding of a feature map's importance than any single factor alone. The inclusion of activation specifically addresses a known characteristic of LLMs.
- Structured Pruning for Practical Gains: By targeting channels and attention heads, MINI-LLM achieves actual model size reduction and potential inference speedups, unlike unstructured pruning which often requires specialized hardware.
- MINI-LLM is Versatile: The method performs well across different LLM architectures (LLaMA, BLOOM, OPT) and a range of downstream tasks, highlighting its general applicability.
Key Results
- Performance Superiority: MINI-LLM consistently outperforms gradient-free methods (like Wanda and magnitude-based pruning) across various prune ratios (20% to 50%) on LLaMA-7B, BLOOM-7B, and OPT-6.7B.
- Competitive with Backprop-based Methods: MINI-LLM's performance closely matches or even surpasses that of LLM-Pruner (a backpropagation gradient-based method) on several tasks and datasets. For example, at a 40% prune ratio on LLaMA-7B, MINI-LLM achieved a higher average accuracy than LLM-Pruner.
- Memory Efficiency: Crucially, MINI-LLM maintains a GPU memory footprint comparable to gradient-free methods, significantly lower than LLM-Pruner. For LLaMA-7B pruning, it uses about half the GPU memory of LLM-Pruner.
- Pruning Larger Models: The method is shown to be effective for larger models like LLaMA-13B, demonstrating scalability.
- Reduced Inference Time: At a 50% prune ratio, MINI-LLM reduced total inference time to 58% and GPU memory usage to 50% of the original model.
Limitations and Future Work
- High Prune Ratios: Similar to other methods, MINI-LLM experiences a performance decline at very high prune ratios (e.g., 50%), indicating that structurally pruning LLMs under extreme compression remains a challenge.
- Future Work: The authors aim to further enhance the pruning results of MINI-LLM at even higher compression rates. They also suggest exploring the impact of different layer ranges for pruning, though their current experiments focus on a fixed set of layers (layers 4-29 for LLaMA-7B).
Summary updated