VISIT: Visualizing and Interpreting the Semantic Information Flow of Transformers

Shahar Katz, Yonatan Belinkov
5/22/2023
cs.CL

No official code found. Best implementation: shacharKZ/VISIT-Visualizing-Transformers (25 stars, MIT, last commit 2024-04-03). 1 more below.

Abstract

Recent advances in interpretability suggest we can project weights and hidden states of transformer-based language models (LMs) to their vocabulary, a transformation that makes them more human interpretable. In this paper, we investigate LM attention heads and memory values, the vectors the models dynamically create and recall while processing a given input. By analyzing the tokens they represent through this projection, we identify patterns in the information flow inside the attention mechanism. Based on our discoveries, we create a tool to visualize a forward pass of Generative Pre-trained Transformers (GPTs) as an interactive flow graph, with nodes representing neurons or hidden states and edges representing the interactions between them. Our visualization simplifies huge amounts of data into easy-to-read plots that can reflect the models' internal processing, uncovering the contribution of each component to the models' final prediction. Our visualization also unveils new insights about the role of layer norms as semantic filters that influence the models' output, and about neurons that are always activated during forward passes and act as regularization vectors.

View on arXivView PDF

Code Implementations(2)

MIT
252Python, Jupyter NotebookOct 17, 20232 years agoMIT
MIT
100HTML, PythonMay 18, 20233 years agoMIT

Similar Papers

Cite this paper

@article{katz2023visit,
  title  = {VISIT: Visualizing and Interpreting the Semantic Information Flow of Transformers},
  author = {Shahar Katz and Yonatan Belinkov},
  year   = {2023},
  eprint = {2305.13417},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.13417v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.13417.svg)](https://codeofpaper.com/paper/2305.13417)

Discussion