Transformer networks have revolutionized NLP representation learning since they were introduced. Though a great effort has been made to explain the representation in transformers, it is widely recognized that our understanding is not sufficient. One important reason is that there lack enough visualization tools for detailed analysis. In this paper, we propose to use dictionary learning to open up these "black boxes" as linear superpositions of transformer factors. Through visualization, we demonstrate the hierarchical semantic structures captured by the transformer factors, e.g., word-level polysemy disambiguation, sentence-level pattern formation, and long-range dependency. While some of these patterns confirm the conventional prior linguistic knowledge, the rest are relatively unexpected, which may provide new insights. We hope this visualization tool can bring further knowledge and a better understanding of how transformer networks work. The code is available at https://github.com/zeyuyun1/TransformerVis
翻译:Transformer网络自推出以来,已经在NLP表示学习方面带来了革命性的变化。虽然人们已经尽最大努力解释transformers中的表示,但普遍认为我们的理解还不够。重要原因之一是缺乏详细分析的足够的可视化工具。因此,本文提出使用字典学习的方法,将其打开作为transformer因子的线性叠加形式,从而揭示内部黑盒的内容。通过可视化,我们演示了transformer因子捕捉的分层语义结构,例如词级多义消歧,句子级模式形成以及长程依赖等。虽然其中一些模式符合传统的语言学知识,但其余部分是相对意外的,这可能提供新的见解。希望这种可视化工具能够为提供进一步的知识和更好的了解transformer如何工作。该代码可在以下网址找到:https://github.com/zeyuyun1/TransformerVis