- Home
- Technology
- Artificial intelligence
- Chatbot training
How a chatbot is trained
How a program learns to write by predicting the next word, billions of times over.
The short version
A chatbot is trained by showing it enormous amounts of text with the next word hidden, and asking it to guess. Each wrong guess nudges its numbers, and after billions of guesses it becomes very good at continuing text. A second stage, using human feedback, teaches it to be helpful. It builds on artificial intelligence.
I always assumed a chatbot looked up answers in a database.
It does not store the text. It stores what it learned from it.
Nothing is looked up unless it is connected to something else.
Stage one: guess the next word
The training text comes from books, websites and other writing. The system is shown text and trained to predict the next token, which may be a whole word or only part of one. It is told the right answer, and its numbers are adjusted so that next time the right word is a bit more likely. This is repeated across very large collections of text; the exact training data and scale vary by model.
To get good at guessing, it has to pick up grammar, facts, styles and common reasoning patterns, because all of them help predict what comes next.
Stage two: learning to be helpful
A model trained only to continue text would ramble. So it is trained further, using examples of good answers and ratings from people who compare its replies. This teaches it to answer a question, follow an instruction and decline harmful requests.
What it does when you type
Your message is split into small pieces of words called tokens. The model estimates which next tokens fit the context, selects one, then repeats the process until it forms a reply. The numbers it learned do not change as it talks to you.
Note: a chatbot knows only what was in its training text, up to a certain date, unless it is linked to a search tool. Check anything recent or important.
Key takeaways
- Training means guessing the next word, billions of times.
- Wrong guesses nudge the numbers.
- Human feedback makes it helpful.
- It writes one token at a time.
- It does not look answers up.
Now you know.
It learns by guessing.
People teach it to be helpful.
It writes one piece at a time.
Last reviewed 3 Nov 2026