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 a 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\times$ compression of the model parameters, and up to $4\times$ 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.
翻译:在一系列自然语言处理任务中,基于变压器的建筑结构已成为用于一系列自然语言处理任务的脱法模型。特别是,基于BERT的模型在GLUE任务、CONLL-03和SQUAD中取得了显著的准确性增益。然而,基于BERT的模型具有令人望而却步的内存足迹和延缓性。因此,在资源受限的环境中部署基于BERT的模型已成为一项具有挑战性的任务。在这项工作中,我们使用第二顺序的Hessian信息对微调的BERT模型进行了广泛的分析,我们用我们的结果提出了一种新颖的方法,将BERT模型量化到极低的精确度。特别是,我们提出了一个新的基于集团的量化计划,我们用基于 Hesian 的混合精度方法来压缩模型模型。在SST-2、 MLI、 CoNLLLL-03和SQADAD等下游任务中,我们可以达到最多23美分的性能与基线相比较,即使超低精度的量化为2位,在13元的当前精度的精度的精度的精度的精度的精度调整中,作为SADRIMLADAD的精度的精度分析,我们所观察到的SBADADADAD的精度,作为SB的精度的精度的精度的精度的精度的精度,我们所观察到的精度, 的精度,作为SMA的精度的精度的精度的精度的精度的精度,作为所有的精度的精度的精度的精度的精度的精度分析的精度的精度的精度的精度, 。