Abstract
Large Language Models (LLMs) face significant deployment challenges due to their immense computational and memory requirements. While various compression techniques exist, many alter the model's internal dimensions or require expensive retraining. This paper presents LaCo (Layer Collapse), a training-free structured pruning method that reduces model size by merging consecutive transformer layers. By exploiting layer-wise similarity and utilizing a Reserving-Differences-while-Seeking-Common (RDSC) strategy, LaCo can remove up to 30% of a model's layers while maintaining over 80% of its original performance. The resulting pruned models retain their standard architecture, ensuring compatibility with existing optimization stacks and significantly improving inference throughput.
Introduction
As LLMs continue to scale, the gap between model size and available hardware resources widens. Traditional compression methods like quantization often require specialized hardware, while knowledge distillation involves computationally intensive training of smaller student models. Standard structured pruning frequently alters internal dimensions (e.g., hidden size), which can break compatibility with optimized software stacks.
Researchers from Shanghai Jiao Tong University identified a key redundancy in deep models: layer-wise similarity. Adjacent layers in modern transformers often perform highly similar transformations. LaCo leverages this observation to "fold" multiple redundant layers into one, reducing depth without changing width or architecture.
The LaCo Method: RDSC Layer Merging
The core innovation of LaCo is the Reserving-Differences-while-Seeking-Common (RDSC) Layer Merge. Instead of simply deleting layers—which creates discontinuities in the model's internal representations—or averaging weights, LaCo merges a block of $m$ consecutive layers into a single base layer $l$.
The new parameters $\theta_l^*$ are calculated by taking the base layer and adding the "differentials" (the differences) of the subsequent layers: $$\theta_l^* = \theta_l + \sum_{k=1}^m (\theta_{l+k} - \theta_l)$$
This approach effectively captures the transformation logic of multiple layers within a single set of parameters, preserving the "incremental" work performed by the original sequence of layers.
Iterative Pruning Workflow
LaCo employs an iterative search strategy to determine which layers can be safely collapsed. The process begins from the rear (top) layers of the model and proceeds as follows:
- Block Selection: The algorithm attempts to merge a block of layers into one.
- Similarity Evaluation: A small calibration set (e.g., a few sentences from Wikipedia) is used to compare the output of the pruned model against the original.
- Thresholding: If the cosine similarity ($s$) between the outputs exceeds a predefined threshold ($T$), the merge is accepted.
- Adjustment: If the similarity is too low, the algorithm reduces the block size or moves to the next candidate layer.
Because LaCo only removes entire layers, the pruned model remains a standard Transformer, requiring no specialized kernels for inference.
Experimental Results
The authors evaluated LaCo on Llama2 and Baichuan2 models (7B and 13B variants) using the OpenCompass framework.
Performance and Stability
At pruning ratios of 25-30%, LaCo-pruned models maintained over 80% of their original average performance across benchmarks in reasoning, language, and knowledge. Unlike some competing methods that can cause models to "crash" at high pruning ratios, LaCo demonstrated remarkable stability.
Efficiency
One of LaCo's most significant advantages is its speed. Pruning a Llama2-7B model takes approximately 14.7 seconds on a single A100 GPU. Once pruned, the models show substantial improvements in inference throughput and reduced VRAM usage.
Post-training Recovery
While LaCo is effective as a training-free method, its performance can be further enhanced with minimal post-training. Using just 1/1000th of the original training cost, a pruned Llama2-7B was able to recover nearly all its lost performance, indicating that the collapsed structure successfully inherits the foundational knowledge of the larger model.
Conclusion
LaCo introduces a robust and efficient approach to LLM compression. By "folding" layers through parameter differentials, it achieves significant size reduction without the architectural drawbacks of traditional structured pruning. Its speed, stability, and performance retention make it a highly practical solution for deploying large models on resource-constrained hardware.
Summary updated