TL;DR
Large Language Models (LLMs) are computationally expensive, hindering their deployment. This paper introduces simple "depth pruning" methods to remove entire layers from LLMs, significantly reducing their size and computational needs. Crucially, these methods effectively preserve the "emergent abilities" of LLMs, which are complex capabilities that appear only in larger models, making them practical for real-world applications.
What Problem Does This Paper Address?
The success of LLMs has led to a critical challenge: their immense computational and memory footprints make them difficult and expensive to deploy, especially in resource-constrained environments where performance is paramount. While various "pruning" techniques exist to shrink models, much of the prior work focused on "width pruning" (removing weights within layers) or explored "depth pruning" (removing entire layers) without systematically evaluating its impact on the emergent abilities that make LLMs so powerful. These emergent abilities, such as complex reasoning and problem-solving, are not present in smaller models and are key to LLMs' utility. The paper aims to bridge this gap by proposing simple depth pruning methods and rigorously assessing their ability to retain these crucial emergent capabilities under aggressive compression.
Methods
The authors propose three "simple, problem-space-agnostic depth pruning methods" that focus on modifying the decoder layers of LLMs. These methods aim to reduce the number of layers ($n$) from the original $m$ layers, with a particular focus on aggressive pruning where $n < 7$.
- LayerCluster: This method uses k-medoids clustering on the parameters of specific module types (e.g., attention projections, feed-forward networks) within a selected range of layers. The cluster centers then define which layers to keep, effectively selecting representative layers.
- LayerMerge: This approach utilizes Principal Component Analysis (PCA) on the stacked parameters of module types across a range of layers. The first $k$ principal components are used to form new, merged layers that replace the original ones, effectively compressing information.
- LayerMergeAct: This is presented as a more advanced method that leverages a small set of calibration examples. It computes the cosine similarity between layer output activations and uses this to identify groups of layers that can be merged. This method is highlighted as being particularly effective.
Datasets
The paper uses the C4 dataset (specifically, the ODC-By license version) for calibration in the LayerMergeAct method. For evaluation, they utilize the Open LLM Leaderboard v2, specifically a curated subset called Leaderboard-Lite. This subset comprises 15 challenges from the leaderboard that exhibit high variance in performance when pruning is applied.
Key Insights and Ideas
- Depth pruning is a viable strategy for LLM deployment: The paper demonstrates that simple depth pruning methods can significantly reduce LLM size without sacrificing core capabilities.
- Emergent abilities are surprisingly resilient to aggressive depth pruning: Even when reducing LLMs to a small fraction of their original depth (e.g., fewer than 7 layers), key emergent abilities crucial for complex reasoning are largely preserved.
- LayerMergeAct shows strong performance: Among the proposed depth pruning methods, LayerMergeAct stands out for its effectiveness in retaining emergent abilities, particularly in graduate-level domain knowledge and multistep soft reasoning.
- Depth vs. Width Pruning Trade-offs: While depth pruning methods are simpler and offer hardware-agnostic acceleration, the paper notes that they generally lag behind state-of-the-art width pruning methods in terms of overall performance on the Leaderboard-Lite benchmark.
- "Prunability" might vary across LLMs: The study observes that newer LLMs like llama-3.1-8b appear less "prunable" than older ones like llama-2-7b-hf, suggesting that model architecture and training might influence how effectively they can be scaled down.
Key Results
- The proposed depth pruning methods (LayerCluster, LayerMerge, LayerMergeAct) achieve comparable or superior performance to existing depth pruning baselines on Leaderboard-Lite, especially at higher sparsities.
- For the llama-2-7b-hf base model, LayerMergeAct achieved the best overall Leaderboard-Lite performance among depth pruning methods.
- Even with aggressive pruning down to 3 layers, LayerMergeAct showed superior or comparable performance to deeper configurations, indicating that extreme depth reduction can be viable.
- While all pruning methods showed a drop in natural language understanding abilities, LayerMergeAct was most successful in retaining performance on the 'disambiguation qa' challenge.
- The paper provides tables (Table 1 and Table 2) showing accuracy scores for various pruning methods and sparsities on llama-2-7b-hf and llama-3.1-8b models, demonstrating the performance trade-offs.
Limitations and Future Work
- Task-agnostic limitations: The authors acknowledge that task-agnostic pruning methods might not be able to retain specific emerging capabilities. They suggest that future work should focus on developing targeted, task-specific pruning methods.
- Systematic benchmarks: The paper calls for more systematic benchmarks to evaluate emergent abilities at finer resolutions, which can better guide the development of pruning techniques.
- "Prunability" of newer LLMs: The observation that newer LLMs might be harder to prune suggests an interesting avenue for future research into why this is the case and how to overcome it.
- Broader impacts: The paper does not extensively discuss broader societal impacts, stating that the research is foundational and not tied to specific downstream applications, thus not seeing direct paths to negative applications.
Summary updated