Visualize the internal workings of Large Language Models as they generate text
# Run with PyPI package
uv run --with openmav mav
# Or run directly from GitHub
uv run --with git+https://github.com/attentionmech/mav mav --model gpt2 --prompt "hello mello"
Note: You can replace gpt2
with any other Hugging Face model compatible with transformers:
HuggingFaceTB/SmolLM-135M
gpt2-medium
gpt2-large
meta-llama/Llama-3.2-1B
For gated repos, ensure you have done huggingface-cli login
and your environment has access to it.
- Set up and activate a virtual environment
- Install the package:
# From PyPI pip install openmav # Or from GitHub pip install git+https://github.com/attentionmech/mav
- Run the visualizer:
mav --model gpt2 --prompt "hello mello"
- Or import in your code:
from openmav.mav import MAV MAV("gpt2", "Hello")
- Clone the repository:
git clone https://github.com/attentionmech/mav cd mav
- Set up and activate a virtual environment
- Install in development mode:
pip install .
- Run the visualizer:
mav --model gpt2 --prompt "hello mello"
Check out the documentation.md file for detailed information.
# Run MAV with a training loop and custom model
uv run examples/test_vis_train_loop.py
# Run with custom panel configuration
uv run --with git+https://github.com/attentionmech/mav mav \
--model gpt2 \
--num-grid-rows 3 \
--selected-panels generated_text attention_entropy top_predictions \
--max-bar-length 20 \
--refresh-rate 0 \
--max-new-tokens 10000
- Basic plugins
- Interactive mode
- Limit characters
- Sample with temperature
- Running with custom model
- Panel selection
- Running in Colab notebook
Note: Explore additional options using the command line help, as many sampling parameters are exposed.
Clone the repository and install the package in development mode:
git clone https://github.com/attentionmech/mav
cd mav
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .
@article{attentionmech2025openmav,
title={OpenMAV: Model Activity Visualiser},
author={attentionmech},
year={2025}
}
This project started from a small tweet while testing a simple terminal ui loop: tweet