Abstract
EfficientBERT addresses the computational bottleneck of large-scale pre-trained language models by shifting optimization focus from Multi-Head Attention (MHA) to Feed-Forward Networks (FFNs), which account for approximately 70% of BERT's latency. By employing a three-stage "coarse-to-fine" Neural Architecture Search (NAS) and a novel warm-up distillation strategy, the authors developed a model that is 6.9x smaller and 4.4x faster than BERT-base while maintaining competitive accuracy. EfficientBERT achieves an average GLUE score of 77.7, outperforming existing compressed models like MobileBERT-tiny and TinyBERT4.
Introduction
While large-scale models like BERT have set new benchmarks in NLP, their deployment on edge devices is hindered by high latency and memory requirements. Previous compression efforts primarily targeted Multi-Head Attention. However, this paper identifies that the Feed-Forward Network (FFN) is the primary driver of latency, costing 2–3 times more than attention layers. FFNs are crucial for maintaining model expressivity and preventing "rank collapse." EfficientBERT aims to find the optimal MLP architecture that balances nonlinearity with computational efficiency.
Methodology: Progressive Search and Warm-up KD
The EfficientBERT framework utilizes a progressive search strategy to navigate a rich search space encompassing mathematical operations (e.g., GeLU, Tanh), stack numbers, and expansion ratios.
The search process is divided into three "coarse-to-fine" stages:
- Stage 1: Broad exploration across all factors (operations, stacks, and ratios).
- Stage 2: Structural parameters (stacks/ratios) are fixed while mathematical operations are fine-tuned.
- Stage 3: Operations are fixed to optimize final stack numbers and expansion ratios for peak performance.
To mitigate the cost of training thousands of candidates from scratch, the authors introduced Warm-up Knowledge Distillation (KD). A "supernet" containing all possible sub-architectures is pre-trained, allowing candidate models to "inherit" weights for rapid evaluation. In the final stage, multi-task learning ensures robust transferability across diverse NLP tasks.
Experimental Results
EfficientBERT was evaluated on the GLUE benchmark and SQuAD datasets after pre-training on English Wikipedia and BooksCorpus.
Performance Highlights
- Efficiency: EfficientBERT is 6.9x smaller (9.4M parameters vs 108.9M) and 4.4x faster than BERT-base.
- GLUE Benchmark: It achieved an average score of 77.7, surpassing MobileBERT-tiny (77.0) and TinyBERT4 (75.0).
- SQuAD v1.1: The model reached an F1 score of 83.6, a 3.2-point improvement over TinyBERT4, notably without requiring the extensive data augmentation techniques typically used by competitors.
Key Insights
- FFN as the Primary Target: Targeting FFNs provides higher leverage for compression than attention mechanisms, as they represent the bulk of computational cost.
- Preserving Nonlinearity: Visual analysis of FFN mapping shows that searched models maintain smooth nonlinearity curves similar to BERT-base. In contrast, randomly shrunk models exhibit "jagged" curves that correlate with poor performance.
- Search Efficiency: The three-stage progressive shrinking approach saved 26 GPU days compared to standard single-stage NAS, proving that warm-up weight inheritance is a practical path for large-scale model optimization.
Conclusion and Future Work
EfficientBERT demonstrates that optimizing the MLP component of Transformers is a highly effective path toward efficient NLP. While the current model is hardware-agnostic, future research may involve hardware-aware NAS to optimize for specific mobile NPUs and exploring dynamic architectures that adapt complexity based on input difficulty.
Summary updated