Analyzing the Structure of Attention in a Transformer Language Model

By Jesse Vig, Yonatan Belinkov. 2019

479 citations recorded by the source corpus.

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.

Subfields: Artificial Intelligence, Computer Vision and Pattern Recognition, Model Architectures

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Yonatan Belinkov
  3. Luke S. Zettlemoyer
  4. Yejin Choi
  5. Graham Neubig
  6. Percy Liang
  7. Jianfeng Gao
  8. Caiming Xiong

In Computer Vision and Pattern Recognition

  1. Luc Van Gool
  2. Dacheng Tao
  3. Ming-Hsuan Yang
  4. Trevor Darrell
  5. Mohit Bansal
  6. Bernt Schiele
  7. Alan L. Yuille
  8. Xiaogang Wang

In Model Architectures

  1. Yonatan Belinkov
  2. Richard Socher
  3. Caiming Xiong
  4. Yoav Goldberg
  5. Omer Levy
  6. Furu Wei
  7. Tri Dao
  8. Li Dong

Citations in the corpus