Lune

IEEE VIS2020Top-tier venue

Attention Flows: Analyzing and Comparing Attention Mechanisms in Language Models

Joseph F. DeRose, Jiayao Wang, Matthew Berger

Abstract

Fig. 1: Our approach supports the comparison of attention mechanisms in language models. We compare the BERT model (turquoise) and its fine-tuned counterpart (purple) tasked with determining question-answer pair validity (a). By selecting the word "what", in contrast to BERT the fine-tuned model attends to the answer "jacksonvillians or jaxons" (c), with full sentence context shown in (b).

Abstract-Advances in language modeling have led to the development of deep attention-based models that are performant across a wide variety of natural language processing (NLP) problems. These language models are typified by a pre-training process on large unlabeled text corpora and subsequently fine-tuned for specific tasks. Although considerable work has been devoted to understanding the attention mechanisms of pre-trained models, it is less understood how a model's attention mechanisms change when trained for a target NLP task. In this paper, we propose a visual analytics approach to understanding fine-tuning in attention-based language models. Our visualization, Attention Flows, is designed to support users in querying, tracing, and comparing attention within layers, across layers, and amongst attention heads in Transformer-based language models. To help users gain insight on how a classification decision is made, our design is centered on depicting classification-based attention at the deepest layer and how attention from prior layers flows throughout words in the input. Attention Flows supports the analysis of a single model, as well as the visual comparison between pre-trained and fine-tuned models via their similarities and differences. We use Attention Flows to study attention mechanisms in various sentence understanding tasks and highlight how attention evolves to address the nuances of solving these tasks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

19 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Interactive and Visual Prompt Engineering for Ad-hoc Task Adaptation with Large Language Models cites VisQA: X-raying Vision and Language Reasoning in Transformers
  • AttentionViz: A Global View of Transformer Attention cites VisQA: X-raying Vision and Language Reasoning in Transformers
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers19

  1. Interactive and Visual Prompt Engineering for Ad-hoc Task Adaptation with Large Language ModelsHendrik Strobelt, Albert Webson, Victor Sanh, Benjamin Hoover et al.IEEE VIS 2022 · 191 citations
  2. AttentionViz: A Global View of Transformer AttentionCatherine Yeh, Yida Chen, Aoyu Wu, Cynthia Chen et al.IEEE VIS 2023 · 78 citations
  3. VisQA: X-raying Vision and Language Reasoning in TransformersTheo Jaunet, Corentin Kervadec, Romain Vuillemot, Grigory Antipov et al.IEEE VIS 2021 · 30 citations
  4. A Unified Interactive Model Evaluation for Classification, Object Detection, and Instance Segmentation in Computer VisionChangjian Chen, Yukai Guo, Fengyuan Tian, Shilong Liu et al.IEEE VIS 2023 · 28 citations
  5. A Visual Analytics System for Improving Attention-based Traffic Forecasting ModelsSeungmin Jin, Hyunwook Lee, Cheonbok Park, Hyeshin Chu et al.IEEE VIS 2022 · 17 citations

Builds on3

  1. Questioning the AI: Informing Design Practices for Explainable AI User ExperiencesQ. Vera Liao, Daniel M. Gruen, Sarah MillerCHI 2020 · 758 citations
  2. On Identifiability in TransformersGino Brunner, Yang Liu, Damian Pascual, Oliver Richter et al.ICLR 2020 · 210 citations
  3. SenseBERT: Driving Some Sense into BERTYoav Levine, Barak Lenz, Or Dagan, Ori Ram et al.ACL 2020 · 27 citations

Related papers

  1. Evolving Attention with Residual ConvolutionsYujing Wang, Yaming Yang, Jiangang Bai, Mingliang Zhang et al.ICML 2021 · 43 citations
  2. VISIT: Visualizing and Interpreting the Semantic Information Flow of TransformersShahar Katz, Yonatan BelinkovEMNLP Findings 2023 · 12 citations
  3. Effective Attention Sheds Light On InterpretabilityKaiser Sun, Ana MarasovicACL Findings 2021 · 8 citations
  4. VL-InterpreT: An Interactive Visualization Tool for Interpreting Vision-Language TransformersEstelle Aflalo, Meng Du, Shao-Yen Tseng, Yongfei Liu et al.CVPR 2022 · 34 citations
  5. Explaining Contextualization in Language Models using Visual AnalyticsRita Sevastjanova, Aikaterini-Lida Kalouli, Christin Beck, Hanna Schäfer et al.ACL 2021
Dusk over the sea between two cliffs drawn in fine vertical lines