Abstract
MaskPrune is a novel structured pruning framework for Large Language Models (LLMs) that enforces layer-wise uniform structures. By framing pruning as a minimax optimization problem, it achieves state-of-the-art performance while ensuring the resulting model is easy to deploy on standard hardware and efficient to further fine-tune.
Introduction: The Problem of Heterogeneity
As Large Language Models (LLMs) grow in size, deployment costs escalate. Structured pruning—removing entire components like attention heads or feed-forward network (FFN) dimensions—is a popular solution because it results in dense matrices compatible with standard hardware.
However, most current optimization-based pruning methods (e.g., Compresso, NutePrune) prioritize performance by allowing different layers to have varying levels of sparsity. This results in "heterogeneous" structures where, for example, one layer might retain 32 heads while another retains only 4. Such irregularity is inefficient for hardware accelerators and complicates standard model-parallelism techniques. MaskPrune addresses this by enforcing a uniform structure across all layers.
Methods: Mask-based Optimization
The core of MaskPrune is a minimax optimization paradigm. Instead of simply selecting weights to remove, the framework jointly trains pruning masks ($m$) and target structures ($s$).
Key Technical Components
- Minimax Framework: A loss function is defined to minimize training loss with respect to masks while maximizing the penalty for violating sparsity and resource constraints.
- Proximal Gradient Updates: To handle the non-differentiable nature of sparsity constraints, proximal operators iteratively decay mask values toward zero.
- Straight-Through Estimator (STE): STE is employed to allow gradients to flow through non-differentiable ceiling functions used for discrete sparsity levels.
- LoRA & Distillation: Low-Rank Adaptation (LoRA) updates weights and knowledge distillation ensures the pruned "student" model mimics the original "teacher" model's hidden representations.
- Uniformity Constraint: MaskPrune optimizes for a specific number of heads and dimensions applied identically across all layers, avoiding the competition for a global sparsity budget seen in previous methods.
Datasets and Evaluation
- Training/Calibration: 20,000 data instances (512 tokens each) sampled from the C4 (Colossal Clean Crawled Corpus) dataset.
- Language Modeling: Perplexity measured on Wikitext2.
- Zero-Shot Benchmarks: Evaluated via
lm-evaluation-harnesson tasks including BoolQ, PIQA, HellaSwag, WinoGrande, ARC-easy, ARC-challenge, and OpenbookQA.
Key Insights
- Hardware-Friendly Uniformity: The performance trade-off for uniformity is minimal. Enforcing a uniform structure allows pruned models to utilize off-the-shelf inference kernels without custom engineering.
- Masks as Scaling Factors: During optimization, masks act as continuous scaling factors, allowing a "soft" transition from dense to sparse and enabling remaining weights to compensate for shrinking dimensions.
- Superiority of Uniform Masks: Comparisons showed that a standard uniform distribution mask outperformed $L_0$ regularization by allowing a smoother transition during the pruning process.
Key Results
MaskPrune consistently outperformed existing state-of-the-art (SOTA) methods like LLM-Pruner and Compresso across Llama-1 and Llama-2 models (7B and 13B).
- Llama-7B (20% Sparsity): MaskPrune achieved an average zero-shot score of 61.17, outperforming Compresso (60.75) and a uniform version of NutePrune (60.59).
- Llama-7B (50% Sparsity): The performance gap widened significantly; MaskPrune maintained a perplexity of 19.33, while LLM-Pruner and Compresso rose to 98.10 and 59.73, respectively.
- Larger Models: On 13B models at 20% sparsity, the method maintained 94-95% of the original model's zero-shot capabilities with no significant increase in perplexity.
Limitations and Future Work
The primary limitation is data dependency. The effectiveness of mask learning relies heavily on the quality of the 20,000 calibration samples from the C4 dataset. Future work will focus on developing more robust strategies for selecting optimal calibration datasets to improve generalization across diverse tasks.
Summary updated