What does temperature do?

Knowledge Videos

Short animated explainers, organised by subject.

What does temperature do?

Scores become probabilities, and temperature sharpens or flattens them.

Transcript

A language model does not pick one word. It scores every possible next word, and turns the scores into probabilities.

Then it samples: a random draw, weighted by those probabilities.

Temperature reshapes the probabilities. A low temperature sharpens them, so the top word almost always wins.

A high temperature flattens them, so unlikely words get a real chance.

Run the same prompt several times. At low temperature, the answers are nearly identical.

At high temperature they vary a lot, more creative, but also more likely to wander off.

Low temperature for facts and code. Higher temperature for brainstorming and stories. It is one dial, between reliable and creative.

More in this series