Adaptive Layer Sparsity for Large Language Models via Activation Correlation Assessment

Wei Li, Lujun Li, Mark G. Lee, Shengjie SunNeurIPS 2024

Introduction

Large Language Models (LLMs) are notoriously difficult to deploy due to their massive memory and computational requirements. Pruning—the process of removing less important weights—is a popular solution to compress these models. However, most existing "training-free" pruning methods apply a uniform sparsity ratio across the entire model (e.g., removing 50% of weights from every single layer).

This "one-size-fits-all" approach is suboptimal. In a deep neural network, some layers are highly redundant, capturing similar information, while others are critical for performance. Uniform pruning treats all layers equally, leading to significant performance degradation, especially at high sparsity levels. To address this, researchers have introduced Adaptive Layer Sparsity (ALS), a novel, training-free pruning framework that intelligently allocates higher sparsity to redundant layers while preserving critical ones.

How ALS Works

The ALS approach moves away from manual hyperparameter tuning and expensive retraining, relying instead on a two-phase analytical method:

Overview of the Adaptive Layer Sparsity (ALS) framework
  1. Redundancy Assessment: The authors introduce a Redundancy Metric (RM) based on the concept of information orthogonality. Using a small set of calibration data (as few as 16-256 samples), they estimate the mutual information between the outputs of different layers. If two layers are highly correlated, they are considered redundant. A layer's importance is judged by how much unique information it contributes to the model's overall flow.
  2. Linear Optimization: Instead of using a "greedy" layer-by-layer approach—which often gets stuck in local optima and suffers from error accumulation—ALS reformulates sparsity allocation as a linear programming problem.
  3. Objective: Maximize the model's representative capacity by assigning lower sparsity to independent (important) layers and higher sparsity to redundant ones.
  4. Constraints: The total number of parameters must stay below a target budget (e.g., 50% of the original size).

This method is hierarchical; it can determine sparsity for entire layers and then drill down to specific components within a layer, such as the Query, Key, or Value matrices in the attention block. Remarkably, ALS is highly efficient: it can determine the global sparsity configuration for a 70B parameter model in just 20 minutes on a single A100 GPU.

Experimental Setup and Key Insights

The authors validated ALS across several model families, including LLaMA-V1, V2, V3, and OPT, ranging from 6.7B to 70B parameters. They used a small subset of the C4 dataset for calibration, and evaluated performance using perplexity on WikiText-2 and zero-shot accuracy across seven tasks from the EleutherAI LM Harness (e.g., Winogrande, PIQA, HellaSwag).

A key insight from the experiments is the unique redundancy pattern of newer models. For instance, LLaMA-V3 8B has a distinct structure where shallow layers are much less redundant compared to its predecessors. This explains why uniform pruning fails spectacularly on V3, and why ALS's adaptive approach is highly effective.

Key Results

ALS consistently outperforms state-of-the-art uniform pruning methods like Wanda and SparseGPT. The performance gap between ALS and uniform methods widens as sparsity increases (e.g., at 70% sparsity), suggesting ALS is significantly better at preserving the "core" logic of the model.

Zero-shot accuracy comparison across various LLMs at 50% sparsity

For example, on LLaMA-V3 8B at 50% sparsity, ALS improved zero-shot accuracy by over 14% compared to standard Magnitude pruning, and nearly 10% over SparseGPT. Furthermore, when combined with LoRA (Low-Rank Adaptation) fine-tuning, ALS-pruned models recovered even more performance, demonstrating that the adaptive structure provides a superior foundation for recovery than uniform pruning.

Limitations and Future Work

While highly effective, ALS does have limitations. Calculating the redundancy matrix for every individual component (intra-layer granularity) increases the matrix size significantly ($O(L^2)$), which can be computationally complex. Additionally, high-dimensional matrix computations can be memory-intensive, potentially hitting hardware limits on smaller systems. Future work will investigate the relationship between global layer sparsity and individual weight importance more deeply, potentially integrating dynamic sparsity directly into the pruning metrics themselves.

Summary updated

BibTeX
@inproceedings{li2024adaptive,
  author = {Wei Li and Lujun Li and Mark G. Lee and Shengjie Sun},
  title = {{Adaptive Layer Sparsity for Large Language Models via Activation Correlation Assessment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Jup0qZxH7U},
}
Figure