arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1909.02279cs.CL
收藏

基于自注意和循环神经网络的Transformer译码加速算法

Accelerating Transformer Decoding via a Hybrid of Self-attention and Recurrent Neural Network

Nankai University(南开大学);Harbin Institute of Technology(哈尔滨工业大学);Microsoft Research Asia(微软亚洲研究院)

Chengyi Wang, Shuangzhi Wu, Shujie Liu

摘要:

由于高度并行化的架构,Transformer比基于RNN的模型更快地进行训练,并广泛用于机器翻译任务。然而,在推理时,每个输出单词需要先前生成的单词的所有隐藏状态,这限制了并行化能力,并且使其比基于RNN的算法慢得多。在本文中,我们系统地分析了Transformer和基于RNN的模型的不同组件的时间成本。在此基础上,我们提出了一种自注意和RNN结构的混合网络,其中,高度并行的自注意被用作编码器,简单的RNN结构被用作解码器。我们的混合网络解码速度比Transformer快4倍。此外,在知识蒸馏的帮助下,我们的混合网络实现了与原始Transformer相当的翻译质量。

英文摘要:

Due to the highly parallelizable architecture, Transformer is faster to train than RNN-based models and popularly used in machine translation tasks. However, at inference time, each output word requires all the hidden states of the previously generated words, which limits the parallelization capability, and makes it much slower than RNN-based ones. In this paper, we systematically analyze the time cost of different components of both the Transformer and RNN-based model. Based on it, we propose a hybrid network of self-attention and RNN structures, in which, the highly parallelizable self-attention is utilized as the encoder, and the simpler RNN structure is used as the decoder. Our hybrid network can decode 4-times faster than the Transformer. In addition, with the help of knowledge distillation, our hybrid network achieves comparable translation quality to the original Transformer.

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

↑