Deep Black BoxOpen up the black box of AI one problem at a time, with your own hands. 21 problems in all.
Question 12

The next word is drawn by probability

Your targets: out of 10 runs, the sentence “The largest ocean on Earth is the Pacific Ocean.” comes out 8.0 times or more.
And on top of that, get 2.5 or more different sentences.

Both are set by temperature. These two targets are values this problem chose.

Probability of the next word (cut down to 6 candidates)
Turn it down and it gathers on the favourites; turn it up and the tail starts showing
–times  /  how often the target sentence comes out of 10 runs (calculated)
0target 8.010
–kinds  /  how many different sentences come out of 10 runs (calculated)
0target 2.510
Both are averages over many repeats of the 10 runs, which is why they come out as decimals.
At temperature 0.65 what you actually get is nearly always two kinds or three (about 70% of the time between them).
Next wordTemperature 0.20Temp. 1.00Temp. 2.50
Pacific1.0000.7360.372
Atlantic0.0000.1000.167
Indian0.0000.0600.137
Arctic0.0000.0450.121
Southern0.0000.0370.112
one0.0000.0220.092
Target sentence, out of 10 runs10.05.10.7
Different sentences, out of 10 runs1.05.39.2
The bottom two rows are calculated by following these 6 candidates all the way through. Leave the temperature at 1.00 and it answers correctly only 5 times out of 10. Take it down to 0.20 and all 10 runs give the very same sentence.
What to take away
This single knob is called temperature. It sits on the using side, and never appears in the building process.
Where this pays off
Turn the temperature down when you want one single fact back, and up when you want several ways of putting it. The temperature in ChatGPT and in the APIs is this knob.