#221 · Primary category: Education & Research

bertviz

bert gpt2 machine-learning natural-language-processing neural-network nlp pytorch roberta transformer transformers visualization

BertViz: Visualize Attention in Transformer Models

Project last updated:01/08/26

GitHub Stars

8.2K

Forks

885

Contributors

6

License

Apache-2.0

Why we included this project

BertViz is the tool to reach for when you want to actually see what a transformer's attention heads are doing rather than trusting the numbers. It plugs into a Jupyter or Colab notebook with a short Python API and supports most Hugging Face models, so you can point it at BERT, GPT-2, or RoBERTa and get three lenses on the same mechanism: a head view for individual attention heads, a model view for the full sweep across all layers, and a neuron view that traces how query and key neurons combine into attention scores. That last one is especially handy when you're trying to explain, or debug, why a model fixates on certain tokens. It's a teaching and inspection tool, not something you'd ship in production, but for making the attention mechanism legible it's hard to beat.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category