Sampling & Decoding Parameters
AI Engineer path · lesson 58 of 124Reshape a real next-token distribution with temperature, cut its tail with top-k or top-p, then sample repeatedly to feel how the knobs trade determinism for diversity — and why T=0 still isn't fully reproducible.
Key insight
Temperature divides the logits before softmax. T < 1 sharpens the distribution toward the top token (T → 0 is greedy argmax); T > 1 flattens it, pushing probability into the tail. It changes the distribution, not the model’s knowledge — high T on a factual prompt literally inflates the probability of wrong answers like “Lyon”.
What each decoding knob actually does
Sort each parameter by how it changes the next-token choice.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Reshapes the probabilities
Drop items hereCuts candidates out
Drop items hereTest your knowledge
Where does temperature apply in the decoding pipeline?
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required