03

Lesson 3 · 1 min

What a chatbot really does

A chatbot writes its answer one small piece at a time, each time picking a likely next word.

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.

Try it

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.

Do it now

Catch it predicting

  1. 1.Ask a chatbot to finish a famous opening line, like the prompt below.
  2. 2.Then ask it to finish the same line in a surprising way.
  3. 3.Notice that the first answer is the most common pattern, and the second is a less likely one.
Finish this sentence in three different ways, from most expected to most surprising: "Every morning before work, I..."
When you ask a chatbot a question, what is it mainly doing?

Quick check

When you ask a chatbot a question, what is it mainly doing?

Words from this lesson

LLM
An AI trained on huge amounts of text to predict the next word, which lets it write, summarise, translate and chat.
Chatbot
A program you talk to in everyday language by typing or speaking, which replies in the same way.
Model
The trained file of learned patterns that does the actual work inside an AI product. One model can power many apps.
Token
A chunk of text, often part of a word, that AI reads and writes in. Limits and prices are counted in tokens.