Skip to main content
QUICK REVIEW

[论文解读] BinaryBERT: Pushing the Limit of BERT Quantization

Haoli Bai, Wei Zhang|arXiv (Cornell University)|Dec 31, 2020
Topic Modeling参考文献 69被引用 45
一句话总结

BinaryBERT 通过使用三值权重分割来初始化并微调一个二进制模型,将 BERT 权重二值化,在 GLUE 和 SQuAD 上实现 ~24x 的更小尺寸且几乎不损失精度。

ABSTRACT

The rapid development of large pre-trained language models has greatly increased the demand for model compression techniques, among which quantization is a popular solution. In this paper, we propose BinaryBERT, which pushes BERT quantization to the limit by weight binarization. We find that a binary BERT is hard to be trained directly than a ternary counterpart due to its complex and irregular loss landscape. Therefore, we propose ternary weight splitting, which initializes BinaryBERT by equivalently splitting from a half-sized ternary network. The binary model thus inherits the good performance of the ternary one, and can be further enhanced by fine-tuning the new architecture after splitting. Empirical results show that our BinaryBERT has only a slight performance drop compared with the full-precision model while being 24x smaller, achieving the state-of-the-art compression results on the GLUE and SQuAD benchmarks.

研究动机与目标

  • 推动对大规模预训练语言模型的模型压缩以实现边缘端部署。
  • 研究对 BERT 的权重量化的可行性与挑战。
  • 提出一种训练工作流,将二进制与全精度模型连接起来以保留性能。
  • 提供一个自适应分割策略,以将二进制模型大小定制到设备约束之内。

提出的方法

  • 分析全精度、三值和二进制 BERT 的损失景观,以识别优化挑战。
  • 引入三值权重分割(TWS)以从半宽度三值模型初始化 BinaryBERT,并具备分割等价性。
  • 在分割后对激活进行量化并对分割矩阵的分离缩放进行逐层或逐行三值化,应用分离后的缩放。
  • 在中间、预测和微调阶段引入来自全精度教师的知识蒸馏。
  • 在资源约束下实现自适应分割,以选择哪些模块为三值、哪些为二进制。
  • 展示自适应分割作为一种最大化增益的优化,在大小/ FLOP 限制下最大化性能。

实验结果

研究问题

  • RQ1二进制权重量化的 BERT 是否可以在性能上达到相对于全精度或三值模型的可接受水平?
  • RQ2从三值到二进制权重的性能下降背后存在哪些机制?
  • RQ3一种基于分割的训练工作流(三值权重分割)是否能有效初始化并微调用于二进制的 BERT?
  • RQ4在边缘设备约束下,自适应分割是否能在模型大小、FLOPs 与准确率之间获得更好的折衷?

主要发现

  • BinaryBERT 在 GLUE 和 SQuAD 上对全精度 BERT 的性能差距较小,同时尺寸减小了 24x。
  • 直接的二进制训练相较于全精度和三值模型,容易出现陡峭、非规则的损失景观。
  • 三值权重分割(TWS)将 BinaryBERT 从半宽度三值模型初始化,并在分割后保留其性能。
  • 自适应分割通过在分割为二进制前选择对量化最敏感的模块为三值,从而进一步改善不同模型规模的结果。
  • 在 GLUE 和 SQuAD 的全局对比中,带有分割的 BinaryBERT 在多数情况下优于其他二值化方法,特别是在 4 位激活的情况下。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。