Introduction
As Large Language Models (LLMs) continue to scale, the "inference bottleneck" has become a significant barrier to real-world deployment. Pruning—the process of removing redundant weights—is a primary strategy for mitigation. Specifically, (N:M) semi-structured sparsity (e.g., retaining 2 out of every 4 weights) is highly advantageous as modern hardware, such as NVIDIA’s Ampere GPUs, provides native support for 2x speedups.
However, identifying the optimal weight mask is a complex combinatorial problem. Existing approaches typically fall into two categories: rule-based methods (e.g., SparseGPT, Wanda), which are fast but often sacrifice accuracy due to local, "greedy" decision-making; and learning-based methods (e.g., MaskLLM), which treat mask selection as an optimization problem. While accurate, learning-based methods often suffer from "memory explosion," requiring hundreds of gigabytes of VRAM to store mask probabilities, making them inaccessible for most research environments.
The MaskPro Framework
MaskPro addresses these scalability issues through two primary innovations: linear-space probabilistic modeling and a refined policy gradient estimator.
Linear-Space Probabilistic Modeling
To avoid the exponential complexity of learning probabilities for every possible combination of $N$ weights out of $M$, MaskPro learns a categorical distribution over the $M$ weights themselves. By employing an $N$-way sampling without replacement strategy, the framework reduces the memory required for mask probabilities from exponential to linear complexity ($O(d)$). This allows the model to learn effective masks within a manageable memory footprint.
Refined Policy Gradient Estimator (PGE)
Training a discrete mask is challenging because the optimization signal is often obscured by the variance in data batches. MaskPro introduces a refined update rule to stabilize training:
- Loss Residuals: Instead of raw loss values, the estimator uses the difference between the current sampled mask's loss and a baseline.
- Moving Average Tracker: A tracker ($\delta$) is introduced to smooth these residuals, preventing the training process from becoming unstable due to outlier data batches.
Experimental Evaluation
The researchers evaluated MaskPro across several prominent LLMs, including LLaMA-2-7B, Vicuna-7B, DeepSeek-7B, and Gemma-7B. Models were calibrated using the C4 dataset and evaluated on zero-shot tasks via the LM-evaluation-harness, covering benchmarks such as Wikitext (perplexity), HellaSwag, RACE, PIQA, and ARC.
Key Results and Insights
MaskPro demonstrates significant improvements in both efficiency and performance compared to existing state-of-the-art methods.
- State-of-the-Art Performance: MaskPro consistently outperforms rule-based methods like SparseGPT and Wanda across downstream tasks, often by margins exceeding 2% in accuracy.
- Drastic Memory Reduction: By reducing memory overhead from 330GB to approximately 36GB, MaskPro enables learning-based pruning on a single A100 or H100 GPU. In contrast, previous methods like MaskLLM frequently encountered Out-of-Memory (OOM) errors even on multi-GPU setups for 4:8 sparsity.
- Efficiency Gains: MaskPro completes its training in roughly 10 GPU hours, representing a 120x speedup over the 1,200+ hours required by MaskLLM.
- Data Robustness: A notable finding is MaskPro's extreme robustness to data volume; it can achieve stable results with as few as one training sample, whereas prior methods required extensive datasets.
Conclusion
MaskPro makes learning-based (N:M) sparsity practical for large-scale models by solving the memory bottleneck. While the current primary time constraint is the simulation of mask sampling during training, the framework provides a scalable path for structured pruning. Future work may focus on developing specialized kernels to further accelerate the sampling process or adapting this probabilistic framework to other tasks like neural architecture search.
Summary updated