Course 6, lesson 55 of 100, Ages 12+
Temperature
Creative or careful answers
Like I’m 5
Some AI settings are like a creativity dial. Turn it down and the AI gives safe, predictable answers. Turn it up and it gets more surprising and creative.
The big idea
When an LLM picks the next token, it has a probability for every option. Temperature changes how it chooses: low temperature almost always picks the most likely token, high temperature gives less likely tokens a chance.
Low temperature suits facts, maths and code, where you want consistency. Higher temperature suits brainstorming, poems and story ideas. Too high, and answers become random or nonsensical.
Examples
- Low: 'The capital of France is Paris', every time.
- High: Ten wildly different names for your pet dragon.
- Too high: Sentences that drift into nonsense.
How it works
- The model scores every possible next token.
- Temperature sharpens or flattens those chances.
- A token is picked, and the process repeats.
Check your understanding
- Which temperature suits answering a maths question?
- Options: Low; Very high; It doesn't matter at all.
Answer: Low. Low temperature keeps answers consistent and focused. - What happens if temperature is set far too high?
- Options: Answers can become random nonsense; Answers get shorter; The computer overheats.
Answer: Answers can become random nonsense. Too much randomness picks unlikely tokens and loses the thread.
Remember
Temperature controls randomness: low for careful answers, higher for creative ones.
Talk about it
Would you want low or high temperature for writing a birthday poem? Why?
Go deeper
Temperature divides the logits before the softmax. Related sampling settings include top-k and top-p (nucleus) sampling, which limit choices to the most likely tokens.