BertViz

BertViz

โ˜… 4 ๐Ÿ”– 2500 saves ๐Ÿ’ฐ Free GitHub

BertViz is an open-source tool for visualizing attention in transformer language models, published on GitHub with around 8,200 stars. It turns the attention weights inside models like BERT, GPT-2, and RoBERTa into interactive visualizations you can explore directly inside Jupyter notebooks.

Overview

Attention is the core mechanism of transformers, but raw attention matrices are hard to interpret. BertViz renders them at three complementary levels of detail. The attention-head view shows how individual heads connect tokens to each other. The model view gives a bird’s-eye picture of attention patterns across all layers and heads at once. The neuron view goes deepest, exposing the individual neurons that compose attention scores so you can see exactly why a head links two words. BertViz works with models loaded through Hugging Face Transformers, requires only a few lines of code to launch, and has become a standard teaching and debugging aid: it is widely used in courses, interpretability research, and blog posts explaining how transformers actually process language. The tool is still maintained, with updates continuing into 2026.

Key Features

  • Interactive attention-head view linking tokens across a sentence
  • Model view summarizing patterns across every layer and head
  • Neuron view decomposing attention into individual neurons
  • Supports BERT, GPT-2, RoBERTa, and other Hugging Face models
  • Runs in Jupyter notebooks with just a few lines of code
  • Widely used standard tool for transformer interpretability

๐Ÿ’ณ Pricing

BertViz is free and open source under the Apache-2.0 license. Install it from PyPI or GitHub and use it in your own notebooks at no cost.

Who Is It For

BertViz is for NLP researchers, students, and ML engineers who want to understand, debug, or teach transformer behavior โ€” seeing concretely which words a model attends to instead of treating attention as a black box.

๐Ÿš€ Visit BertViz Official Site

๐Ÿšฉ Report an issue