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

一次性剪枝:稀疏预训练语言模型

Prune Once for All: Sparse Pre-Trained Language Models

Intel Labs(英特尔实验室);Intel Corporation(英特尔公司)

Ofir Zafrir, Ariel Larey, Guy Boudoukh, Haihao Shen, Moshe Wasserblat

摘要:

基于转换器的语言模型在自然语言处理中有着广泛的应用。然而,它们效率低下,难以部署。近年来,已经提出了许多压缩算法,以提高目标硬件上基于transformer的大型模型的实现效率。在这项工作中,我们提出了一种新的方法来训练稀疏的预训练Transformer语言模型集成权重修剪和模型蒸馏。这些稀疏的预训练模型可用于广泛任务的迁移学习,同时保持其稀疏模式。我们使用三种已知的架构来演示我们的方法,以创建稀疏的预训练BERT-Base,BERT-Large和DistilBERT。我们展示了我们训练的压缩稀疏预训练模型如何将其知识转移到五个不同的下游自然语言任务中,并且精度损失最小。此外,我们展示了如何使用量化感知训练将稀疏模型的权重进一步压缩到8位精度。例如,我们的稀疏预训练BERT-Large在SQuADv1.1上微调并量化为8位,我们实现了编码器的$40$ X压缩比,并且精度损失小于$1\%$。据我们所知,我们的结果显示BERT-Base,BERT-Large和DistilBERT的压缩精度比最好。

英文摘要:

Transformer-based language models are applied to a wide range of applications in natural language processing. However, they are inefficient and difficult to deploy. In recent years, many compression algorithms have been proposed to increase the implementation efficiency of large Transformer-based models on target hardware. In this work we present a new method for training sparse pre-trained Transformer language models by integrating weight pruning and model distillation. These sparse pre-trained models can be used to transfer learning for a wide range of tasks while maintaining their sparsity pattern. We demonstrate our method with three known architectures to create sparse pre-trained BERT-Base, BERT-Large and DistilBERT. We show how the compressed sparse pre-trained models we trained transfer their knowledge to five different downstream natural language tasks with minimal accuracy loss. Moreover, we show how to further compress the sparse models' weights to 8bit precision using quantization-aware training. For example, with our sparse pre-trained BERT-Large fine-tuned on SQuADv1.1 and quantized to 8bit we achieve a compression ratio of $40$X for the encoder with less than $1\%$ accuracy loss. To the best of our knowledge, our results show the best compression-to-accuracy ratio for BERT-Base, BERT-Large, and DistilBERT.

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

↑