L003 · How AI thinks · 1 min · Interactive
What a chatbot really does
A chatbot writes its answer one small piece at a time, each time picking a likely next word.
01 · The idea
Under the hood, ChatGPT, Claude and Gemini are large language models, or LLMs. Their core skill is simple: given some text, predict what comes next.
Ask for a recipe for pho and it does not look up a recipe. It writes one, word by word, choosing words that usually follow in texts like this. Because it learned from so much text, the result is often excellent.
This explains a lot. It is why answers sound fluent and confident. It is also why they can be wrong: a sentence can sound right and still be false.
Try it below: pick the next word yourself and watch how the odds change as the sentence grows.
02 · Think of it like this
It is like the word suggestions on your phone keyboard, but trained on a library-sized amount of text and able to keep going for pages.
03 · Try the toy
Guess the next word
Press Sample to let the AI add one word at a time. Then slide the temperature and try again.
The best thing about Monday is
What could come next
- the37%
- coffee22%
- that18%
- it11%
- nothing7%
- lunch5%
The AI never “knows” the next word. It gives every possible word a score, turns the scores into odds, then rolls weighted dice. Temperature changes how lopsided the dice are: at 0 it always takes the favourite, so you get the same sentence every time; turned up, long shots get a real chance and the writing gets surprising.
04 · Do it now
05 · Quick check
Words in this lesson
See also
L006How AI thinks · 2 min
The context window: AI's short-term memory
A chatbot can only see a limited amount of text at once, and in a very long chat the oldest parts can slip away.
L012Asking well · 2 min
Temperature: safe or creative
Temperature is the setting that decides whether AI picks the most likely next word or takes a risk.
L082Asking well · 2 min
Prompt in Vietnamese or English?
Write in the language you think in, and ask for the answer in the language you need.
L093AI at work · 2 min
Practise a foreign language by chatting
A chatbot is a patient conversation partner in many languages, available any time, that never gets bored of your mistakes.