Asked about How a model picks the next token

What is the difference between temperature and top-p?

An answer that works

Temperature rescales the whole probability distribution, making peaks sharper or flatter. top-p truncates it, keeping the smallest set of tokens whose probabilities sum to p and sampling among those. Change one of them, not both, or the interaction becomes hard to reason about.

Reading an answer is not being able to give one. The section that teaches this is How a model picks the next token, 3 hours of Sampling & decoding.

Learn this properly