Repository navigation
User Guide Live Inference
Live Inference is the dynamic execution mode of TokenPrint. It streams a real greedy generation process token-by-token and visualizes the mathematical operations as geometric shapes in the 3D canvas.
Seeing the data flow through a Transformer Layer demystifies LLMs. Instead of a "black box" that magically outputs text, Live Inference shows the sequential, layer-by-layer computation, revealing how probabilities shift and how the KV Cache grows.
When you enter a prompt and start generation, TokenPrint opens a WebSocket connection (WS /ws/generate) to the PyTorch backend.
- The backend responds with an
op_catalogdefining all operations. - It then streams frames containing the chosen token, top-k probabilities, and per-layer activation statistics.
- The frontend's
PlaybackEnginenormalizes this stream and animates theTransformerStackscene.
Geometry represents data:
- Attention Blades: One blade per real query head.
-
SwiGLU Funnel: Sized according to the real
ffn_size / hidden_sizeratio. - Lighting: Active blocks light up based on their real activation magnitude.
-
Top-k Skyline: At the output layer, a skyline renders the top probabilities for the next token. The height and brightness correspond strictly to the real
probvalue. - KV Phase Readout: The UI clearly distinguishes between the initial prefill phase (processing the whole prompt) and subsequent decode steps.
- Logit Lens Panel: See what the model would predict if you cut the forward pass off at the current intermediate layer.
sequenceDiagram
participant User
participant Frontend
participant Backend
User->>Frontend: Enters Prompt
Frontend->>Backend: WS Connection (trace: true)
Backend-->>Frontend: Frame 0: Op Catalog & Meta
Backend-->>Frontend: Frame 1: Prefill Stats, Token 1
Frontend->>Frontend: Animates Layer 1 -> Layer N
Backend-->>Frontend: Frame 2: Decode Stats, Token 2
| Previous | Home | Next |
|---|---|---|
| Architecture Explorer | Home | Tensor Inspector |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System