Definition

Temperature

Temperature changes the distribution used to sample the next token. A positive temperature divides each logit before softmax. Smaller values concentrate probability on higher-scored tokens. Larger values make the distribution flatter. Greedy decoding selects the highest-scored token directly.

Change the probability of a token with two possible choices

Consider two logits, 2 and 0, with no other sampling filters. At temperature 1, the first token has about 88.1% probability. At temperature 2, the logits become 1 and 0, and its probability falls to about 73.1%. Lowering the temperature can make answers more consistent, so test accuracy separately on the same tasks.

Transformers generation and sampling parameters

Intelligence at Scale by Shashank Agarwal

Temperature diagram from Intelligence at Scale
Diagram from chapter 5, Inside the Machine

Explained in

Chapter 5: Inside the Machine

Everything you need to know about what's happening inside the box. No PhD required.

Related terms

This is one term. The chapter is the argument.

Intelligence at Scale: 22 chapters, 65,000 words, 80-plus diagrams. Kindle, paperback and hardcover on Amazon.

Buy on Amazon.com
← All terms