Triple-Compressed BERT for Efficient Implementation on NLP Tasks
Zhipeng Peng, Yongjie Zhao · 2023
Transformer-based models, exemplified by BERT, have significantly elevated the performance of Natural Language Processing (NLP) tasks, setting new benchmarks in accuracy, as demonstrated on GLUE and SQuAD. However, the large memory footprint and latency of BERT-based models present significant challenges for real-time applications. This paper introduces a novel compression strategy for BERT, synergistically combining knowledge distillation, layer pruning, and quantization. Focusing on the MNLI downstream task as a case study, the proposed approach not only maintains competitive performance but also significantly reduces model size and inference time. Specifically, our most optimized model, despite being approximately 8.06x smaller and around 9.5x faster than the original BERT, incurs only minor accuracy degradations of up to 6.5% and 6.6% on the matched and mismatched MNLI tasks, respectively. Our findings highlight the value of using a variety of compression techniques to enhance BERT-based models. The suggested method offers a potentially effective way to deal with the memory and latency issues brought on by BERT, creating opportunities for resource-effective language models for a range of NLP applications. By advancing the field of model compression through a synergistic approach to compressing BERT, this research provides a pragmatic strategy to enhance the deployability and effectiveness of language models, ultimately paving the way for more efficient and effective language models.