Skip to main content
QUICK REVIEW

[论文解读] BiBERT: Accurate Fully Binarized BERT

Haotong Qin, Yifu Ding|arXiv (Cornell University)|Mar 12, 2022
Multimodal Machine Learning Applications被引用 34
一句话总结

BiBERT 引入 Bi-Attention 与 Direction-Matching Distillation,以实现一个准确的全二值化 BERT(1-bit 权重、嵌入和激活),在 GLUE 上超越先前的极低位量化 BERT 模型的同时实现显著的 FLOPs 和模型尺寸节省。

ABSTRACT

The large pre-trained BERT has achieved remarkable performance on Natural Language Processing (NLP) tasks but is also computation and memory expensive. As one of the powerful compression approaches, binarization extremely reduces the computation and memory consumption by utilizing 1-bit parameters and bitwise operations. Unfortunately, the full binarization of BERT (i.e., 1-bit weight, embedding, and activation) usually suffer a significant performance drop, and there is rare study addressing this problem. In this paper, with the theoretical justification and empirical analysis, we identify that the severe performance drop can be mainly attributed to the information degradation and optimization direction mismatch respectively in the forward and backward propagation, and propose BiBERT, an accurate fully binarized BERT, to eliminate the performance bottlenecks. Specifically, BiBERT introduces an efficient Bi-Attention structure for maximizing representation information statistically and a Direction-Matching Distillation (DMD) scheme to optimize the full binarized BERT accurately. Extensive experiments show that BiBERT outperforms both the straightforward baseline and existing state-of-the-art quantized BERTs with ultra-low bit activations by convincing margins on the NLP benchmark. As the first fully binarized BERT, our method yields impressive 56.3 times and 31.2 times saving on FLOPs and model size, demonstrating the vast advantages and potential of the fully binarized BERT model in real-world resource-constrained scenarios.

研究动机与目标

  • 激励并解决将 BERT 的权重、嵌入和激活端到端以 1 位二值化时的性能差距。
  • 识别在蒸馏过程中的注意力信息降解和优化方向不匹配作为主要瓶颈。
  • 提出 Bi-Attention 以最大化二值化注意力中的信息熵,以及 Direction-Matching Distillation (DMD) 以对齐优化方向。
  • 证明 BiBERT 在 GLUE 基准测试上超越了超低比特宽度下的最先进量化 BERT,并带来大的 FLOPs 和尺寸节省。

提出的方法

  • 定义一个完全二值化的 BERT 基线并分析其前向传播中的瓶颈(注意力信息损失)和反向传播中的瓶颈(蒸馏方向)。
  • Bi-Attention:通过使用熵最大化的二值表示和位运算的 AFFINE 矩阵乘法(BAMM)算子来替换基于 softmax 的注意力,从而在二值化注意力中最大化信息熵。
  • Direction-Matching Distillation (DMD):重新选择蒸馏的激活(Q、K、V)并构造相似性模式矩阵 P_Q、P_K、P_V,以实现更好地优化方向对齐来引导蒸馏。
  • 提供理论依据(信息理论与方向不匹配分析),并通过在 GLUE 任务上的实证消融来支持。

实验结果

研究问题

  • RQ1完全二值化的 BERT(1-bit 权重、嵌入和激活)能否实现有竞争力的 NLP 性能?
  • RQ2在将 BERT 二值化时,前向和后向传播的主要瓶颈是什么,如何缓解?
  • RQ3Bi-Attention 与 Direction-Matching Distillation 是否在 GLUE 基准上提升性能并保持高效?
  • RQ4BiBERT 与最先进的超低位量化 BERT 模型在准确性与资源使用方面相比如何?

主要发现

  • BiBERT 在 GLUE 任务上超过基线的完全二值化 BERT 以及现有的 ultra-low-bit quantized BERT。
  • Bi-Attention 显著缓解在二值化注意力中的信息降解并消除了 softmax,提升表示熵。
  • DMD 通过将蒸馏激活重新定向到上游的 Q/K/V 及相似性模式矩阵,降低优化方向不匹配,改善收敛性。
  • BiBERT 相较于全精度 BERT 在 FLOPs 上高达 56.3× 的效率提升,模型尺寸节省达 31.2×。
  • 在没有数据增强的 GLUE 上,BiBERT 超越若干基线,在多任务上实现竞争性性能;在使用增强时接近全精度结果,特别是在 SST-2 上。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

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