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

Q-BERT:BERT的基于黑森的超低精度Quantization

Q-BERT: Hessian Based Ultra Low Precision Quantization of BERT

University of California at Berkeley(加州大学伯克利分校)

Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W. Mahoney, Kurt Keutzer

摘要:

基于Transformer的架构已经成为用于一系列自然语言处理任务的事实模型。特别是,基于BERT的模型在GLUE任务、CoNLL-03和SQuAD中实现了显著的精度增益。然而,基于BERT的模型具有过高的内存占用和延迟。因此,在资源受限的环境中部署基于BERT的模型已成为一项具有挑战性的任务。在这项工作中,我们进行了广泛的分析微调BERT模型使用二阶海森信息,我们使用我们的研究结果提出了一种新的方法量化BERT模型,以超低精度。特别是,我们提出了一种新的分组量化方案,我们使用基于Hessian的混合精度方法来进一步压缩模型。我们广泛测试我们提出的方法BERT下游任务的SST-2,MNLI,CoNLL-03,SQuAD。我们可以实现与基线相当的性能,最多$2.3\%$性能降级,甚至具有低至2位的超低精度量化,对应于模型参数的高达$13\times$压缩,以及嵌入表以及激活的高达$4\times$压缩。在所有任务中,我们观察到SQuAD上微调的BERT的性能损失最高。通过探讨基于Hessian的分析以及可视化,我们表明,这是有关的事实,目前的训练/微调策略的BERT不收敛SQuAD。

英文摘要:

Transformer based architectures have become de-facto models used for a range of Natural Language Processing tasks. In particular, the BERT based models achieved significant accuracy gain for GLUE tasks, CoNLL-03 and SQuAD. However, BERT based models have a prohibitive memory footprint and latency. As a result, deploying BERT based models in resource constrained environments has become a challenging task. In this work, we perform an extensive analysis of fine-tuned BERT models using second order Hessian information, and we use our results to propose a novel method for quantizing BERT models to ultra low precision. In particular, we propose a new group-wise quantization scheme, and we use a Hessian based mix-precision method to compress the model further. We extensively test our proposed method on BERT downstream tasks of SST-2, MNLI, CoNLL-03, and SQuAD. We can achieve comparable performance to baseline with at most $2.3\%$ performance degradation, even with ultra-low precision quantization down to 2 bits, corresponding up to $13\times$ compression of the model parameters, and up to $4\times$ compression of the embedding table as well as activations. Among all tasks, we observed the highest performance loss for BERT fine-tuned on SQuAD. By probing into the Hessian based analysis as well as visualization, we show that this is related to the fact that current training/fine-tuning strategy of BERT does not converge for SQuAD.

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

↑