Recently, transformer-based language models such as BERT have shown tremendous performance improvement for a range of natural language processing tasks. However, these language models usually are computation expensive and memory intensive during inference. As a result, it is difficult to deploy them on resource-restricted devices. To improve the inference performance, as well as reduce the model size while maintaining the model accuracy, we propose a novel quantization method named KDLSQ-BERT that combines knowledge distillation (KD) with learned step size quantization (LSQ) for language model quantization. The main idea of our method is that the KD technique is leveraged to transfer the knowledge from a "teacher" model to a "student" model when exploiting LSQ to quantize that "student" model during the quantization training process. Extensive experiment results on GLUE benchmark and SQuAD demonstrate that our proposed KDLSQ-BERT not only performs effectively when doing different bit (e.g. 2-bit $\sim$ 8-bit) quantization, but also outperforms the existing BERT quantization methods, and even achieves comparable performance as the full-precision base-line model while obtaining 14.9x compression ratio. Our code will be public available.


翻译:最近,以变压器为基础的语言模型(如BERT)在一系列自然语言处理任务方面表现出了巨大的性能改进。然而,这些语言模型通常在推论期间计算昂贵和记忆密集。因此,很难在资源限制装置上部署这些模型。为了改进推论性能,并在保持模型准确性的同时降低模型大小,我们提议了一个名为KDLSQ-BERT的新颖的量化方法,将知识蒸馏(KDD)与语言模型量化的逐步大小量化(LSQ)相结合。我们方法的主要想法是,KD技术在利用LSQ在量化培训过程中将知识从“教师”模型转移到“学生”模型时,很难将其应用到“学生”模型。关于GLUE基准和SQUAD的广泛实验结果表明,我们提议的KDLSQ-BERT不仅在做不同部分(例如2-bit\sim $8-bit)时有效运行。我们的方法主要是将“教师”技术从“教师”模型转换成“学生”模型,而且还将完成现有的14号标准化,同时将获得现有的公共标准。

0
下载
关闭预览

相关内容

【NeurIPS2020-华为】DynaBERT:具有自适应宽度和深度的动态BERT
图卷积神经网络蒸馏知识,Distillating Knowledge from GCN
专知会员服务
95+阅读 · 2020年3月25日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
60+阅读 · 2019年10月17日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
104+阅读 · 2019年10月9日
BERT 瘦身之路:Distillation,Quantization,Pruning
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
强化学习 cartpole_a3c
CreateAMind
9+阅读 · 2017年7月21日
Arxiv
0+阅读 · 2021年3月9日
Arxiv
2+阅读 · 2021年3月9日
Arxiv
8+阅读 · 2020年10月9日
Knowledge Distillation from Internal Representations
Arxiv
4+阅读 · 2019年10月8日
Arxiv
15+阅读 · 2019年9月11日
VIP会员
相关资讯
BERT 瘦身之路:Distillation,Quantization,Pruning
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
42+阅读 · 2019年1月3日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
强化学习 cartpole_a3c
CreateAMind
9+阅读 · 2017年7月21日
相关论文
Top
微信扫码咨询专知VIP会员