TwiddleLab / Artificial Intelligence / How Language Models Work
Temperature: Boring or Wild
What you will learn
- Temperature reshapes the bars before the pick: low makes the biggest slice bigger, high evens them out.
- At temperature 0 the model always takes the top word. That's greedy decoding, and it can loop.
- Picking by chance is sampling. Over many spins each word comes up about as often as its share.
- Different jobs want different temperatures: facts cold, ideas warmer, never too hot.
How the lesson goes
Same model, same question, three answers: boring, fine and nonsense.
Tap the knob you think was turned.
It was temperature. Turn it and watch the wheel.
Slide from 0 to 2. The wheel, the bars and a line of text change at once. Try both ends.
Spin at temperature 0, then at 1.
Spin each wheel three times and compare.
Three names for what you saw.
Tap to reveal.
Sampling means picking the next word by chance, by the size of its slice.
Temperature reshapes the slices first: below 1 the big ones grow, above 1 they even out.
At 0 it always takes the biggest slice: greedy decoding. Safe for facts, but text can repeat itself.
Three jobs, three temperatures.
Set a temperature for each job and press Run. A star for every job done well. Get all three.
What temperature wrote this line?
Slide the marker, then Check.
Be the dial: make the wheel hot.
Drag the shares to show how the wheel looks at temperature 1.8. Then Check.
Math: spin once, ten times, a thousand times.
Watch how often each word comes up compared with its share.
A quiz bot must answer 7 × 8 every time. Set its temperature.
Move the slider, then Check. Ten tries will run.
Your temperature card.
Your settings from the game, with what they wrote. Tap Share.
Previous lesson: How a Model Learns: Less Surprise · Next lesson: Why It Makes Things Up · Part of the course: How Language Models Work
Lessons are interactive and need JavaScript. Turn it on to play them.