Prune&Comp: Free Lunch for Layer-Pruned LLMs via Iterative Pruning with Magnitude Compensation

Xinrui Chen, Hongxing Zhang, Fanyi Zeng, Yongxian Wei, Yizhi Wang +3 more
7/24/2025
cs.CL

No official code found. Best implementation: chenxinrui-tsinghua/PruneAndComp (5 stars, MIT, last commit 2025-11-19).

Abstract

Layer pruning has emerged as a promising technique for compressing large language models (LLMs) while achieving acceleration proportional to the pruning ratio. In this work, we identify that removing any layer induces a significant magnitude gap in hidden states, resulting in substantial performance degradation. To address this issue, we propose Prune&Comp, a novel plug-and-play layer pruning scheme that leverages magnitude compensation to mitigate such gaps in a training-free manner. Specifically, we first estimate the magnitude gap caused by layer removal and then eliminate this gap by rescaling the remaining weights offline, with zero runtime overhead incurred. We further demonstrate the advantages of Prune&Comp through an iterative pruning strategy. When integrated with an iterative prune-and-compensate loop, Prune&Comp consistently enhances existing layer pruning metrics. For instance, when 5 layers of LLaMA-3-8B are pruned using the prevalent block influence metric, Prune&Comp nearly halves the perplexity and retains 93.19\% of the original model's question-answering performance, outperforming the baseline by 4.01%.

View on arXivView PDF

Code Implementations(1)

MIT

[AAAI 2026] Official PyTorch implementation of "Prune&Comp: Free Lunch for Layer-Pruned LLMs via Iterative Pruning with Magnitude Compensation"

50Shell, PythonNov 12, 202511 months agoMIT

Similar Papers

Cite this paper

@article{chen2025prunecomp,
  title  = {Prune&Comp: Free Lunch for Layer-Pruned LLMs via Iterative Pruning with Magnitude Compensation},
  author = {Xinrui Chen and Hongxing Zhang and Fanyi Zeng and Yongxian Wei and Yizhi Wang and Xitong Ling and Guanghao Li and Chun Yuan},
  year   = {2025},
  eprint = {2507.18212},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.18212v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.18212.svg)](https://codeofpaper.com/paper/2507.18212)

Discussion