Abstract
SparseBERT introduces a "knowledge-aware" pruning strategy that finally allows sparse Transformers to outperform their smaller, dense counterparts. By pruning during a specialized distillation phase—where a fine-tuned "teacher" guides a sparse "student"—the authors achieve 95% compression with only a 1.4% average loss in accuracy. This approach effectively bridges the gap between general language knowledge and task-specific requirements.
Introduction
In the world of Computer Vision, sparse pruning (removing individual weights) is often more efficient than structural pruning (removing entire channels). However, in Natural Language Processing (NLP), this hasn't held true. Large pre-trained models like BERT have proven notoriously difficult to prune effectively; typically, a smaller "dense" model (like TinyBERT) performs better than a heavily pruned version of the original BERT.
The authors identify a fundamental conflict in the Pre-train and Fine-tune paradigm. General language knowledge is learned during pre-training, while task-specific knowledge is learned during fine-tuning. Pruning at either stage presents a trade-off: pruning during fine-tuning risks destroying general knowledge, while pruning during pre-training lacks the task-specific context needed to identify which weights are truly expendable.
Methodology: SparseBERT
The authors propose SparseBERT, which moves the pruning process to a dedicated distillation stage. This method uses a "Teacher-Student" framework where the Teacher is a standard BERT model already fine-tuned for a specific task, and the Student is the original pre-trained BERT.
The Pruning Process
Magnitude weight pruning is applied specifically to the linear transformation matrices within the self-attention and feed-forward layers—the most overparameterized components of the Transformer. To ensure the student doesn't "forget" its general knowledge while being pruned, a complex distillation loss function is employed. This loss forces the student to mimic the teacher's embedding layers, attention matrices, and hidden representations, rather than just the final logits.
Theoretical Motivation
The core insight is that pruning should not be a post-processing step. By performing pruning during distillation, the model can adapt its remaining sparse weights to satisfy both the general language patterns it already knows and the task-specific requirements of the teacher. This effectively finds the intersection of weights useful for both domains.
Key Results and Evaluation
The researchers evaluated SparseBERT on major NLP benchmarks including GLUE and SQuAD.
- Extreme Compression: SparseBERT achieves a 20x weight and FLOPs compression, retaining only 5% of the original weights.
- Superior Accuracy: On the GLUE benchmark, SparseBERT with 5% weights achieved an average score of 75.1, outperforming TinyBERT4 (which uses 18% weights) and BERT-Tickets (which uses 30-50% weights).
- Hardware Speedup: While sparse models often struggle on standard hardware, the authors demonstrated a nearly linear speedup on specialized platforms like Moffett AI’s ANTOM, reaching over 10x inference speedup at the 20x compression ratio.
Conclusion
SparseBERT demonstrates that sparse pruning can indeed outperform structural pruning for Transformers if the pruning is integrated into the distillation process. By preserving the intersection of general and task-specific knowledge, this method achieves state-of-the-art compression ratios with minimal impact on accuracy. Future work may explore the applicability of this paradigm to even larger architectures like T5 or GPT-3.
Summary updated