Token Sampling Lab 2D: Temperature, Top-k & Nucleus (Top-p)

Every time a large language model writes a word, it first computes a probability for every token in its vocabulary, then samples one. This 2D simulator lays that process out as three linked panels — a sorted probability bar chart, a draggable cumulative-nucleus curve, and a temperature-response curve — all driven by the same real softmax, top-k and top-p math a 3D bar-ring version of this lab uses. Drag the temperature, top-k, top-p and peak-sharpness sliders (or drag directly on the cumulative curve) to reshape the distribution, then press "Sample next token" to perform a real weighted random draw and append the chosen word to a growing sentence.