SlimLLM: Accurate Structured Pruning for Large Language Models

Jialong Guo, Xinghao Chen, Yehui Tang, Yunhe Wang · DOI

Abstract

Large Language Models (LLMs) offer state-of-the-art performance but demand significant computational resources. Structured pruning is a hardware-friendly solution to reduce model size and inference latency. However, existing methods often fail to capture the complex interdependencies within model sub-modules. We present SlimLLM, a novel structured pruning framework that evaluates the importance of attention heads and Feed-Forward Network (FFN) channels holistically. By integrating Pearson similarity for attention heads, feature space analysis for FFNs, and a fast linear regression recovery technique, SlimLLM achieves superior compression with minimal accuracy loss. On LLaMA-7B, SlimLLM retains 98.7% of performance at a 20% pruning ratio without fine-tuning and significantly reduces inference latency.

Introduction

The deployment of Large Language Models (LLMs) in resource-constrained environments is hindered by their massive memory and computational footprints. Structured pruning—the removal of entire structural components like attention heads or MLP channels—is particularly effective because it results in smaller, dense matrices that are easily accelerated by standard hardware.

Despite its advantages, structured pruning is challenging. Traditional methods typically estimate importance by aggregating individual weight scores (e.g., L2 norms), which ignores the directional influence and collective behavior of weights within a module. Furthermore, recovering performance after aggressive pruning usually requires expensive retraining. SlimLLM addresses these issues by treating sub-modules as cohesive units and employing a low-cost recovery mechanism.

Methodology

SlimLLM introduces four key innovations to improve pruning accuracy and efficiency.

Overview of the SlimLLM pruning and recovery process, including Pearson Similarity for MHA and Feature Space Importance for FFN.
  1. Similarity Importance for Attention Heads: Instead of summing weight magnitudes, SlimLLM evaluates an attention head's contribution by measuring the Pearson similarity between the full model output and the output when that head is removed. A greedy search algorithm then identifies the optimal subset of heads to retain, accounting for inter-head dependencies.
  2. Feature Space Importance for FFN Channels: For FFN layers, SlimLLM applies Principal Component Analysis (PCA) to output activations to define a feature space. Channel importance is determined by the alignment (magnitude and direction) of weight vectors with these principal components, capturing essential information missed by magnitude-only metrics.
  3. Fast Linear Regression Recovery: To mitigate the immediate accuracy drop after pruning, SlimLLM applies a least-squares linear regression to the output matrices of Multi-Head Attention (MHA) and FFN layers. This "band-aid" forces the pruned layer's output to approximate the original unpruned output. This process is extremely efficient, requiring only a tiny calibration set (32 samples) and no backpropagation.
  4. Non-Uniform Layer Pruning: SlimLLM recognizes that layers contribute differently to the final representation. It assigns higher pruning ratios to "redundant" layers—those where the cosine similarity between input and output is high—while preserving the critical first and last layers.

Experimental Results

We evaluated SlimLLM on LLaMA and LLaMA-2 models across several zero-shot benchmarks, including commonsense reasoning (e.g., BoolQ, PIQA) and language modeling (WikiText2, PTB).

Performance comparison of SlimLLM against other pruning methods on LLaMA-7B across various benchmarks and pruning ratios.

As shown in the results, SlimLLM consistently outperforms existing baselines like LLM-pruner and LoRAP. At a 20% pruning ratio on LLaMA-7B, SlimLLM maintains 98.7% of the original model's average reasoning performance without any fine-tuning. Even at a 50% pruning ratio, SlimLLM (with tuning) achieves an average score of 53.16%, surpassing the LoRAP baseline.

Beyond accuracy, SlimLLM provides substantial efficiency gains. For LLaMA-7B at 50% pruning, the number of parameters is reduced from 6.7B to 3.4B. This leads to a dramatic reduction in prefill latency (from 0.3008s to 0.1034s) and a 28.5% improvement in decoding speed on an NVIDIA V100 GPU.

Conclusion

SlimLLM demonstrates that holistic importance evaluation and simple linear recovery are powerful tools for LLM compression. By moving beyond simple weight aggregation and considering the directional influence of features, SlimLLM achieves state-of-the-art results in structured pruning. Future work will focus on extending the fast linear regression technique to other parameter matrices within the transformer architecture to further enhance recovery without full-scale fine-tuning.

Summary updated

BibTeX
@inproceedings{guo2025slimllm,
  author = {Jialong Guo and Xinghao Chen and Yehui Tang and Yunhe Wang},
  title = {{SlimLLM: Accurate Structured Pruning for Large Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=2xjUkU7FDb},
}
Figure