What Does BERT Look at? An Analysis of BERT’s Attention

By Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D. Manning. 2019

2,073 citations recorded by the source corpus.

Large pre-trained neural networks such as BERT have had great recent success in NLP, motivating a growing body of research investigating what aspects of language they are able to learn from unlabeled data. Most recent analysis has focused on model outputs (e.g., language model surprisal) or internal vector representations (e.g., probing classifiers). Complementary to these works, we propose methods for analyzing the attention mechanisms of pre-trained models and apply them to BERT. BERT’s attention heads exhibit patterns such as attending to delimiter tokens, specific positional offsets, or broadly attending over the whole sentence, with heads in the same layer often exhibiting similar behaviors. We further show that certain attention heads correspond well to linguistic notions of syntax and coreference. For example, we find heads that attend to the direct objects of verbs, determiners of nouns, objects of prepositions, and coreferent mentions with remarkably high accuracy. Lastly, we propose an attention-based probing classifier and use it to further demonstrate that substantial syntactic information is captured in BERT’s attention.

Subfields: Artificial Intelligence, Natural Language Processing, 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. Luke S. Zettlemoyer
  3. Jianfeng Gao
  4. Yonatan Belinkov
  5. Yejin Choi
  6. Percy Liang
  7. Noah A. Smith
  8. Graham Neubig

In Natural Language Processing

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

In Model Architectures

  1. Yonatan Belinkov
  2. Yoav Goldberg
  3. Samuel R. Bowman
  4. Tal Linzen
  5. J. Ainslie
  6. R. Thomas McCoy
  7. Chenyan Xiong
  8. Ivan Titov

Citations in the corpus