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

基于前向和后向传播的预训练语言模型的微调

Towards Fine-tuning Pre-trained Language Models with Integer Forward and Backward Propagation

Huawei Noah’s Ark Lab(华为诺亚方舟实验室);McGill University(麦吉尔大学)

Mohammadreza Tayaranian, Alireza Ghaffari, Marzieh S. Tahaei, Mehdi Rezagholizadeh, Masoud Asgharian, Vahid Partovi Nia

摘要:

一些著名的语言模型(如BERT)的大量参数使得它们对下游任务的微调计算密集且耗能。以前的研究人员主要集中在较低位宽的整数数据类型的语言模型的前向传播,以节省内存和计算。然而,对于反向传播,仅使用16位浮点数据类型来微调BERT。在这项工作中,我们使用整数算法的前向和反向传播的微调BERT。我们研究了整数位宽的变化对模型的度量性能的影响。我们的整数微调使用整数运算来执行BERT的线性、层范数和嵌入层的前向传播和梯度计算。我们在SQuAD v1.1和SQuAD v2上使用整数训练方法微调了BERT,和胶水基准。我们证明了微调16位整数BERT的度量性能与16位和32位浮点基线相匹配。此外,使用更快、更节省内存的8位整数数据类型,与FP32基线相比,BERT的整数微调平均损失3.1分。

英文摘要:

The large number of parameters of some prominent language models, such as BERT, makes their fine-tuning on downstream tasks computationally intensive and energy hungry. Previously researchers were focused on lower bit-width integer data types for the forward propagation of language models to save memory and computation. As for the backward propagation, however, only 16-bit floating-point data type has been used for the fine-tuning of BERT. In this work, we use integer arithmetic for both forward and back propagation in the fine-tuning of BERT. We study the effects of varying the integer bit-width on the model's metric performance. Our integer fine-tuning uses integer arithmetic to perform forward propagation and gradient computation of linear, layer-norm, and embedding layers of BERT. We fine-tune BERT using our integer training method on SQuAD v1.1 and SQuAD v2., and GLUE benchmark. We demonstrate that metric performance of fine-tuning 16-bit integer BERT matches both 16-bit and 32-bit floating-point baselines. Furthermore, using the faster and more memory efficient 8-bit integer data type, integer fine-tuning of BERT loses an average of 3.1 points compared to the FP32 baseline.

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

↑