Repository navigation
API Reference Data Models
Sudharsan Selvaraj edited this page Jul 20, 2026
·
1 revision
To ensure the Frontend and Backend agree on the shape of data, TokenPrint defines explicit Pydantic schemas in backend/app/schemas.py. These map directly to TypeScript interfaces in the frontend.
Used by GET /architecture.
{
"source": "model",
"model": "Qwen/Qwen2.5-0.5B-Instruct",
"device": "mps",
"metadata": {
"architecture": "qwen2",
"total_params": 494032768,
"num_layers": 24,
"hidden_size": 896,
"num_heads": 14,
"num_kv_heads": 2,
"head_dim": 64,
"ffn_size": 4864,
"vocab_size": 151936
},
"tensor_count": 290,
"tensors": [
{
"name": "model.embed_tokens.weight",
"shape": [151936, 896],
"dtype": "float32",
"n_params": 136134656
}
]
}Used by POST /analyze.
{
"sentence": "Hello",
"tokens": [
{ "index": 0, "text": "Hello", "id": 15496 }
],
"attention": [
// 4D Array: [layer][head][from_seq][to_seq]
],
"hidden_states_3d": {
"0": [[0.5, -0.2, 0.8]], // PCA projected coords per layer
"1": [[0.4, -0.1, 0.7]]
},
"logit_lens": {
"0": [
{ "id": 45, "text": "The", "prob": 0.05, "logit": 12.4 }
]
}
}In the frontend, these schemas are mapped to strict interfaces (e.g., ArchitectureData, TensorInfo). Avoid using any when parsing these responses.
| Previous | Home | Next |
|---|---|---|
| WebSocket Events | Home | Tensor Format |
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