about
What Does Bert Look At? An Analysis of BERT’s Attention (arxiv.org)
2 points by godelmachine on Jun 24, 2019 | hide | past | pdf | discuss on HN

In plain words: Instead of checking a language model's answers or inner number patterns, this study reads BERT's attention links — which words each word looks at — to see what it learned. Some links track grammar closely, like verbs pointing to their objects or nouns to their determiners.

Abstract · What Does BERT Look At? An Analysis of BERT's Attention

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.

Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D. Manning
arXiv:1906.04341 · cs.CL · submitted Jun 11, 2019
abstract · pdf · html · BlackBoxNLP 2019

add comment on HN
Also discussed: Jun 2019 (4 points, 0 comments) · Jun 2019 (3 points, 0 comments)