How AI chatbots work (simply)

AI for Everyone · Meet AI · Basics · 10 min

The one idea behind ChatGPT, Claude and Gemini: predicting the next word, very, very well.

The world's best autocomplete

Your phone keyboard guesses the next word as you type. An AI chatbot does the same thing, but far better, and over and over.

It reads your message, guesses the most likely next word, adds it, then guesses the next one, and so on, until the answer is complete. Each guess uses everything written so far.

The capital of France is ...  →  Paris

Because it learned from so much text, its guesses capture facts, grammar, styles, even reasoning steps. That is why the answers feel thoughtful.

Words become tokens

AI does not read words the way we do. It splits text into small pieces called tokens. A token is often a whole word, sometimes part of one: unbelievable might become un + believ + able.

Tokens matter for two everyday reasons:

  • Limits. Each chat can only hold so many tokens at once (its context window). Very long chats may "forget" the start.
  • Cost. AI companies charge by the token, which is why some tools limit how much you can use.

How it learned: reading, then coaching

An AI chatbot is trained in two big stages:

  1. Pre-training. It reads a vast amount of public text (books, websites, code) and learns to predict the next token. This gives it knowledge and language skill.
  2. Fine-tuning with human feedback. People rate its answers ("helpful", "wrong", "rude"), and it is trained to give the kinds of answers people prefer: helpful, honest and safe.

Stage 1 makes it knowledgeable. Stage 2 makes it a useful assistant instead of a random text generator.

Why it sometimes makes things up

Remember: it predicts likely words, not true words. Usually likely and true are the same. Sometimes they are not.

If you ask about something rare, very recent or very specific (a small company's address, a court case, a book quote), it may produce something that sounds right but is invented. This is called a hallucination.

Modern tools reduce this by searching the web or reading your documents before answering, but the rule stays the same: for anything important, check the source.

Memory: what it remembers

Inside one chat, the AI sees the whole conversation so far, so you can say "make it shorter" and it knows what it means.

A new chat starts fresh. Some apps offer an optional memory feature that saves notes about you across chats; you can usually view and delete it in settings.

Tip: if a chat gets long and confused, start a new one and paste a short summary of what matters.

More in Meet AI

Previous: What is AI, really? · Next: A tour of AI tools