十六个脑袋真的比一个好吗?
Are Sixteen Heads Really Better than One?
摘要:
注意力是一种强大且无处不在的机制,它允许神经模型在进行预测时通过加权平均来关注特定的突出信息。特别是,多头注意力是许多最近最先进的NLP模型(如基于transformer的MT模型和BERT)背后的驱动力。这些模型并行地应用多个注意力机制,每个注意力“头”潜在地集中在输入的不同部分,这使得有可能表达超出简单加权平均值的复杂函数。在本文中,我们做出了令人惊讶的观察,即使模型已经使用多个头部进行了训练,在实践中,很大一部分注意力头部可以在测试时被移除,而不会显著影响性能。事实上,有些层甚至可以减少到一个头。我们进一步研究了用于修剪模型的贪心算法,以及由此获得的潜在速度、存储器效率和准确性改进。最后,我们分析了模型的哪些部分更依赖于多个头部的结果,并提供了初步证据,证明训练动态在多头注意力提供的收益中发挥了作用。
英文摘要:
Attention is a powerful and ubiquitous mechanism for allowing neural models to focus on particular salient pieces of information by taking their weighted average when making predictions. In particular, multi-headed attention is a driving force behind many recent state-of-the-art NLP models such as Transformer-based MT models and BERT. These models apply multiple attention mechanisms in parallel, with each attention "head" potentially focusing on different parts of the input, which makes it possible to express sophisticated functions beyond the simple weighted average. In this paper we make the surprising observation that even if models have been trained using multiple heads, in practice, a large percentage of attention heads can be removed at test time without significantly impacting performance. In fact, some layers can even be reduced to a single head. We further examine greedy algorithms for pruning down models, and the potential speed, memory efficiency, and accuracy improvements obtainable therefrom. Finally, we analyze the results with respect to which parts of the model are more reliant on having multiple heads, and provide precursory evidence that training dynamics play a role in the gains provided by multi-head attention.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。