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

By Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zi-Mei Yao, A. Gholami, Michael W. Mahoney, Kurt Keutzer. 2019

675 citations recorded by the source corpus.

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 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× compression of the model parameters, and up to 4× 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.

Subfields: Artificial Intelligence, Computer Vision and Pattern Recognition, Hardware and Architecture, Efficiency & Compression

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Luke S. Zettlemoyer
  3. Jianfeng Gao
  4. Percy Liang
  5. Yejin Choi
  6. Noah A. Smith
  7. Graham Neubig
  8. Furu Wei

In Computer Vision and Pattern Recognition

  1. Luc Van Gool
  2. Dacheng Tao
  3. Trevor Darrell
  4. Xiaogang Wang
  5. Cordelia Schmid
  6. Ming-Hsuan Yang
  7. Jitendra Malik
  8. Yi Yang

In Hardware and Architecture

  1. Kurt Keutzer
  2. Zi-Mei Yao
  3. Michael W. Mahoney
  4. A. Gholami
  5. Derya Soydaner
  6. J. Scott McCarley
  7. Tijmen Blankevoort
  8. Sehoon Kim

In Efficiency & Compression

  1. Kurt Keutzer
  2. Zi-Mei Yao
  3. Dan Alistarh
  4. A. Gholami
  5. Michael W. Mahoney
  6. Canwen Xu
  7. Julian McAuley
  8. Tijmen Blankevoort

Citations in the corpus