Top-p sorts next-token candidates by probability and keeps the leading set until its cumulative mass reaches p. The eligible set shrinks for a sharp distribution and grows for a flatter one.
The demo moves the threshold and highlights eligible bars. Temperature reshapes the distribution, while top-p chooses a subset from it; evaluate their combined effect separately.
When to use
Use it to tune generation variety while excluding low-probability tail candidates.