Model Activation Visualizer
Project description
+===========================================================================+
| _____ _____ _____ |
| /\ \ /\ \ /\ \ |
| /::\____\ /::\ \ /::\____\ |
| /::::| | /::::\ \ /:::/ / |
| /:::::| | /::::::\ \ /:::/ / |
| /::::::| | /:::/\:::\ \ /:::/ / |
| /:::/|::| | /:::/__\:::\ \ /:::/____/ |
| /:::/ |::| | /::::\ \:::\ \ |::| | |
| /:::/ |::|___|______ /::::::\ \:::\ \ |::| | _____ |
| /:::/ |::::::::\ \ /:::/\:::\ \:::\ \ |::| | /\ \ |
|/:::/ |:::::::::\____\/:::/ \:::\ \:::\____\ |::| | /::\____\|
|\::/ / ~~~~~/:::/ /\::/ \:::\ /:::/ / |::| | /:::/ /|
| \/____/ /:::/ / \/____/ \:::\/:::/ / |::| | /:::/ / |
| /:::/ / \::::::/ / |::|____|/:::/ / |
| /:::/ / \::::/ / |:::::::::::/ / |
| /:::/ / /:::/ / \::::::::::/____/ |
| /:::/ / /:::/ / ~~~~~~~~~~ |
| /:::/ / /:::/ / |
| /:::/ / /:::/ / |
| \::/ / \::/ / |
| \/____/ \/____/ |
+===========================================================================+
Getting started
If uv is installed:
uv run --with openmav mav
or
uv run --with git+https://github.com/attentionmech/mav mav --model gpt2 --prompt "hello mello"
Without uv:
-
Set up and activate a virtual environment
-
Install the package:
pip install openmav
or
pip install git+https://github.com/attentionmech/mav
-
Run:
mav --model gpt2 --prompt "hello mello"
Locally from scratch
- git clone https://github.com/attentionmech/mav
- cd mav
- Set up and activate a virtual environment
- Install the package:
pip install .
- Run:
mav --model gpt2 --prompt "hello mello"
You can replace gpt2 with other Hugging Face models for example:
meta-llama/Llama-3.2-1BHuggingFaceTB/SmolLM-135Mgpt2-mediumgpt2-large
Note: quantized models aren't supported right now
Demos
Explanation
At every point in prediction, multiple next tokens are possible, each with a different confidence level. The tokens and the numbers near them represent these probabilities.
Layer-wise Activations
Activations are numerical values representing the forward pass through the network during inference. Each layer (or block) in GPT-style models typically consists of:
- An MLP sub-block
- An attention sub-block
For the MLP sub-block, we plot the L2 norm of activations per layer. Other metrics like average or max exist but don’t provide as much intuitive insight.
Attention Sub-block
For the attention sub-block, we measure entropy. In transformer architectures, attention determines how tokens influence one another. The entropy value gives a rough indication of how widely the attention is spread:
- Low entropy → Sharp token-to-token relationships
- High entropy → A broader, more diffused attention span
These are just intuitive explanations—it's best to study these concepts from multiple sources to build a solid understanding.
Contributing
IMP NOTE: The design is not good for scaling it right now to multiple backends, and stuff which i am planning.. so your pull requests will have to wait for sometime
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openmav-0.0.4.tar.gz.
File metadata
- Download URL: openmav-0.0.4.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5545ec8b34ad1a485edefb1061b0730e1e5698708258584cda99de5c1db42a8b
|
|
| MD5 |
45d78d9f49ba1748444e68617071f907
|
|
| BLAKE2b-256 |
c4f9f491bb61be04a39c53ec213fdecb9ef4b65d5624ca6a6db00f6f9210a1ba
|
File details
Details for the file openmav-0.0.4-py3-none-any.whl.
File metadata
- Download URL: openmav-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2ab11a67633b004440b5144cfdc3c1492b31ce7b8d602962d3a5ccd363cd73f
|
|
| MD5 |
2587b017468512a62dbb2c9c7f93aad7
|
|
| BLAKE2b-256 |
5e4c0235b8b3d76e0af82925a07ff1b1e684b284dbe581fffd608bf4e1d35ab5
|