An interactive tool to analyze and intervene on LLM internal states. Now updated to support TransformerLens backend.
Now support visualize Attention and TransformerLens Backend
| Attention Visualization | TransformerLens Backend |
|---|---|
![]() | ![]() |
saved_states/ directory.config.json filetensors.npz file (hidden_states, layer_names, state_kinds, lens_type, post_attention_states, …). Layout depends on the logit-lens mode (block_output, combined, or post_attention); use session_tensors.load_session_archive() in notebooks.
tensors.npz file.tensors.npz file is large. Keep it in mind. (73MB for 3.2 3B 51 tokens)attention_visualizations/ directory.Backend:
# Recommended: custom + TransformerLens backends
uv sync --extra transformerlens
# Custom backend only (smaller install; TransformerLens option disabled in UI)
uv sync
Frontend:
cd frontend
npm install
In order to access Llama models from meta-llama you would need to set up a huggingface token.
The tool now supports two backend implementations:
You can switch between backends in the frontend UI. The UI provides:
Start the Backend:
uv run uvicorn server_v2:app --reload --port 8000
Start the Frontend:
cd frontend
npm run dev
Open http://localhost:5173 in your browser.
If a model is not in your local Hugging Face cache, the UI prompts before downloading from the Hub. While downloading, the app may look frozen—check the backend terminal for progress (gated models need HF_TOKEN).
Stream intervention's Attention Output modification modifies the attention output right before adding to the residual stream. Thus, this intervention wouldn't be seen in visualize attention.
To verify both backends work correctly, run:
# Compare Custom vs TransformerLens output (comprehensive test)
uv run python tests_backend/test_backend_parity.py
# Detailed normalization and probability comparison
uv run python tests_backend/test_norm_debug.py
# Test attention blocking
uv run python tests_backend/test_attention_blocking.py
# Basic backend functionality test
uv run python tests_backend/test_backends.py
Expected Results:
If you use this tool in your research, please cite the repository and the methods it builds on.
@software{logit_lens_llama_advanced,
author = {Kim, Sungwon},
title = {Logit Lens Llama Advanced},
year = {2026},
url = {https://github.com/blindTissue/logit_lens_llama_advanced},
note = {Interactive logit lens visualization and intervention for LLMs}
}
MIT
27 commits
Python
60.2%
TypeScript
33.1%
Jupyter Notebook
5.3%
CSS
1.0%
An interactive tool to analyze and intervene on LLM internal states. Now updated to support TransformerLens backend.
Now support visualize Attention and TransformerLens Backend
| Attention Visualization | TransformerLens Backend |
|---|---|
![]() | ![]() |
saved_states/ directory.config.json filetensors.npz file (hidden_states, layer_names, state_kinds, lens_type, post_attention_states, …). Layout depends on the logit-lens mode (block_output, combined, or post_attention); use session_tensors.load_session_archive() in notebooks.
tensors.npz file.tensors.npz file is large. Keep it in mind. (73MB for 3.2 3B 51 tokens)attention_visualizations/ directory.Backend:
# Recommended: custom + TransformerLens backends
uv sync --extra transformerlens
# Custom backend only (smaller install; TransformerLens option disabled in UI)
uv sync
Frontend:
cd frontend
npm install
In order to access Llama models from meta-llama you would need to set up a huggingface token.
The tool now supports two backend implementations:
You can switch between backends in the frontend UI. The UI provides:
Start the Backend:
uv run uvicorn server_v2:app --reload --port 8000
Start the Frontend:
cd frontend
npm run dev
Open http://localhost:5173 in your browser.
If a model is not in your local Hugging Face cache, the UI prompts before downloading from the Hub. While downloading, the app may look frozen—check the backend terminal for progress (gated models need HF_TOKEN).
Stream intervention's Attention Output modification modifies the attention output right before adding to the residual stream. Thus, this intervention wouldn't be seen in visualize attention.
To verify both backends work correctly, run:
# Compare Custom vs TransformerLens output (comprehensive test)
uv run python tests_backend/test_backend_parity.py
# Detailed normalization and probability comparison
uv run python tests_backend/test_norm_debug.py
# Test attention blocking
uv run python tests_backend/test_attention_blocking.py
# Basic backend functionality test
uv run python tests_backend/test_backends.py
Expected Results:
If you use this tool in your research, please cite the repository and the methods it builds on.
@software{logit_lens_llama_advanced,
author = {Kim, Sungwon},
title = {Logit Lens Llama Advanced},
year = {2026},
url = {https://github.com/blindTissue/logit_lens_llama_advanced},
note = {Interactive logit lens visualization and intervention for LLMs}
}
MIT
27 commits
Python
60.2%
TypeScript
33.1%
Jupyter Notebook
5.3%
CSS
1.0%