HackerPapers

arXiv:1906.04284cs.CL

Analyzing the Structure of Attention in a Transformer Language Model

Jesse Vig, Yonatan Belinkov

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

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.

arXiv comments
To appear in ACL BlackboxNLP workshop
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.LGMachine Learning stat.MLMachine Learning (Statistics)

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Feb 2023 to Feb 2023.

Comments linking this paper, per year.

Discussed in comments1 thread

    • See my reply to sibling: https://news.ycombinator.com/item?id=34672865 A more interesting example of transformers learning a process may be [1]. There's a large literature on applying language models to reasoning tasks, but not many on what's actually going on inside them. But…

      versteegenView on HNParent context

Submitted to Hacker News

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