Repository navigation
Transformer Concepts Sampling
Sampling is the process of choosing the actual next token from the probability distribution generated by the Softmax function.
If you always pick the token with the highest probability (Greedy Decoding), the model's output will be deterministic, safe, and often boring or repetitive. By introducing randomness (Temperature, Top-P, Top-K), you allow the model to be creative.
Warning Current Status: TokenPrint currently enforces Greedy Decoding on the backend.
token = torch.argmax(logits, dim=-1)
Because TokenPrint is an educational and debugging tool, determinism is currently favored over creativity. When you type a prompt, you will see exactly how the model determines the #1 most mathematically likely token.
The WS /ws/generate backend endpoint does calculate top_k probabilities to render the Skyline in the UI, but it does not use them to sample stochastically. The SamplingPlayground is currently scheduled for an upcoming milestone in the Roadmap.
flowchart TD
Probs[Probability Distribution] --> Greedy{Decoding Strategy}
Greedy -- Greedy (TokenPrint Default) --> Max[Pick Highest %]
Greedy -- Stochastic (Planned) --> Temp[Apply Temperature]
Temp --> TopK[Filter Top K]
TopK --> TopP[Filter Top P Mass]
TopP --> Roll[Roll Dice]
Max --> Token[Chosen Token]
Roll --> Token
| Previous | Home | Next |
|---|---|---|
| Softmax | Home | Autoregressive Generation |
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