Repository navigation
Developer Guide Adding a New Visualization
This guide explains the workflow for introducing a new 3D geometric representation into the TokenPrint TransformerStack.
If a new architectural feature (like Mixture of Experts) is added to the backend, the frontend must render it. Adding geometry requires plumbing data from the JSON payload all the way into WebGL.
Let's assume you want to visualize a "Router" node for a Mixture of Experts (MoE) model.
If the router probabilities need to be visualized, update the backend's schemas.py and the frontend's TypeScript interfaces to include the new data in the layer_stats or meta payload.
Create a new file in frontend/components/scenes/ (e.g., RouterNode.tsx).
Use Three.js primitives (like CylinderGeometry) or create custom buffer geometry.
export function RouterNode({ expertCount, activeExperts }) {
// Use sceneColors.ts for materials
// Render the geometry
}Open TransformerStack.tsx. Find the layer rendering loop. Insert your <RouterNode /> before the <MlpBlock />.
If the Router is a distinct operation in the execution trace, ensure the backend model.py adds it to the op_catalog.
Update the R3F component to highlight or emit light when store.activeOp matches the router's index.
flowchart TD
Data[Backend Schema Update] --> TS[Frontend TS Interface]
subgraph R3F Development
TS --> Comp[Create RouterNode.tsx]
Comp --> Geo[Define Three.js Geometry]
Comp --> Mat[Map to sceneColors.ts]
end
R3F Development --> Stack[Insert into TransformerStack.tsx]
Stack --> Playback[Tie emission to activeOp]
| Previous | Home | Next |
|---|---|---|
| Code Style | Home | Adding a New Model |
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