TL;DR
Instead of relying on complex mathematical heuristics to prune Large Language Models (LLMs), why not just chop out half the layers and keep training? This paper introduces LayerChop, demonstrating that simple layer removal combined with task-agnostic continued pretraining outperforms sophisticated structured and semi-structured pruning methods at the 7B scale while delivering superior inference speedups.
What Problem Does This Paper Address?
As LLMs grow, their computational footprint during deployment becomes a massive bottleneck. To make them cheaper and faster, researchers use compression techniques like quantization and pruning. However, most pruning methods were originally designed for encoder-only models (like BERT) in task-specific settings, which fundamentally breaks the general-purpose, zero-shot reasoning capabilities of modern decoder-only LLMs.
Furthermore, existing LLM pruning methods often skip post-pruning training entirely due to the extreme cost of processing LLM-scale datasets. This leaves a critical gap: can we effectively use task-agnostic continued pretraining to recover performance after structured pruning, and if so, what is the best way to prune?
Methods
The authors explore two straightforward structured pruning strategies followed by a task-agnostic continued pretraining (recovery) phase:
- LayerCHOP: Reduces model depth by deterministically dropping 50% of the layers. The authors always retain the first and last layers to preserve embedding and final projection interactions, experimenting with different internal dropping patterns.
- DimCHOP: Reduces model width by iteratively zeroing out dimensions across weight matrices using an adapted parameter-importance criterion (derived from the PLATON framework).
They also evaluate Distillation-augmented Pruning, adding standard student-teacher losses (KL-divergence and mean-squared error over intermediate states/attention maps) to see if knowledge distillation aids the recovery phase.
Datasets
- Training & Pruning: The C4 (Colossal Clean Crawled Corpus) dataset, utilizing a token budget of up to 160 billion tokens for the continued pretraining phase.
- Evaluation: Language modeling perplexity on a C4 validation set, alongside a suite of 6 zero-shot downstream tasks spanning common sense reasoning and science question answering: PIQA, Hellaswag, Winogrande, OpenBookQA, SciQ, and Arc-Easy.
Key Insights and Ideas
- Simplicity Wins: Coarse-grained layer removal combined with continued pretraining beats complex, fine-grained pruning heuristics.
- The Training-from-Scratch Baseline is Formidable: Simply training a smaller model from scratch on the same token budget serves as an incredibly tough baseline to beat. At smaller scales (300M and 1.1B parameters), pruning eventually just converges to the from-scratch baseline, challenging the traditional "train large then compress" dogma if your token budget is large enough.
- Distillation Doesn't Scale Here: While knowledge distillation is a staple for compressing BERT-style models, the authors find it is highly inefficient and actually underperforms simple language modeling loss when scaling up to large decoder-only LLMs on massive datasets.
- Depth Pruning is Highly Compute Efficient: LayerCHOP is 2× more efficient during the compression process than DimCHOP. Because LayerCHOP drops layers immediately at the start of the recovery phase, the model is instantly half the size, saving massive amounts of FLOPs on every single gradient update during continued training.
Key Results
- At the 7B scale (Llama 2), LayerCHOP outperforms popular semi-structured 2:4 pruning methods like Wanda and SparseGPT on downstream tasks.
- LayerCHOP achieves a 1.84× end-to-end inference speedup over the base Llama2-7B model, significantly outperforming the 1.24× speedup offered by 2:4 semi-structured pruning hardware acceleration.
- Compared to concurrent structured pruning methods (ShortenedLlama, SliceGPT, LLMSurgeon), LayerCHOP demonstrates the least reduction in average end-to-end task scores relative to the percentage of the model pruned (50%).
Limitations and Future Work
- High Compute Cost for Compression: Although the resulting model is highly efficient at inference time, the recovery phase requires substantial computational resources (e.g., training on 160B tokens requires multiple days of compute using 32× A100 GPUs), making it less accessible for resource-constrained labs.
- Exploration of Alternative Distillation: While standard distillation objectives failed to scale efficiently in this setup, the authors note that atypical or specialized distillation architectures might still hold promise for future investigation.
Summary updated