[Paper Review] Streamlining Redundant Layers to Compress Large Language Models
This paper proposes LLM-Streamline, a novel pruning method that identifies and removes less important consecutive layers in large language models (LLMs) based on cosine similarity between input and output hidden states, then replaces them with a lightweight MLP. The method achieves up to 92% classification performance and 68% generation performance at 25% parameter reduction, outperforming prior state-of-the-art pruning techniques.
This paper introduces LLM-Streamline, a pioneer work on layer pruning for large language models (LLMs). It is based on the observation that different layers have varying impacts on hidden states, enabling the identification of less important layers to be pruned.LLM-Streamline comprises two parts: layer pruning, which removes consecutive layers with the lowest importance based on target sparsity, and layer replacement, a novel module that trains a lightweight network to replace the pruned layers to mitigate performance loss. Additionally, a new metric called stability is proposed to address the limitations of the widely used accuracy metric in evaluating model compression. Experiments show that LLM-Streamline outperforms both previous and concurrent state-of-the-art pruning methods in terms of both performance and training efficiency.Our code is available at https://github.com/RUCKBReasoning/LLM-Streamline
Motivation & Objective
- To address the high hardware cost and deployment barriers of large language models (LLMs) due to their large parameter counts.
- To investigate whether consecutive layers in LLMs can be identified as redundant based on their minimal impact on hidden states.
- To develop a structured, hardware-friendly pruning method that maintains high performance after compression.
- To evaluate the effectiveness of lightweight models—especially MLPs—in replacing pruned transformer layers.
- To demonstrate that layer pruning with replacement outperforms direct removal or other compression techniques.
Proposed method
- Measures layer importance using cosine similarity between input and output hidden states of each layer.
- Identifies and removes consecutive layers with the lowest cosine similarity, indicating minimal perturbation on hidden states.
- Replaces the pruned layers with a lightweight model, such as a multi-layer perceptron (MLP), trained on a small dataset of tens of thousands of samples.
- Employs a two-stage process: layer pruning based on target sparsity, followed by training a lightweight model to restore performance.
- Evaluates multiple lightweight models including standard and parameter-shared MLPs and transformer layers for replacement.
- Uses a small, diverse dataset for fine-tuning the lightweight model to ensure generalization and performance recovery.
Experimental results
Research questions
- RQ1Can consecutive layers in LLMs be identified as less important based on their minimal impact on hidden states?
- RQ2Does replacing pruned layers with a lightweight model like an MLP effectively recover performance loss from pruning?
- RQ3How does the performance of LLM-Streamline compare to existing state-of-the-art pruning methods in terms of accuracy and parameter efficiency?
- RQ4What is the optimal choice of lightweight model (e.g., MLP vs. transformer layer) for replacing pruned layers in terms of accuracy and parameter count?
- RQ5How does the amount of fine-tuning data affect the performance of the lightweight replacement model?
Key findings
- For 7B-parameter models, LLM-Streamline maintains 92% of the original model’s performance on classification tasks at a 25% parameter reduction.
- On generation tasks, the method preserves 68% of the original model’s performance under the same 25% sparsity setting.
- A single MLP trained on just tens of thousands of data points can effectively replace multiple consecutive transformer layers with minimal performance drop.
- Using multiple MLPs instead of one increases parameter count without improving performance, confirming the efficiency of a single lightweight model.
- Replacing pruned layers with a lightweight model is essential—direct removal causes a significant performance drop, proving the necessity of replacement.
- Among tested lightweight models, a single MLP outperforms more complex alternatives like shared-parameter transformers, despite having fewer parameters.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.