SP³: Enhancing Structured Pruning via PCA Projection

Yuxuan Hu, Jing Zhang, Zhe Zhao, Chen Zhao, Xiaodong Chen, Cuiping Li, Hong Chen

Abstract

Structured pruning is essential for deploying Large Language Models (LLMs) on resource-constrained devices. However, pruning the hidden dimension ($d$) has traditionally been challenging due to information entanglement. This paper introduces SP³ (Structured Pruning with PCA Projection), a method that projects features into a PCA-defined space to isolate important dimensions. By applying a three-phase workflow—PCA projection, layer-adapted pruning with residual transformations, and weight fusion—SP³ achieves significant compression with minimal performance loss. Experiments on BERT-base show a 94% parameter reduction while maintaining 96% of original accuracy, outperforming existing state-of-the-art methods.

What Problem Does This Paper Address?

In the optimization of Large Language Models (LLMs), "structured pruning" involves removing entire architectural components like rows, columns, or attention heads to improve inference speed and reduce memory footprint. While pruning attention heads and feed-forward network (FFN) filters is well-established, researchers have struggled to effectively prune the hidden dimension ($d$).

The hidden dimension represents the "width" of the information flow. Pruning it is notoriously difficult because information is typically distributed across the entire feature space. In the original coordinate system, removing a single dimension is akin to removing a specific ingredient from a baked cake—it fundamentally compromises the integrity of the whole. Consequently, most existing pruning methods avoid $d$, leaving significant potential for efficiency gains untapped.

Methods

The authors introduce SP³, which stands for Structured Pruning with PCA Projection. The framework follows a three-phase pipeline to enable aggressive yet accurate compression.

The three-phase SP³ workflow: PCA Projection, Model Pruning, and Model Fusing.
  1. PCA Projection: Instead of pruning in the original feature space, SP³ utilizes Singular Value Decomposition (SVD) on a small set of calibration data to identify the "Principal Components" of the features ($U, \Sigma, V^T = SVD(X)$). It then projects the features into this new space where the most critical information is concentrated in a few high-variance dimensions.
  2. Model Pruning: With information now "sorted" by importance, the model employs learnable masks to identify and remove the least significant dimensions. To handle the rigid requirements of residual connections ($x + \text{Layer}(x)$), the authors introduce linear transformations in the residual path. This allows different layers to adopt different hidden dimensions (layer-adapted pruning) without breaking the architecture.
  3. Model Fusing: After training, the projection matrices and masks are mathematically fused back into the original weight matrices. This ensures the final compressed model incurs zero additional computational overhead from the PCA step during inference.

Key Insights and Ideas

  • The "Space" Matters: The core insight is that dimensions in the original feature space are highly entangled. By rotating the coordinate system via PCA to align with the data's actual variance, "unimportant" dimensions become easier to isolate and prune without collateral damage.
  • Layer Variability: The authors observed that the subspace containing the most important information shifts from layer to layer. This justifies the use of layer-adapted pruning rather than forcing a uniform width across the entire model.
  • Residuals as a Bottleneck: Standard Transformers require matching input/output dimensions for residual connections. SP³ bypasses this by inserting a small "compactor" matrix in the residual path, enabling aggressive internal pruning while maintaining connectivity.
Intuition behind PCA projection: concentrating information into fewer dimensions to facilitate pruning.

Key Results

  • Extreme Compression: SP³ reduced the hidden dimension of BERT-base by 70%, leading to a total parameter reduction of 94% (shrinking the model to approximately 5M parameters).
  • Superior Accuracy: At the 5M parameter scale, SP³ maintained 96% of BERT's original performance, outperforming the previous state-of-the-art method (CoFi) by a significant 6% margin in accuracy.
  • Real-world Speedups: The compressed models demonstrated inference speedups ranging from 2.5x to 5.5x across various GLUE tasks.
  • Scalability: Beyond BERT, the method proved effective for modern architectures including OPT-125m and TinyLlama, showing strong results on commonsense reasoning benchmarks like Hellaswag and PIQA.

Limitations and Future Work

While highly effective, the "compactor" matrices in the residual connections do add some parameter overhead; in the 5M parameter BERT model, these account for nearly half of the remaining parameters. Additionally, while the current method focuses on coarse-grained pruning for immediate hardware acceleration, the authors suggest that future work should explore balancing fine-grained pruning with hardware-friendly structures. Finally, for massive models (70B+), the authors propose investigating "tuning-free" versions of SP³ to reduce the memory intensity of the pruning phase.

Summary updated

BibTeX
@inproceedings{hu2024sp,
  author = {Yuxuan Hu and Jing Zhang and Zhe Zhao and Chen Zhao and Xiaodong Chen and Cuiping Li and Hong Chen},
  title = {{SP³: Enhancing Structured Pruning via PCA Projection}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.187},
}
Figure