← Back to modules
🎯

Module 5

Prediction

Every time an AI generates text, it's making a prediction β€” what is the most likely next word? Let's look inside that decision.

How does AI choose the next word?

After converting your text to tokens (M1) and understanding their meaning (M2–M4), the AI reaches its most critical step: prediction.

For every possible next token, the model calculates a probabilityβ€” how likely is this word to come next, given everything that came before? The model doesn't just pick the most likely word every time β€” it samples from the distribution, which is why AI writing feels varied and natural rather than mechanical.

πŸ’‘ Key insight: The AI assigns a probability to every single token in its vocabulary β€” all ~100,000 of them β€” before picking one. The visualiser below shows you the top 8.

Explore predictions

Select a scenario to see what the AI thinks comes next β€” and why.

Prompt

The capital of France is

This scenario demonstrates a high-confidence prediction where the model has a very strong inclination towards a single correct answer based on world knowledge.

Top 8 predicted tokens:

Paris
85%
← chosen
London
5%
Berlin
3%
Rome
2%
Madrid
1%
Tokyo
1%
Lyon
1%
Nice
1%

The temperature dial

AI models have a β€œtemperature” setting that controls how adventurous their predictions are.

Prompt

β€œThe weather today is”

Drag the temperature dial and see how the AI's choice changes:

PredictableCreative / Chaotic
😐

Temperature 0.5 β€” Low

β€œwarm”

As temperature slightly increases, the model considers a wider range of high-probability words, offering some variation.

🧊 Low temperature (0.1)

Almost always picks the most probable token. Consistent but repetitive. Good for facts.

πŸ”₯ High temperature (1.5)

Samples from lower-probability tokens too. Surprising and creative, but can go off-track.

What you've learned