Inference VisualizerToken Stream·Interactive Tool
LLM Token Generation & Entropy Distribution Heatmap
Inspect real-time autoregressive token generation with log-probability distributions, top-p/top-k filtering, and temperature controls.
Live Hardware-Accelerated ViewportDrag to rotate · Interact with controls
System Architecture & Engineering Concept
Gain transparency into autoregressive token decoding. Watch the next-token probability distribution unfold token-by-token with color-coded entropy heatmaps, showcasing the statistical difference between greedy sampling (temp 0.0) and creative hallucination (temp 1.4+).
Mathematical Formulation / Heuristic:
Softmax with Temperature: P(x_i) = exp(z_i / T) / sum_j(exp(z_j / T)), followed by Top-p Nucleus truncation: sum(P(x)) >= p.
Implementation Highlights
- Real-time distribution bar chart dynamically recalculated for every token generation step.
- Token entropy calculation H(X) = -sum(p(x) * log2(p(x))) visualizing model uncertainty.
- Interactive temperature and Top-P slider adjustments with instant feedback.
Interactive Parameters
Run Inference
Stream tokens one by one with live probability updates
Temperature Slider
Flatten or sharpen the probability distribution curve
Top-P Cutoff
Truncate low-probability tail tokens in real-time
Core Engine LoopTypeScript
function sampleWithTemperature(logits, temperature = 0.7, topP = 0.9) {
const scaled = logits.map(l => l / temperature);
const probs = softmax(scaled);
return nucleusSample(probs, topP);
}