Attention Is All You Need to See
Because staring at raw attention matrices is no way to debug a language model.

What it does
BertViz renders attention patterns from transformer language models inside Jupyter or Colab notebooks. Through a Python API, it pulls attention weights from most Hugging Face models and maps them onto your input tokens. You can inspect individual heads, scan across all layers, or drill down to specific neurons.
The interesting bit
The tool extends the original Tensor2Tensor visualizer but adds a rare “neuron view” that exposes how individual query and key neurons compute attention scores. Because the standard Hugging Face API hides those vectors, the authors ship custom BERT, GPT-2, and RoBERTa implementations to make that view work.
Key highlights
- Supports most Hugging Face transformers via
head_viewandmodel_view - Handles encoder-decoder models like BART and T5, including cross-attention splits
- Neuron view decomposes attention into query and key vector components
- Layer and head filtering to keep visualizations responsive on larger models
- Dark mode and light mode available
Caveats
- Neuron view requires BertViz’s own model variants; it won’t work with arbitrary Hugging Face checkpoints
- Visualizations can take a few seconds to render, and larger models may need aggressive layer filtering to stay interactive
Verdict
Best suited for researchers and practitioners inspecting attention in Hugging Face models inside notebooks. Not designed for production monitoring or non-interactive pipelines.
Frequently asked
- What is jessevig/bertviz?
- Because staring at raw attention matrices is no way to debug a language model.
- Is bertviz open source?
- Yes — jessevig/bertviz is open source, released under the Apache-2.0 license.
- What language is bertviz written in?
- jessevig/bertviz is primarily written in Python.
- How popular is bertviz?
- jessevig/bertviz has 8.1k stars on GitHub.
- Where can I find bertviz?
- jessevig/bertviz is on GitHub at https://github.com/jessevig/bertviz.