KnowML
Interactive

Sampling Lab

A model does not pick a word. It produces one row of numbers, and everything that decides which token you see happens afterwards. Step through that afterwards — softmax, temperature, top-k, top-p, and the draw itself — on one seeded example you can follow end to end.

Step through at your own pace · prerequisites: none beyond knowing what a logit is

How to use this page ▾

Start with Softmax — every later tab operates on the distribution it builds. Two prompts run throughout: a focused one ("The cat sat on the ___"), where the model is nearly certain, and an open one ("On Saturday I went down to the ___"), where a dozen continuations are about equally good. That pairing is the point: the Top-p tab shows a case where top-k and top-p choose genuinely different candidate sets, in opposite directions on the two rows, which is the whole argument for nucleus sampling. The Softmax tab also checks its own arithmetic — that the row sums to 1, that subtracting the max changes nothing, and that skipping it returns NaN.

What this page simplifies, on purpose

Related pages