Repository navigation
Transformer Concepts Softmax
Softmax is a mathematical function that takes an array of raw numbers (Logits) and squashes them into a probability distribution where every value is between
To generate text, we need to know the percentage likelihood of each token being the correct next word. Softmax provides this. Because it uses exponentiation (
In the Live Inference scene, TokenPrint renders the result of the Softmax operation at the very top of the TransformerStack as the Top-k Skyline.
- Skyline Geometry: A row of 3D bars.
-
Data-Driven Height: The height of each bar is strictly tied to its real Softmax
probvalue from the backend stream. - Data-Driven Brightness: To emphasize the exponential nature of Softmax, the brightness/emission of the bar also scales with its probability. The chosen token shines brightly, while the 5th-ranked token is dim.
TokenPrint also uses Softmax heavily in the Walkthrough's Attention chapter, showing how attention scores are squashed into weights that sum to 1.0.
flowchart LR
subgraph Logits
L1[18.2]
L2[17.9]
L3[-12.4]
end
Logits --> Exp[Exponentiate e^x]
subgraph Exponentials
E1[79,997,110]
E2[59,411,586]
E3[0.000004]
end
Exp --> Sum[Sum = 139,408,696]
Exponentials --> Divide[Divide by Sum]
Sum --> Divide
subgraph Probabilities
P1["57.3%"]
P2["42.6%"]
P3["~0.0%"]
end
Divide --> Probabilities
| Previous | Home | Next |
|---|---|---|
| Logits | Home | Sampling |
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