arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2112.14938cs.CLcs.AI
收藏

BERT的自动混合精度Quantization搜索

Automatic Mixed-Precision Quantization Search of BERT

Samsung Research America(三星美国研究院)

Changsheng Zhao, Ting Hua, Yilin Shen, Qian Lou, Hongxia Jin

摘要:

预先训练的语言模型,如BERT,在各种自然语言处理任务中表现出显着的有效性。然而,这些模型通常包含数百万个参数,这阻止了它们在资源受限的设备上的实际部署。知识蒸馏、权值修剪和量化是模型压缩的主要研究方向。然而,即使对于相对小的压缩比,通过知识蒸馏获得的紧凑模型也可能遭受显著的精度下降。另一方面,只有少数量化尝试是专门为自然语言处理任务设计的。它们遭受小压缩比或大出错率,因为需要手动设置超参数,并且不支持细粒度的子组量化。本文提出了一种适用于BERT的自动混合精度量化框架,该框架可以同时在子组级别上进行量化和剪枝。具体来说,我们提出的方法利用微分神经结构搜索来自动为每个子组中的参数分配规模和精度,同时修剪掉冗余的参数组。对BERT下游任务的广泛评估表明,我们提出的方法通过以更小的模型大小提供相同的性能而优于基线。我们还展示了通过将我们的解决方案与DistilBERT等正交方法相结合来获得极轻模型的可行性。

英文摘要:

Pre-trained language models such as BERT have shown remarkable effectiveness in various natural language processing tasks. However, these models usually contain millions of parameters, which prevents them from practical deployment on resource-constrained devices. Knowledge distillation, Weight pruning, and Quantization are known to be the main directions in model compression. However, compact models obtained through knowledge distillation may suffer from significant accuracy drop even for a relatively small compression ratio. On the other hand, there are only a few quantization attempts that are specifically designed for natural language processing tasks. They suffer from a small compression ratio or a large error rate since manual setting on hyper-parameters is required and fine-grained subgroup-wise quantization is not supported. In this paper, we proposed an automatic mixed-precision quantization framework designed for BERT that can simultaneously conduct quantization and pruning in a subgroup-wise level. Specifically, our proposed method leverages Differentiable Neural Architecture Search to assign scale and precision for parameters in each sub-group automatically, and at the same time pruning out redundant groups of parameters. Extensive evaluations on BERT downstream tasks reveal that our proposed method outperforms baselines by providing the same performance with much smaller model size. We also show the feasibility of obtaining the extremely light-weight model by combining our solution with orthogonal methods such as DistilBERT.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑