HackerPapers

arXiv:1906.04341cs.CL

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

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

Abstract

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.

arXiv comments
BlackBoxNLP 2019
Journal reference
DOI
Subjects
cs.CLComputation and Language

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Feb 2023 to Apr 2025. Found in 3 HN submissions from Jun 2019 to Jun 2019. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments2 threads

    • https://arxiv.org/abs/1906.04341 https://arxiv.org/abs/1905.05950 https://en.wikiversity.org/wiki/Psycholinguistics/Models_of_...

      Xmd5aView on HNParent context

  1. We Found an Neuron in GPT-2 1 comment
    • Several papers have explored emergent linguistic structure in LMs. Here's some early introductory work in this space. Despite having explicit syntax parses etc as input, models seem to learn something like syntax. https://arxiv.org/abs/1905.05950…

      KhoomeiKView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.