One-for-All Pruning: A Universal Model for Customized Compression of Large Language Models

Rongguang Ye, Ming Tang

Abstract

Existing pruning methods for large language models (LLMs) focus on achieving high compression rates while maintaining model performance. Although these methods have demonstrated satisfactory performance in handling a single user's compression request, their processing time increases linearly with the number of requests, making them inefficient for real-world scenarios with multiple simultaneous requests. To address this limitation, we propose a Universal Model for Customized Compression (UniCuCo) for LLMs, which introduces a StratNet that learns to map arbitrary requests to their optimal pruning strategy. The challenge in training StratNet lies in the high computational cost of evaluating pruning strategies and the non-differentiable nature of the pruning process, which hinders gradient backpropagation for StratNet updates. To overcome these challenges, we leverage a Gaussian process to approximate the evaluation process. Since the gradient of the Gaussian process is computable, we can use it to approximate the gradient of the non-differentiable pruning process, thereby enabling StratNet updates. Experimental results show that UniCuCo is 28 times faster than baselines in processing 64 requests, while maintaining comparable accuracy to baselines.

Introduction

Pruning is a critical technique for deploying Large Language Models (LLMs) on resource-constrained hardware, such as mobile devices or edge sensors. By removing redundant weights or layers, pruning reduces the model's memory footprint and increases inference speed. However, real-world deployment often involves diverse user requirements. For instance, one user might require a 70% compression rate for a high-performance edge device, while another might need 50% for a lower-power device.

Current pruning approaches generally fall into two categories: score-based and optimization-based. Score-based methods calculate layer importance once and apply it across different requests. While efficient, they often fail to capture the complex, non-monotonic interactions between layers, leading to sub-optimal performance. Optimization-based methods, such as those using evolutionary algorithms, search for the best pruning strategy for each specific request. Although they achieve high accuracy, their computational cost scales linearly with the number of requests, making them impractical for cloud providers handling hundreds of simultaneous, unique compression tasks.

The UniCuCo Framework

To bridge the gap between efficiency and effectiveness, we propose UniCuCo (Universal Model for Customized Compression). The core idea is to shift the heavy computational burden from the inference phase to a one-time training phase.

StratNet: Learning to Map Strategies

At the heart of UniCuCo is StratNet ($\phi_\theta$), a secondary neural network designed to act as a strategy mapper. Instead of performing a costly search for every new request, StratNet takes a user's request $\lambda$ (representing the desired trade-off between model size and performance) and directly predicts the optimal pruning strategy $x$.

The UniCuCo framework architecture showing the interaction between StratNet, the Gaussian Process surrogate, and the gradient flow.

Gaussian Process Surrogate and Gradient Approximation

Training StratNet presents two major challenges: the high cost of evaluating pruning strategies and the non-differentiable nature of the pruning operation itself. Evaluating a single strategy typically requires running the pruned LLM on a validation set, which is time-consuming. We address this by employing a Gaussian Process (GP) as a surrogate model. The GP approximates the performance of the pruned model, allowing for near-instantaneous evaluation during training.

Furthermore, pruning is inherently discrete—a layer is either kept or removed—which prevents standard gradient backpropagation. We overcome this "gradient dead end" by utilizing the gradient of the GP surrogate. Because the GP is a smooth, differentiable mathematical function, its gradient can serve as a proxy for the pruning process's gradient, enabling the end-to-end training of StratNet.

Experimental Results

We validated UniCuCo on several prominent LLMs, including Mistral-7B, Llama-3-8B, and Llama-2-13B, using datasets like WikiText-2 and C4 for perplexity measurements and various zero-shot tasks for reasoning evaluation.

Efficiency and Scalability

The primary advantage of UniCuCo is its remarkable efficiency in multi-request scenarios. Once StratNet is trained, generating a customized strategy for any request takes less than a second. As shown in the figure below, while the total time for optimization-based methods like EvoPress grows linearly with the number of requests, UniCuCo's processing time remains nearly constant. For 64 simultaneous requests, UniCuCo achieves a 28x speedup.

Comparison of total processing time versus the number of requests for Mistral-7B and Llama-3-8B, highlighting UniCuCo's efficiency.

Effectiveness

Despite the massive speedup, UniCuCo does not sacrifice performance. In high-sparsity scenarios (e.g., 70%), UniCuCo maintains accuracy levels comparable to state-of-the-art optimization methods and significantly outperforms traditional score-based approaches. This demonstrates that StratNet successfully learns the complex dependencies required for effective non-uniform pruning.

Conclusion and Future Work

UniCuCo introduces a paradigm shift in LLM pruning by amortizing the cost of optimization. By learning a universal strategy mapper, it enables instant, high-quality customized compression. Future work will explore scaling this approach to even larger models (70B+) and developing architecture-agnostic StratNets that can generalize across different LLM families without retraining.

Summary updated

BibTeX
@inproceedings{ye2025one,
  author = {Rongguang Ye and Ming Tang},
  title = {{One-for-All Pruning: A Universal Model for Customized Compression of Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure