Softmax & Temperature (T)
In One Sentence
Converts raw scores (logits or utilities) into a probability distribution where temperature T controls how sharp or exploratory sampling is.
ELI5 (Intuition)
Instead of always picking the #1 word robotically, the model rolls weighted dice. Low temperature makes the dice heavily loaded toward the safest choice; high temperature makes them wild and creative.
ELI18 (Technical)
Given logits or action utilities \(z_i\), \[P(i) = \frac{\exp(z_i / T)}{\sum_j \exp(z_j / T)}.\] As \(T \to 0\), sampling approaches deterministic
argmax; as \(T \to \infty\), it approaches uniform random selection.In Practice
Use
temperature = 0.0–0.2 for deterministic code edits, SQL generation, and structured extraction; use 0.7–1.0 for brainstorming or generating diverse candidate rollouts in RL/best-of-N search.