Jargonautica
Controlling and Extending Behaviour at Run Time

Temperature and Sampling

Also called: Temperature, Sampling

The dial controlling how predictable a model’s output is. At a low setting it consistently picks the most likely next word, giving reliable, repeatable and rather plain output. Turn it up and it takes more chances, producing more varied and creative text but also more errors and nonsense. Low for factual work and code, higher for brainstorming and creative writing.

Technical view

Temperature scales the logits before the softmax, flattening or sharpening the probability distribution over next tokens. Related controls include top-k sampling, restricting choice to the k most likely tokens, and top-p or nucleus sampling, restricting to the smallest set whose cumulative probability exceeds p. Note that even at temperature zero, output is not guaranteed to be perfectly reproducible in practice, because of floating point non-determinism and batching effects on parallel hardware.


Part of AI Terminology Index, section: Controlling and Extending Behaviour at Run Time.

How it connects

Temperature and Sampling links to 13 other terms, and the 12 closest are drawn here. The faint lines are links between those terms. See it in the full graph.

TokensTokensGreedy DecodingGreedy DecodingStructured OutputStructured OutputLogits and SoftmaxLogits and SoftmaxInferenceInferenceChain of ThoughtChain of ThoughtAutoregressive GenerationAutoregressive Gene…Repetition PenaltyRepetition PenaltyProbability DistributionProbability Distrib…Determinism and SeedDeterminism and SeedSelf-consistencySelf-consistencyBeam SearchBeam SearchTemperature and Sampling