Dodrio: Exploring Transformer Models with Interactive Visualization

crown jewel figure
The Dodrio user interface showing user exploration of connections between attention weights from a fine-tuned BERT model and syntactic dependencies as well as semantic saliency scores on the SST2 dataset. (A) In the Dependency View, a user hovers over a word from the input sentence, highlighting its associated dependency directed links as orange arcs (lighter is source; darker is target). (B) Semantic Attention Graph highlights the word’s related tokens and their attentions; nodes are tokens (darker means more salient), a directed edge encodes attention weight between two tokens.(C) The Attention Head Overview shows all attention heads in a multi-layer and multi-head model as a grid of circles, each head is (D) colored based on its linguistic knowledge in the model (more red → more semantic-aligned, more blue → more syntactic-aligned; darker → more aligned), and sized based on its importance score in the model (larger → more important)
Demo Video
Abstract
Why do large pre-trained transformer-based models perform so well across a wide variety of NLP tasks? Recent research suggests the key may lie in multi-headed attention mechanism's ability to learn and represent linguistic information. Understanding how these models represent both syntactic and semantic knowledge is vital to investigate why they succeed and fail, what they have learned, and how they can improve. We present Dodrio, an open-source interactive visualization tool to help NLP researchers and practitioners analyze attention mechanisms in transformer-based models with linguistic knowledge. Dodrio tightly integrates an overview that summarizes the roles of different attention heads, and detailed views that help users compare attention weights with the syntactic structure and semantic information in the input text. To facilitate the visual comparison of attention weights and linguistic knowledge, Dodrio applies different graph visualization techniques to represent attention weights with longer input text. Case studies highlight how Dodrio provides insights into understanding the attention mechanism in transformer-based models. Dodrio is available at https://poloclub.github.io/dodrio/.
Citation
Dodrio: Exploring Transformer Models with Interactive Visualization
@inproceedings{wangDodrioExploringTransformer2021,
  title = {Dodrio: {{Exploring Transformer Models}} with {{Interactive Visualization}}},
  author = {Wang, Zijie J. and Turko, Robert and Chau, Duen Horng},
  shorttitle = {Dodrio},
  booktitle = "Proceedings of the Joint Conference of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations",
  year = {2021},
  address = "Online",
  publisher = "Association for Computational Linguistics",
  pages = "132--141",
  url = {https://zijie.wang/papers/dodrio/}
}