Repository navigation
API Reference REST API
The REST API provides synchronous access to the PyTorch backend, handling static introspection and full single-pass analysis.
Returns liveness and whether the model weights are currently loaded into memory.
{ "status": "ok", "model_loaded": true }Extracts the model's structure via named_parameters() without running a forward pass.
Returns: Architecture metadata (layers, hidden size, vocab) and a flat list of all tensors (name, shape, dtype, param count).
Runs a single forward pass on a provided sentence. Used primarily for Walkthrough mode.
Body: { "sentence": "The cat sat" }
Returns:
-
tokens: The tokenized IDs. -
attention: The full 4D attention matrix[layer][head][from][to](sub-0.01 values are zeroed to save bandwidth). -
hidden_states_3d: The hidden states at each layer, projected to 3D via PCA.
Returns the static op_catalog for the loaded model, mapping operations to physical layer indices. Useful for setting programmatic breakpoints.
Intervention endpoint. Zeroes out specified heads or layers using PyTorch forward hooks, runs a forward pass, and returns the modified analyze payload to allow before/after diffing of the Logit Lens.
sequenceDiagram
participant Client
participant FastAPI
participant PyTorch
Client->>FastAPI: POST /analyze {sentence: "Hello"}
FastAPI->>PyTorch: model(input_ids)
PyTorch-->>FastAPI: logits, attentions, hidden_states
FastAPI->>FastAPI: Apply PCA to hidden_states
FastAPI-->>Client: JSON Payload
| Previous | Home | Next |
|---|---|---|
| API Reference | Home | WebSocket Events |
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