DECODING · TEMPERATURE · SEEDED DRAWS
Temperature sampling: reshape and inspect probabilities
Scale eight fixture logits by a temperature, compute stable or naive softmax, and draw seeded samples to see when the tail starts to speak.
Your experiment
The prompt is "The capital of France is" with eight candidates, three of them wrong. Start at temperature 1.5, then lower it to 1, 0.7 and 0, raise it to 2, take more draws, change the seed, and switch off stable softmax at temperature 0.05.
Play replays the computed run over sixty inspection seconds; Next event steps, Restart rewinds, Speed changes the pace and Inspection time scrubs. Any input change recomputes the run and rewinds it without autoplay.
Event trace
Computed data
Final metrics
Fixture logits for one prompt, not a trained model; the wrong-continuation labels are part of the fixture. Draws use a seeded generator (mulberry32) over the computed probabilities, so the same settings always give the same draws. Temperature 0 is treated as greedy decoding. Arithmetic is JavaScript float64.
Eight candidates, one prompt
The prompt is The capital of France is, with 8 candidate tokens whose raw logits run from 29.9 to 38.5. Three continuations are wrong or meaningless: Lyon, Berlin and 42. Temperature divides every logit before softmax. At the opening temperature of 1.5, Paris has 71.03% of the probability, the entropy is 1.486 bits, about 2.8 effective choices, and the three wrong continuations hold 2.99% of the mass. Sixty seeded draws produce 3 of them: WRONG CONTINUATION DRAWN.
Lower and higher temperatures
At temperature 1 Paris rises to 88.42%, the entropy falls to 0.727 bits and the wrong mass to 0.59%; the 60 seeded draws contain none, against an expected 0.35. At 0.7 Paris has 96.77% and at 0.5 it has 99.42%. At 2 the distribution flattens to 57.06% for Paris, 1.988 bits and 6.38% wrong mass, and 4 of 60 draws are wrong. Temperature never reorders the candidates; it only changes how much probability reaches the tail.
Zero is special and overflow is real
Temperature 0 would divide by zero, so it is treated as greedy decoding: Paris every time. Clear Stable softmax and set the temperature to 0.05: the scaled logits reach 770, exp(770) is beyond the largest float64 (near exp(709.78)) and becomes Infinity, Infinity divided by Infinity is NaN, and the run fails with NUMERIC OVERFLOW. At 0.1 the largest term is exp(385), about 1.6e167, still finite. Stable softmax subtracts the largest scaled logit first, so its largest term is always exp(0) = 1 and no temperature in the range overflows. The checkbox is tested at temperature 0.05.
Draws are a sample, not the distribution
Seeded draws and Sampling seed change only which tokens come out. At temperature 1 the opening seed 7 draws no wrong continuation in 60, seed 1 draws 2, and 200 draws with seed 7 also contain 2. The chart tracks the running share of Paris against its probability: it wanders early and settles as draws accumulate. A clean short sample does not mean the tail is empty.
Reading the run and its limits
Play, Next event, Restart, Speed and Inspection time step through the setup, the scaling, the softmax, eight batches of draws and the verdict across sixty inspection seconds; the table lists each token with its logit, probability and draw count. The logits are a fixture for one prompt rather than the output of a trained model, and the wrong-continuation labels are part of the fixture. Real decoders combine temperature with filters and penalties, which other labs cover.