arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1906.04284cs.CLcs.LGstat.ML
收藏

Transformer语言模型中注意力结构分析

Analyzing the Structure of Attention in a Transformer Language Model

Palo Alto Research Center(帕洛阿尔托研究中心)

Jesse Vig, Yonatan Belinkov

摘要:

Transformer是一种完全基于注意力的递归网络替代方案,在一系列NLP任务中取得了最先进的结果。在本文中,我们分析了Transformer语言模型,GPT-2小型预训练模型的注意力结构。我们可视化的个别实例的注意力,并在一个大型语料库中分析注意力和语法之间的相互作用。我们发现,注意力针对模型中不同层深度的不同部分,并且注意力与中间层中最强烈的依赖关系保持一致。我们还发现,模型的最深层捕捉了最遥远的关系。最后,我们提取的例句,揭示了高度具体的模式,针对特定的注意头。

英文摘要:

The Transformer is a fully attention-based alternative to recurrent networks that has achieved state-of-the-art results across a range of NLP tasks. In this paper, we analyze the structure of attention in a Transformer language model, the GPT-2 small pretrained model. We visualize attention for individual instances and analyze the interaction between attention and syntax over a large corpus. We find that attention targets different parts of speech at different layer depths within the model, and that attention aligns with dependency relations most strongly in the middle layers. We also find that the deepest layers of the model capture the most distant relationships. Finally, we extract exemplar sentences that reveal highly specific patterns targeted by particular attention heads.

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

↑