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

多头还是单头?Transformer培训的实证比较

Multi-head or Single-head? An Empirical Comparison for Transformer Training

University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Google Research(谷歌研究院)

Liyuan Liu, Jialu Liu, Jiawei Han

摘要:

多头注意力在最近Transformer模型的成功中起着至关重要的作用,这导致了在各种应用中相对于传统注意力的一致性能改进。普遍的看法是,这种有效性源于共同参加多个职位的能力。在本文中,我们首先证明,共同出席多个位置是不是一个独特的特点,多头注意力,作为多层次的单头注意也出席多个位置,更有效。然后,我们认为多头注意力的主要优点是训练的稳定性,因为它具有较少的层数比单头注意,当出席相同数量的位置。例如,24层16头Transformer(BERT-large)和384层单头Transformer的总关注头数相同,模型尺寸大致相同,而多头的要明显浅一些。同时,我们表明,随着深度学习的最新进展,我们可以成功地稳定384层Transformer的训练。由于训练难度不再是瓶颈,因此更深的单头Transformer实现了一致的性能改进,而无需调整超参数。

英文摘要:

Multi-head attention plays a crucial role in the recent success of Transformer models, which leads to consistent performance improvements over conventional attention in various applications. The popular belief is that this effectiveness stems from the ability of jointly attending multiple positions. In this paper, we first demonstrate that jointly attending multiple positions is not a unique feature of multi-head attention, as multi-layer single-head attention also attends multiple positions and is more effective. Then, we suggest the main advantage of the multi-head attention is the training stability, since it has less number of layers than the single-head attention, when attending the same number of positions. For example, 24-layer 16-head Transformer (BERT-large) and 384-layer single-head Transformer has the same total attention head number and roughly the same model size, while the multi-head one is significantly shallower. Meanwhile, we show that, with recent advances in deep learning, we can successfully stabilize the training of the 384-layer Transformer. As the training difficulty is no longer a bottleneck, substantially deeper single-head Transformer achieves consistent performance improvements without tuning hyper-parameters.

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

↑