See how temperature, top-k, and top-p reshape a token probability distribution in real time. Understand the math behind every sampling knob.
Adjust temperature to reshape the distribution. Then layer on top-k or top-p filtering to see which tokens survive.
Why you must apply temperature before top-k. The correct pipeline is temperature first, then filtering — applying them in reverse subtly changes the distribution.
Temperature reshapes the logits, then top-k filters the scaled distribution. Temperature controls which tokens are kept by changing their relative ranks.
Top-k is applied to raw logits, locking in a fixed set of candidates. Temperature then scales within this fixed set, unable to influence which tokens survived.
Draw 100 tokens from the current distribution to see how the empirical sample frequencies compare to the theoretical probabilities.