jessevig/bertviz

BertViz: Visualize Attention in Transformer Models

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 27 minutes ago
Added to GitGenius on September 8th, 2026
Created on December 16th, 2018
Open Issues & Pull Requests: 22 (+0)
GitHub issues: Enabled
Number of forks: 884
Total Stargazers: 8,174 (+0)
Total Subscribers: 72 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

BertViz is a visualization tool for understanding attention mechanisms in Transformer language models.

The tool addresses the challenge of interpreting how Transformer models allocate attention across input tokens by providing interactive visualizations that expose the internal workings of attention heads and layers. It works by hooking into Huggingface Transformer models and rendering attention weights through multiple complementary views: the head view shows attention patterns for specific heads within a layer, the model view provides an overview of attention across all layers and heads simultaneously, and the neuron view breaks down how individual neurons in query and key vectors contribute to computing attention scores.

Researchers and practitioners debugging Transformer behavior, understanding model predictions, or exploring how different architectures process language should consider this tool. It suits exploratory work in Jupyter notebooks and Colab environments where interactive visualization is valuable. The tool supports most Huggingface models, making it broadly applicable across BERT, GPT-2, RoBERTa, and other Transformer variants. The README does not name alternative visualization tools for comparison.

The project maintains active engagement with users through sample notebooks and an interactive Colab tutorial that allows experimentation without local setup. Development appears responsive to practical needs, as evidenced by support for multiple visualization perspectives and accommodation of different model architectures including encoder-decoder variants. The codebase includes documentation covering additional use cases beyond the basic examples.