llm-viewer is a local visualizer for Hugging Face text generation model configs.
Drop a config.json into the browser. Backend computes a normalized graph bundle. Frontend renders:

- model structure
- data flow
- tensor shapes
prefill/decodedifferences- block-level detail view
Goal: make LLM architecture inspection feel closer to Netron, but for Hugging Face model_config.json plus runtime shape profiles instead of exported ONNX graphs.
- local browser app powered by
FastAPI - drag-and-drop
config.json prefillanddecodegraph profiles- symbolic shape inference from
transformersconfig semantics
- symbolic shape inference from
- model graph and transformer block graph
- shape-aware edges and node summaries
- model summary sidebar from
model_config.json - double-click repeated block to jump into block detail
- pan, zoom, fit, reset
Current decoder-family support:
code_llamadiffllamadogegraniteheliumllamaministralmistralolmoqwen2qwen3gemmagemma2gemma3_textgemma4_textseed_osssmollm3stablelm
Install in editable mode:
python -m pip install -e .Core runtime dependencies include fastapi, uvicorn, and transformers.
Start the app:
llm_viewerThis starts a local server and opens a browser tab.
You can also run without install:
PYTHONPATH=src python -m llm_viewerStart browser app:
llm_viewerExport graph JSON:
llm_viewer extract path/to/config.json --profile prefillChoose profile explicitly:
llm_viewer extract path/to/config.json --profile decode --output graph.jsonSample configs live in examples/:
llm-viewer has two layers:
- Backend:
- parses
config.json - selects an adapter by
model_type - builds a normalized graph bundle for a runtime profile
- parses
- Frontend:
- uploads config to backend
- renders graph, edges, labels, and side panels
Current implementation focuses on a normalized graph abstraction, not exact kernel-level execution tracing.
It does not run the model for shape inference. Backend resolves the Hugging Face config class through transformers and derives symbolic shapes from that config semantics.
src/llm_viewer/
adapters/ model-family graph builders
static/ browser frontend
cli.py CLI entrypoint
server.py FastAPI app
schema.py graph bundle schema
tests/
examples/
Run tests:
pytest -qRun app in-place:
PYTHONPATH=src python -m llm_viewerThanks to:
- Netron for excellent model visualization ideas and high-quality open source code references
- Hugging Face Transformers for the model implementations and config ecosystem this project builds on
- the broader open source LLM tooling community for making model inspection and understanding easier
This project is still MVP-stage.
Good now:
- graph extraction for supported decoder families
- browser visualization flow
- model/block graph switching
- residual path rendering
Still rough:
- layout quality for dense graphs
- richer source/code mapping
- more model families beyond current decoder set
- better graph semantics for non-transformer architectures
MIT. See LICENSE.