Deploying transformer models in practice is challenging due to their inference cost, which scales quadratically with input sequence length. To address this, we present a novel Learned Token Pruning (LTP) method which adaptively removes unimportant tokens as an input sequence passes through transformer layers. In particular, LTP prunes tokens with an attention score below a threshold value which is learned for each layer during training. Our threshold-based method allows the length of the pruned sequence to vary adaptively based on the input sequence, and avoids algorithmically expensive operations such as top-k token selection. We extensively test the performance of LTP on GLUE tasks and show that our method outperforms the prior state-of-the-art token pruning methods by up to ~2.5% higher accuracy with the same amount of FLOPs. In particular, LTP achieves up to 2.1x FLOPs reduction with less than 1% accuracy drop, which results in up to 1.9x and 2.0x throughput improvement on Intel Haswell CPUs and NVIDIA V100 GPUs, respectively. Furthermore, we demonstrate that LTP is more robust than prior methods to variations on input sentence lengths. Our code has been developed in PyTorch and has been open-sourced.


翻译:实际部署变压器模型具有挑战性, 原因是其推论成本, 以输入序列长度缩放。 为了解决这个问题, 我们展示了一部新颖的《 Token Prurning (LTP) 》 方法, 该方法通过变压器层, 以适应方式删除输入序列中的不重要符号。 特别是, LTP 光标, 其关注分数低于在训练期间为每一层所学的阈值。 我们的阈值方法允许经调整的序列长度根据输入序列进行适应性变异, 并避免了诸如顶级符号选择等费用昂贵的算法操作。 我们在 GLUE 任务上广泛测试了 LTP 的性能, 并显示我们的方法比先前的状态、 高级符号处理方法高出2.5 % 。 特别是, LTP 达到2.1x FLOPs 的降幅, 低于1% 的精度下降, 从而导致在 Intel Haswell 和 NVIIA V100 GPUPS 上进行价格的改进。 此外, 我们的LTP 和前期输入法的变更坚固。

0
下载
关闭预览

相关内容

【Tutorial】计算机视觉中的Transformer,98页ppt
专知会员服务
142+阅读 · 2021年10月25日
2021机器学习研究风向是啥?MLP→CNN→Transformer→MLP!
专知会员服务
65+阅读 · 2021年5月23日
注意力机制综述
专知会员服务
201+阅读 · 2021年1月26日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
77+阅读 · 2020年7月26日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
《DeepGCNs: Making GCNs Go as Deep as CNNs》
专知会员服务
30+阅读 · 2019年10月17日
绝对干货!NLP预训练模型:从transformer到albert
新智元
13+阅读 · 2019年11月10日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Transferring Knowledge across Learning Processes
CreateAMind
27+阅读 · 2019年5月18日
NLP - 基于 BERT 的中文命名实体识别(NER)
AINLP
466+阅读 · 2019年2月10日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
干货 | BERT fine-tune 终极实践教程
AINLP
40+阅读 · 2018年11月24日
Arxiv
0+阅读 · 2021年11月14日
Arxiv
11+阅读 · 2021年10月26日
Arxiv
6+阅读 · 2019年7月11日
Star-Transformer
Arxiv
5+阅读 · 2019年2月28日
Arxiv
13+阅读 · 2017年12月5日
VIP会员
相关VIP内容
【Tutorial】计算机视觉中的Transformer,98页ppt
专知会员服务
142+阅读 · 2021年10月25日
2021机器学习研究风向是啥?MLP→CNN→Transformer→MLP!
专知会员服务
65+阅读 · 2021年5月23日
注意力机制综述
专知会员服务
201+阅读 · 2021年1月26日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
77+阅读 · 2020年7月26日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
《DeepGCNs: Making GCNs Go as Deep as CNNs》
专知会员服务
30+阅读 · 2019年10月17日
相关资讯
绝对干货!NLP预训练模型:从transformer到albert
新智元
13+阅读 · 2019年11月10日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Transferring Knowledge across Learning Processes
CreateAMind
27+阅读 · 2019年5月18日
NLP - 基于 BERT 的中文命名实体识别(NER)
AINLP
466+阅读 · 2019年2月10日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
干货 | BERT fine-tune 终极实践教程
AINLP
40+阅读 · 2018年11月24日
相关论文
Arxiv
0+阅读 · 2021年11月14日
Arxiv
11+阅读 · 2021年10月26日
Arxiv
6+阅读 · 2019年7月11日
Star-Transformer
Arxiv
5+阅读 · 2019年2月28日
Arxiv
13+阅读 · 2017年12月5日
Top
微信扫码咨询专知VIP会员