← Concept Index

Reasoning & inference

Temperature and sampling

Also called: randomness, creativity setting, top-p

DEFINITION

At each step the model has a probability distribution over next tokens. Sampling settings control how it picks from that distribution: temperature flattens or sharpens the odds (higher = more willing to pick an unlikely token), while top-p (nucleus) sampling only ever picks from the smallest set of tokens whose probabilities add up to p, ignoring the long tail entirely.

WHY IT MATTERS

It's why the same prompt gives different answers, and why 'be more creative' and 'be exact and repeatable' pull in opposite directions. For consistent, checkable output you want low randomness.

COMMONLY CONFUSED WITH

Intelligence or effort. A higher temperature isn't 'thinking harder'; it's just more willing to pick unlikely words.