Repository navigation
Architecture Data Pipeline
Sudharsan Selvaraj edited this page Jul 20, 2026
·
1 revision
The Data Pipeline traces the lifecycle of a tensor from its raw bytes on a hard drive to its final geometric representation in the WebGL canvas.
Understanding the pipeline helps contributors know exactly where to intercept data if they want to build new features (e.g., if you want to add a new visualization, do you intercept the data in PyTorch, in the JSON payload, or in the React component?).
There are two primary pipelines in TokenPrint:
-
Disk:
.gguffile resides on the user's hard drive. -
Browser API:
File.slice()reads binary chunks. -
Parser:
lib/gguf/extracts key-value metadata and the tensor inventory. -
Renderer:
lib/pointcloud.tsconverts the inventory intoTHREE.Points.
- Disk: PyTorch loads HuggingFace safetensors into VRAM (MPS/CUDA).
-
Inference:
model.pyexecutes a forward pass, explicitly capturing attention states viaattn_implementation="eager". -
Serialization:
schemas.pyconverts complex PyTorch tensors into Python dictionaries, rounding floats to save bandwidth. - Transport: FastAPI sends the dict as a JSON string over WebSockets.
-
Deserialization:
store.tsparses the JSON and queues it for thePlaybackEngine. -
Renderer: The
TransformerStackcomponents read the queued data and update Material properties.
flowchart TD
subgraph Pipeline 1: Static GGUF
Disk1[Local .gguf] --> Slice[File.slice API]
Slice --> TSParser[lib/gguf/]
TSParser --> Points[THREE.Points]
end
subgraph Pipeline 2: Dynamic Inference
Disk2[HuggingFace Cache] --> RAM[PyTorch VRAM]
RAM --> FwdPass[Eager Forward Pass]
FwdPass --> JSON[Pydantic Serialization]
JSON --> Socket[WebSocket]
Socket --> Playback[Zustand PlaybackEngine]
Playback --> R3F[TransformerStack Geometry]
end
| Previous | Home | Next |
|---|---|---|
| WebSocket Protocol | Home | Renderer |
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