AI

How Chatbots Like ChatGPT Work: Predicting the Next Word, Billions of Times

Aug 3, 2026 · 3 min read

A large language model does not look up answers. It predicts the next piece of text. Understanding this one idea explains both its strengths and its mistakes.

Chatbots can write emails, explain science, and fix code. It feels like talking to a person who knows everything. Under the hood, the idea is surprisingly simple, and knowing it makes you a much smarter user.

The core idea

A large language model (LLM) is trained to do one thing: predict what text is likely to come next. If you write "The capital of France is", the most likely next word is "Paris". Do this repeatedly, one small piece at a time, and the model can write whole paragraphs.

The steps behind it

  1. Collecting huge amounts of text

    The model is trained on books, websites, code, and other writing. It learns patterns in how language works.

  2. Breaking text into tokens

    Text is cut into small chunks called tokens, which can be a word or part of a word. The model works with tokens, not letters.

  3. Learning patterns

    During training, the model plays a huge game of "guess the next token" and gets adjusted each time it is wrong. Over time, it learns grammar, facts, styles, and reasoning patterns.

  4. Fine-tuning with human feedback

    People rate answers, and the model is adjusted to be more helpful, polite, and safe.

  5. Generating a reply

    When you ask a question, it predicts one token at a time, building its answer, using your whole conversation as context.

Why it can feel smart

Language contains a lot of human knowledge. To predict the next word well across billions of examples, a model has to pick up facts, logic, and writing styles. That is why it can summarise, translate, and explain.

Why it makes mistakes

The "context window"

A model can only "remember" a limited amount of text in a single conversation, called the context window. If a chat goes on very long, earlier details may be lost. Starting a new chat for a new topic often gives better answers.

What most people miss

Sources

More in AI

AI

Deepfakes and Voice-Clone Scams: How to Protect Yourself and Your Family

AI can now copy a voice from a few seconds of audio. Learn how these scams work, the one habit that beats them, and how to check if an image or video is real.

Oct 17, 2026 · 3 min read
AI

Will AI Take Your Job? What the Evidence Says and Skills That Last

The World Economic Forum expects millions of jobs to disappear and even more to appear by 2030. Learn what is changing, who is most affected, and how to stay valuable.

Oct 16, 2026 · 3 min read
AI

AI Agents Explained: From Chatbots That Answer to Software That Acts

AI agents do not just reply. They plan steps, use tools, and complete tasks. Here is what they are, where companies use them, and what can go wrong.

Oct 14, 2026 · 3 min read