BinaryBERT: Pushing the Limit of BERT Quantization

Haoli Bai, Wei Zhang, Lu Hou, Lifeng Shang, Jing Jin +4 more
12/31/2020
cs.CL

Official code: huawei-noah/Pretrained-Language-Model (3,167 stars, Python, last commit 2024-01-22).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

Pretrained language model and its related optimization techniques developed by Huawei Noah's Ark Lab.

3,167638Python, ShellDec 2, 20192 years ago
knowledge-distillationlarge-scale-distributedmodel-compressionpretrained-modelsquantization

Similar Papers

Cite this paper

@article{bai2020binarybert,
  title  = {BinaryBERT: Pushing the Limit of BERT Quantization},
  author = {Haoli Bai and Wei Zhang and Lu Hou and Lifeng Shang and Jing Jin and Xin Jiang and Qun Liu and Michael Lyu and Irwin King},
  year   = {2020},
  eprint = {2012.15701},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2012.15701}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2012.15701.svg)](https://codeofpaper.com/paper/2012.15701)

Discussion