TL;DR
This paper introduces SP³, a novel structured pruning technique that effectively reduces the hidden dimension ($d$) of pre-trained language models (PLMs) by projecting features onto their principal components before pruning. This approach achieves significant compression (70% reduction in $d$, 94% model parameter reduction) while maintaining high accuracy, outperforming existing methods.
What Problem Does This Paper Address?
Pre-trained language models (PLMs) like BERT, GPT, and Llama have achieved remarkable performance but suffer from large model sizes and high computational costs, hindering their deployment. While various compression techniques exist, current structured pruning methods often overlook the significant potential of compressing the hidden dimension ($d$) – a key factor in model size and efficiency. Existing methods primarily focus on pruning attention heads or intermediate feed-forward network dimensions, leading to limited compression of $d$. This paper aims to address this gap by proposing a method that effectively targets and compresses the hidden dimension.
Methods
The core of SP³ lies in PCA Projection. Instead of directly pruning the hidden dimensions, SP³ first projects the features into a new space defined by their principal components. This is achieved by:
- Collecting Calibration Data: A subset of the training data is used.
- Extracting Feature Matrices: For each layer, feature matrices are derived from MHA and FFN blocks.
- PCA Decomposition: Singular Value Decomposition (SVD) is applied to these matrices to obtain principal components.
- Projection Matrix Creation: These principal components form a projection matrix.
- Feature Projection: Input features are projected onto this new space.
- Masked Pruning: Standard mask-based structured pruning is then applied in this projected space, making it more effective to eliminate less important dimensions while preserving the principal components.
SP³ also introduces layer-adapted structured pruning by allowing variable hidden dimensions across different layers through linear transformations in residual connections. This addresses the constraint that residual connections require identical input and output dimensions.
Datasets
The authors evaluate their method on standard NLP benchmarks:
- GLUE: A collection of tasks including SST-2, MNLI, QQP, QNLI, MRPC, STS-B, and RTE.
- SQuAD v1.1: A question answering dataset.
They also mention experiments on OPT-125m and TinyLlama, indicating the method's applicability to larger language models.
Key Insights and Ideas
- Hidden Dimension is Key: The hidden dimension ($d$) is a critical but underexplored target for model compression.
- PCA for Feature Space: Projecting features onto their principal components (via PCA) creates a more amenable space for effective structured pruning.
- Layer-wise Adaptability: Different layers have varying importance and feature distributions, necessitating layer-specific compression strategies, which SP³ enables.
- Preserving Principal Components: By pruning in the PCA-transformed space, SP³ better preserves the underlying structure and importance of features.
Key Results
- Significant Compression: SP³ reduces the hidden dimension ($d$) by up to 70% and achieves 94% parameter sparsity on the BERTbase model.
- High Accuracy: The compressed BERTbase model maintains over 96% accuracy on benchmarks.
- Outperforms Baselines: SP³ shows a 6% accuracy improvement compared to other methods that compress $d$ at the same sparsity level.
- LLM Compatibility: The method is effective on larger models like OPT-125m and Llama.
- Structural Insights: Pruning tends to be more aggressive in later layers, and FFN intermediate dimensions are often more compressed than MHA intermediate dimensions.
Limitations and Future Work
- Extra Parameters: SP³ introduces extra weight matrices in residual parts during merging, which can account for a significant portion of the model parameters, hindering further compression. Future work aims to eliminate these extraneous parameters.
- Coarse vs. Fine-grained Pruning: The current approach uses fine-grained pruning. Balancing fine-grained pruning with coarse-grained methods (like head/layer pruning) for higher acceleration is an area for future exploration.
- Memory Overhead for LLMs: Integrating compactors during training for LLMs can lead to increased memory consumption. Research into reducing this overhead is needed.
- Tuning-Free Pruning: The current tuning-based pruning technique might face overfitting challenges with limited SFT data. Investigating a tuning-free approach is warranted.
Summary updated