Category · Models and how they work
What is temperature in a language model?
Temperature is the setting that controls how much chance goes into choosing tokens. When it is low, answers are more consistent; when it is high, they are more varied. Even at zero, two answers are not always identical.
By Laurent Poupet, Claude trainer and artificial intelligence architect · Updated
How it works
- Technically, it divides the scores of the possible tokens before the draw; the lower it is, the more clearly the most likely token wins.
- For extraction or classification it is set as low as possible for consistency; for writing or brainstorming, a medium value adds variety.
- For an agent, a low temperature suits the choice of tools and their arguments, where consistency matters more than originality.
The trap to avoid
The trap is tuning the temperature to make up for a bad prompt; a vague instruction stays vague, whatever the dose of chance.
Related terms
- TokenModels and how they work
- PromptModels and how they work
- TransformerModels and how they work
Where this is taught
Track 4 · Programming with Claude and going live
Messages API (application programming interface) and Choosing Your Modellesson 2 · 1 hour
Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.