model-graph

See your model think.

A live inspector for language models: every layer's activity — norms, heads, router flow, logit lens, attention, residual trajectories — streamed into your browser as the model generates. OpenAI-compatible, testable, honest. The animation behind this card is the actual visualization, running on mock data.

What you see · live mock views

Logit-lens flips

Every layer's residual decoded as if the network stopped there. Dots mark where the prediction changes with depth — red where it settles on the token actually emitted. Settle depth ≈ per-token difficulty.

Residual trajectory

Each token's hidden state as a point in a fixed random 3D basis, connected in generation order — blue dotted trace is the full prompt context. Loops = repeated structure; outliers = attention sinks. Drag-rotate, per-layer minimap in the real app.

Attention sources

Select any token and see where it looked: top attention sources (mean over heads) drawn as arcs over the token strip, with per-token uncertainty (entropy + margin) riding on every frame.

Why it fits your stack

OpenAI-compatible

Point any SDK or agent framework at http://localhost:8080/v1 — zero code change and every request is fully instrumented, recorded and replayable.

Tool calling + multimodal

Spec-compliant tool_calls round-trips (LFM2 pythonic + JSON parsing) and image content parts — vision-language chats are hooked like any other.

Testable internals

The curator records every run and gates CI: internals checks (finite norms, settle depth, uncertainty, attention focus) plus tool-reasoning suites — should-call / abstain / arguments / grounded chains.

Runs in the browser too

Curated models on WebGPU via transformers.js — and an observable-ONNX export that graph-surgeries residual streams into declared outputs, so serverless runs still show real per-layer activity.

Engines at a glance

capabilityserverbrowserbrowser·observable
chat + top-k predictions
tool calling · multimodal
norm heatmaps · heads · lens · arcsresid
residual trajectory + context
curator recording

Run your own · 2 minutes

# clone & env (python 3.11+, torch with your accelerator) git clone https://github.com/QSchlegel/model-graph && cd model-graph python3 -m venv .venv && .venv/bin/pip install -r requirements.txt # full stack: OpenAI API + chat + dashboard + ws internals .venv/bin/python api_server.py --model LiquidAI/LFM2.5-1.2B-Instruct --device mps → http://localhost:8080 (chat at /chat · dashboard at /dashboard) # no GPU / no weights? the entire UI on a mock backend: .venv/bin/python api_server.py --mock # wire in any agent: client = OpenAI(base_url="http://localhost:8080/v1", api_key="x")
# test gates: pipeline sanity + behavioral suites over internals .venv/bin/python harness.py all --model-dir <folder> --fallback-hub LiquidAI/LFM2.5-1.2B-Instruct .venv/bin/python curator.py suite suites/smoke.json .venv/bin/python curator.py suite suites/tools.json # build the observable ONNX model for in-browser internals .venv/bin/python export_observable.py

Works with any HF causal LM — hybrid conv/SSM, MoE and vision-language models are first-class. Apple-silicon (mps), CUDA and CPU devices.

Contribute

Start here

product six-pager (PDF) · the vault (architecture & flow graphs, protocol, engines) · CONTRIBUTING · AGENTS.md keeps humans and AI agents honest about docs.

Good first contributions

suite cases & curator checks (no ML needed) → curated browser engines → dashboard views for attention/entropy → observable-export coverage → hooks for new architectures.

House rules

Honest pixels (never render unmeasured data) · every PR keeps the vault diagrams true · suites green before merge · MIT licensed.