Abstract
The "Prune Once for All" (Prune OFA) method allows researchers to create highly compressed, sparse versions of large language models (LMs) like BERT during the pre-training phase. Once pruned, these models can be fine-tuned for any downstream task—such as question answering or sentiment analysis—while maintaining 85-90% sparsity. This approach achieves up to 40x compression with minimal loss in accuracy, significantly reducing the computational overhead of deploying specialized models.
Introduction
In Natural Language Processing (NLP), the prevailing trend of "bigger is better" has led to massive models like BERT and GPT-3. While these models offer state-of-the-art performance, their size makes them expensive to run in production and difficult to deploy on edge devices.
Weight pruning—removing unnecessary connections in a neural network—is a common technique to shrink these models. However, it is typically performed during the fine-tuning stage for specific tasks. This means that if a model is needed for five different tasks, the expensive pruning process must be repeated five times. Prune OFA addresses this inefficiency by pruning the model once during pre-training, ensuring that the resulting sparsity "sticks" across all future downstream tasks.
Methods
The Prune OFA pipeline integrates three core components to ensure robust sparsity and performance:
- Gradual Magnitude Pruning (GMP) with Learning Rate Rewinding (LRR): Weights with the smallest magnitudes are gradually removed. To mitigate the performance drop from pruning, the learning rate scheduler is periodically "rewound," allowing the network to adapt to its sparser structure.
- Knowledge Distillation: A dense, unpruned teacher model guides the sparse student model during pruning. By mimicking the teacher's output, the student maintains high accuracy despite the loss of parameters.
- Pattern-lock: During fine-tuning, a mask is applied to ensure that weights set to zero during pre-training remain zero. This "locks" the sparsity pattern while the model learns task-specific features.
Finally, these sparse models can be combined with Quantization-Aware Training (QAT), reducing weight precision from 32-bit to 8-bit for even greater compression.
Datasets and Evaluation
The researchers validated Prune OFA using the English Wikipedia dataset (2,500M words) for pre-training. Downstream performance was evaluated on industry-standard benchmarks:
- SQuAD v1.1: For question-answering tasks.
- GLUE Benchmark: Including MNLI (inference), QQP (paraphrase detection), QNLI (natural language inference), and SST-2 (sentiment analysis).
Key Insights
- Universal Sparsity: A "winning ticket" (a specific pattern of important weights) identified during general pre-training is robust enough to serve various specialized tasks, eliminating the need for task-specific pruning patterns.
- The "Large-Sparse" Advantage: A 90% sparse BERT-Large model (approx. 30M non-zero parameters) often outperforms a dense BERT-Base model (85M parameters), suggesting that pruning a larger initial model is more effective than training a smaller dense one.
- Orthogonal Compression: Pruning and quantization are complementary. They can be applied simultaneously to reach massive compression ratios (up to 40x) without interfering with each other's benefits.
Key Results
Prune OFA establishes a new state-of-the-art for the compression-to-accuracy trade-off. For BERT-Base, the method achieved 85% to 90% sparsity with less than 1% accuracy loss across most GLUE tasks.
For BERT-Large, a 90% sparse and 8-bit quantized model achieved a 40x compression ratio in its encoder while maintaining performance nearly identical to the original on SQuAD v1.1. By pruning only once, the cost of creating task-specific models is drastically reduced, making large-scale deployment of specialized BERT versions far more practical.
Limitations and Future Work
While Prune OFA excels in theoretical compression, it focuses on unstructured pruning. Many standard hardware architectures require structured pruning (removing blocks or rows) to realize actual inference speedups. Additionally, while the "prune once" approach saves downstream costs, the initial pre-training pruning remains computationally intensive. Future research may explore applying this philosophy to even larger architectures like GPT-3 or different model families beyond Transformers.
Summary updated