Concept

Using Temperature with Softmax to Control Randomness in Token Selection

The randomness of token selection in large language models can be finely controlled by applying a temperature parameter, β\beta, to the Softmax function, which adjusts the sharpness of the probability distribution derived from the raw logits. A higher temperature value diminishes the differences between logits, making the probability distribution more uniform and giving all candidate tokens a more equal chance of being selected, thereby increasing the diversity of the generated output. Conversely, setting the temperature to a lower value sharpens the distribution, increasing the likelihood of selecting high-probability tokens and leading to more deterministic outputs. For instance, setting the Top-pp threshold to 11 and the temperature close to zero makes the sampling process equivalent to a greedy search.

Image 0

0

1

Updated 2026-05-05

Contributors are:

Who are from:

Tags

Ch.5 Inference - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

Related