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

I-BERT:仅整数BERT Quantization

I-BERT: Integer-only BERT Quantization

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

Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer

摘要:

基于Transformer的模型,如BERT和RoBERTa,已经在许多自然语言处理任务中取得了最先进的结果。然而,它们的内存占用、推理延迟和功耗在边缘甚至在数据中心都是令人望而却步的高效推理。虽然量化可以是一个可行的解决方案,但以前对基于Transformer的模型进行量化的工作在推理期间使用浮点运算,这无法有效地利用仅整数逻辑单元,例如最近的图灵张量核或传统的仅整数ARM处理器。在这项工作中,我们提出了I-BERT,一种新的量化方案的Transformer为基础的模型,量化整个推理与整数运算。基于用于非线性运算的轻量级仅整数近似方法,例如,I-BERT执行端到端的仅整数BERT推理,而不进行任何浮点计算。我们使用RoberTa-Base/Large评估我们在GLUE下游任务上的方法。我们表明,在这两种情况下,I-BERT实现了类似的(略高)精度相比,全精度基线。此外,我们的I-BERT的初步实现显示,与FP 32推理相比,在T4 GPU系统上进行INT 8推理的速度提高了2.4- 4.0倍。该框架是在PyTorch中开发的,并且已经开源。

英文摘要:

Transformer based models, like BERT and RoBERTa, have achieved state-of-the-art results in many Natural Language Processing tasks. However, their memory footprint, inference latency, and power consumption are prohibitive efficient inference at the edge, and even at the data center. While quantization can be a viable solution for this, previous work on quantizing Transformer based models use floating-point arithmetic during inference, which cannot efficiently utilize integer-only logical units such as the recent Turing Tensor Cores, or traditional integer-only ARM processors. In this work, we propose I-BERT, a novel quantization scheme for Transformer based models that quantizes the entire inference with integer-only arithmetic. Based on lightweight integer-only approximation methods for nonlinear operations, e.g., GELU, Softmax, and Layer Normalization, I-BERT performs an end-to-end integer-only BERT inference without any floating point calculation. We evaluate our approach on GLUE downstream tasks using RoBERTa-Base/Large. We show that for both cases, I-BERT achieves similar (and slightly higher) accuracy as compared to the full-precision baseline. Furthermore, our preliminary implementation of I-BERT shows a speedup of 2.4-4.0x for INT8 inference on a T4 GPU system as compared to FP32 inference. The framework has been developed in PyTorch and has been open-sourced.

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

↑