arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2203.07259cs.CLcs.LG
收藏

最优BERT Surgeon:大语言模型的可扩展和精确二阶剪枝

The Optimal BERT Surgeon: Scalable and Accurate Second-Order Pruning for Large Language Models

Institute of Science and Technology Austria(奥地利科学技术研究所);Neural Magic Inc.(Neural Magic公司);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Eldar Kurtic, Daniel Campos, Tuan Nguyen, Elias Frantar, Mark Kurtz, Benjamin Fineran, Michael Goin, Dan Alistarh

摘要:

基于转换器的语言模型已经成为自然语言处理的关键构件。虽然这些模型非常准确,但它们可能太大且计算密集,无法在标准部署上运行。已知各种压缩方法,包括蒸馏、量化、结构化和非结构化修剪,以减小模型大小并提高推理速度,同时具有低精度损失。在这方面,本文的贡献是双重的。我们对BERT模型的非结构化权重修剪的精度-压缩权衡进行了深入研究。我们介绍了最佳BERT外科医生(oBERT),一个有效的和准确的权重修剪方法的基础上近似二阶信息,我们表明,产生国家的最先进的结果在两个阶段的语言任务:预训练和微调。具体而言,oBERT扩展了现有的工作,非结构化的二阶修剪,允许修剪块的权重,并适用于在BERT规模。其次,我们研究了这种修剪方法在复合压缩方法时的影响,以获得高度压缩但准确的模型,用于在边缘设备上部署。这些模型在所有指标方面都大大突破了当前最先进的稀疏BERT模型的界限:模型大小、推理速度和任务准确性。例如,相对于密集BERT库,我们获得了10倍的模型大小压缩(MB),精度下降< 1%,10倍的CPU推理加速,精度下降< 2%,29倍的CPU推理加速,精度下降< 7.5%。我们的代码与Transformers和SparseML完全集成,可以在https://github.com/neuralmagic/sparseml/tree/main/research/optimal_BERT_surgeon_oBERT上找到。

英文摘要:

Transformer-based language models have become a key building block for natural language processing. While these models are extremely accurate, they can be too large and computationally intensive to run on standard deployments. A variety of compression methods, including distillation, quantization, structured and unstructured pruning are known to decrease model size and increase inference speed, with low accuracy loss. In this context, this paper's contributions are two-fold. We perform an in-depth study of the accuracy-compression trade-off for unstructured weight pruning of BERT models. We introduce Optimal BERT Surgeon (oBERT), an efficient and accurate weight pruning method based on approximate second-order information, which we show to yield state-of-the-art results in both stages of language tasks: pre-training and fine-tuning. Specifically, oBERT extends existing work on unstructured second-order pruning by allowing for pruning blocks of weights, and by being applicable at the BERT scale. Second, we investigate the impact of this pruning method when compounding compression approaches to obtain highly compressed but accurate models for deployment on edge devices. These models significantly push boundaries of the current state-of-the-art sparse BERT models with respect to all metrics: model size, inference speed and task accuracy. For example, relative to the dense BERT-base, we obtain 10x model size compression (in MB) with < 1% accuracy drop, 10x CPU-inference speedup with < 2% accuracy drop, and 29x CPU-inference speedup with < 7.5% accuracy drop. Our code, fully integrated with Transformers and SparseML, is available at https://github.com/neuralmagic/sparseml/tree/main/research/optimal_BERT_surgeon_oBERT.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑