LLMs Β· temperature
The creativity dial
π School maths Β· Years 6β7Probability & percentages β Turn scores into chances that add up to 100%.Maths by year β
The Case. Chatbots have a secret dial called temperature. Low = safe and predictable; high = wild and creative. Let's feel it.
Your tools. numpy turns the model's word-scores into chances. Temperature stretches or flattens those chances.
Investigate. Drag the temperature slider above the code β watch the percentages change instantly.
- Low temperature: the top word wins almost every time (safe, a bit boring).
- High temperature: the underdog words get a real chance (creative, sometimes weird).
ποΈ Drag to explore β the chart updates live
your_code.py
Starting Pythonβ¦
The Reveal
Starting Pythonβ¦ (first time only β a few seconds)
ποΈ Detective's notes
Bundles your findings, chart and code into one PDF you can keep, print or hand in.
π§© How this code works
The tools it uses
- NumPy β a row of boxes that holds numbers, so you can do maths to all of them at once.
What this one does
- β’ It uses chance and randomness.
How to read it, top to bottom
- 1. Import β bring in the tools (listed above).
- 2. The data β the lists and numbers near the top. These are the bits you change.
- 3. The work β a little maths, or a loop that repeats a step.
- 4. Show it β
print(...)writes words;plt.show()draws the picture.
Use it for your own problems
- Change the numbers at the top and press Run β nothing breaks, so experiment!
- Ask your own version of the question β swap in your family, your scores, your week.
- The same tools work on any numbers β that's the superpower you're learning.
Need a hint?
Dividing the scores by a big temperature makes them closer together, so the chances even out.