How Chatbots and Generative AI Work
A chatbot can answer questions, write a poem or explain a math problem in seconds. It can feel like talking to someone who knows everything. It is not. Underneath, a chatbot is doing one simple job over and over: guessing what word comes next. Knowing that helps you use one sensibly, and spot when it is wrong.
A machine that guesses the next word
The kind of AI inside a chatbot is called a large language model. "Language model" means a program that has learned patterns in language. "Large" means it learned from a huge amount of text, far more than a person could read in many lifetimes, and has a huge number of parameters (the numbers it adjusts while learning).
Here is how it learns. The model is shown a piece of text with the end hidden, for example:
The cat sat on the ___
It guesses the next word. Then it is shown the real next word, and its parameters are nudged a tiny bit so that next time, the right word gets a slightly higher score. Repeat this an enormous number of times, on all sorts of text, and the model becomes very good at guessing which words usually follow which.
When you type a question, the chatbot does the same thing. It looks at your words and gives every possible next word a score. A made-up example for "The cat sat on the":
| Possible next word | Made-up score |
|---|---|
| mat | high |
| sofa | medium |
| roof | medium |
| banana | very low |
It picks one of the likely words, adds it to the text, and then guesses the next word after that, and the next, until the answer is finished. A long answer is just many guesses in a row.
(Strictly, the model works with tokens, which are whole words or pieces of words, but "next word" is a good way to picture it.)
How big is "large"?
The default network in the Neural Network Calculator, which reads small handwritten digits, has 109,386 parameters. Large language models have far more, often billions. They also use special layers (called attention layers) that the calculator does not count. But the basic idea is the same: lots of numbers, adjusted a little at a time to make fewer mistakes.
Image generators
AI tools that make pictures from a description learn in a similar way, from enormous numbers of pictures paired with captions (short descriptions). They learn which patterns of pixels tend to go with which words, so when you type a description, they produce new pixels that match it. Like chatbots, they do not understand what they draw. They can get hands, words and small details wrong, and they can repeat the patterns, good and bad, of the pictures they learned from.
Why chatbots make things up and sound sure
A chatbot is trained to produce text that sounds right, not text that is right. It has no built-in way to check facts. So:
- It can invent facts. If a made-up answer sounds like the kind of thing that usually comes next, the model may write it.
- It can invent quotes and sources. It may give a book title, a web address or a quote that looks real but does not exist.
- It can get sums and dates wrong, because it is predicting words, not calculating.
- It sounds confident either way. A wrong answer is written in the same calm, clear style as a right one. Confidence is not evidence.
Chatbots can also repeat unfair patterns. They learned from text written by many people, and some of that text is unkind or treats groups of people unfairly. The people who build chatbots try to reduce this, but some can still get through.
So: AI tools make mistakes, including invented facts, quotes, sources and sums, and they say them confidently. Never rely on a chatbot for health, safety, money or legal questions; ask a trusted adult or a proper expert.
How to check an answer
- Ask yourself: does this matter? If you will use it in schoolwork, repeat it to someone, or act on it, check it.
- Find a trusted source. A textbook, an official website, a library book or your teacher's notes.
- Find a second source. If two reliable sources agree, you can be more confident. If you cannot find the fact anywhere else, treat it as probably wrong.
- Check that sources exist. If a chatbot names a book, article or website, look it up yourself.
- Ask a teacher or parent when you are not sure.
Staying safe with chatbots
- Never type personal information into a chatbot. That means your full name, address, school, phone number, birthday, passwords, photos or voice recordings of you or anyone else, and private things about your family or friends. What you type may be stored. The guide to children's privacy and AI tools explains more.
- Ask a parent or teacher before using a new AI tool. Most AI services set a minimum age in their terms, and some need a parent's permission. Check the service's own terms, and never give a false age.
- Stop and tell a trusted adult if a chatbot, or anyone, asks for personal details or says something that upsets you.
- Do not try to make a chatbot break its safety rules. Some people try. It breaks the rules you agreed to, and those rules are there to protect people.
For adults: check each service's privacy information and settings for whether conversations are stored or used to train models, turn off what you can, and use school-approved tools for schoolwork.
Chatbots and schoolwork
Follow your school's and your teacher's rules on AI. They can be different for each class and even each assignment. If you are not sure whether something is allowed, ask before you use AI, and if you use it, say when and how. Handing in work a chatbot wrote as if you wrote it is cheating, even if nobody notices, and it skips the learning the work was for. The guides to using AI honestly at school and learning with AI without skipping the thinking show how to use it well.
For parents and teachers
A useful classroom exercise: ask pupils to predict the next word in a few unfinished sentences, compare their guesses, and notice that the "most likely" word is not always the true one. It shows, without any screen, why a system built on likely words can be fluent and wrong at the same time.