NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Simple Linear Patch Revives Layer-Pruned Large Language Models

Xinrui Chen, Haoli Bai, Tao Yuan, Ruikang Liu, Kang Zhao, Xianzhi Yu, Lu Hou, Tian Guan, Yonghong He, Chun Yuan

Abstract

Layer pruning is a straightforward way to shrink Large Language Models (LLMs), but it typically causes a massive drop in accuracy. This paper identifies the culprit as a "magnitude mismatch" at the pruning interface and fixes it with LinearPatch, a lightweight, fused matrix that aligns activation scales and smooths out outliers. The result is a compressed model that retains over 95% of its original performance with just 30 minutes of fine-tuning on a single GPU.

Introduction

As LLMs grow, the cost of running them becomes prohibitive. Researchers use "layer pruning"—simply deleting entire Transformer blocks—to make models faster and leaner. Unlike weight pruning, which requires specialized hardware kernels to see speedups, layer pruning works "out of the box" on any hardware. However, removing layers often leads to a total collapse in model performance. This work investigates why this happens and proposes a simple, effective remedy.

The Magnitude Mismatch Problem

The authors discovered that the primary reason for performance collapse isn't just the loss of information, but a distributional shift: the activations coming out of a layer before the cut have a completely different scale (magnitude) than what the layer after the cut expects. When layers are removed, the preceding layer feeds directly into a non-adjacent subsequent layer. These layers were never trained to interface. This "volume mismatch" propagates through the model, leading to nonsensical outputs.

Visualizing the magnitude mismatch and the impact of scaling on perplexity.

As shown in the figure above, the magnitude of activations shifts significantly at the pruning point. Adjusting the "gain" of the signal (scaling) can recover a shocking amount of lost logic, as evidenced by the sharp drop in perplexity when the scaling factor $\alpha$ is optimized.

Methods: The LinearPatch

The authors introduce LinearPatch, a plug-and-play linear layer inserted at the cut point. It performs two key operations fused into a single matrix multiplication:

  1. Hadamard Transformation: LLMs often have "massive outliers"—specific tokens or channels with values orders of magnitude higher than others. These outliers make simple scaling difficult. The Hadamard transform acts like a mathematical "prism," rotating the activations to redistribute and smooth these spikes across all channels.
  2. Channel-wise Scaling: Once the outliers are smoothed, the patch applies a scaling factor to every channel to ensure the signal matches the subsequent layer's expectations.
Distribution of token-wise scalings before and after rotation into the Hadamard space.

The figure above illustrates how the rotation space significantly reduces the variance ($\sigma_d$) of token-wise scalings, making the distribution much more "well-behaved" for subsequent scaling.

Memory-Efficient Offline Distillation

To further boost performance, the authors use Memory-Efficient Offline Distillation. They take a small set of unlabeled data (5,000 samples) and "teach" the pruned model to match the output probabilities (logits) of the original unpruned model. By only updating the small LinearPatch matrix and keeping the rest of the model frozen, this process is incredibly fast and memory-light, allowing a 7B model to be refined in 30 minutes on a single V100 GPU.

Key Results

The researchers evaluated LinearPatch across several popular open-source LLMs including LLaMA-2, LLaMA-3, Baichuan2, and DeepSeek-R1-Distill.

  • LLaMA-3-8B: When pruning 5 out of 32 layers, LinearPatch retained 95.16% of the original performance, significantly outperforming previous state-of-the-art methods.
  • Rescuing "Collapsed" Models: In aggressive pruning scenarios where previous methods caused perplexity to explode, LinearPatch consistently "revived" the models to functional levels.
  • Zero Latency Overhead: Because the Hadamard transform and scaling are fused into one symmetric matrix, the patch adds virtually zero latency during inference. It is also $8\times$ smaller in parameter count than competing replacement modules.

Conclusion

The degradation in pruned models is largely a communication issue. By simply adjusting the internal signal's magnitude and smoothing outliers with a LinearPatch, we can recover most of the performance lost during layer pruning. This method offers a highly efficient path to deploying compressed LLMs without specialized hardware or extensive retraining.

Summary updated

BibTeX
@inproceedings{chen2025simple,
  author = {Xinrui Chen and Haoli Bai and Tao Yuan and Ruikang Liu and Kang Zhao and Xianzhi Yu and Lu Hou and Tian Guan and Yonghong He and Chun Yuan},
  title = {{A Simple Linear Patch Revives Layer-Pruned Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=AwsiYZ2ets},
}
Figure