How AI Chatbots Work, Explained Simply
Tokens, training, context windows and why the same question gets different answers: a plain-language look at what happens when you chat with AI.

You do not need to understand the maths to use AI chat well, but a basic picture of what is going on explains a lot: why answers sound confident even when they are wrong, why the same question gets different answers, why the AI loses track in long chats, and why it may not know about recent events. Here is a plain-language explanation without jargon you do not need.
The short version
An AI chatbot is built on a large language model (LLM): a very large neural network trained on huge amounts of text to predict what comes next. When you send a message, the model reads the conversation and generates a reply one small piece at a time, each time choosing a likely next piece based on everything before it. Further training teaches it to follow instructions, hold a conversation and decline harmful requests.
There is no database of ready-made answers being looked up, and no person typing behind the scenes. Almost everything else in this guide follows from that.
Step 1: Text becomes tokens
Models do not read letters or whole words. They split text into tokens: common words are often a single token, while longer or rarer words are broken into pieces. Spaces, punctuation and numbers become tokens too. This is why AI can stumble on tasks like counting the letters in a word or reversing a string: it does not see individual letters the way you do.
The same meaning can take a different number of tokens in different languages, which is one reason quality and length limits can vary from one language to another.
Step 2: Pre-training on huge amounts of text
In the first and largest phase, the model is shown an enormous amount of text, such as publicly available web pages, books, code and other sources, depending on the developer, and learns to predict the next token. It is corrected over and over again and gradually adjusts its internal numbers, called parameters or weights.
To predict text well, the model ends up capturing a great deal about grammar, facts, reasoning patterns and styles. But it does not keep a copy of its training data like a library. It stores statistical patterns. That is why it can explain a concept fluently and still misremember a specific date, name or quote.
Step 3: Fine-tuning turns a predictor into an assistant
A model that only predicts text would simply continue your message instead of answering it. Developers therefore train it further on examples of good conversations and use feedback, from people and increasingly from automated checks and other models, to reward helpful, honest and safe answers. One well-known method is reinforcement learning from human feedback (RLHF).
This phase gives the chatbot its manners: following instructions, using formatting, admitting uncertainty some of the time, and declining harmful requests. It can also introduce quirks, such as a tendency to agree with the user or to sound more certain than it should.
Many recent models are also trained to reason: they work through a problem in intermediate steps before giving the final answer. This improves results on maths, coding and planning, though it does not make them infallible.
Step 4: Your conversation and the context window
When you chat, the app sends the model a bundle of text: instructions from the service that you do not see (the system prompt), the earlier messages in the conversation, and your new message. The model itself keeps no memory between requests. It "remembers" the conversation only because the conversation is sent to it again each time.
Simplified, the bundle for your third message in a chat looks something like this:
[system] You are a helpful assistant. Answer clearly... [user] What is a good name for a bakery? [assistant] Here are some ideas: Rise and Shine, The Daily Crumb... [user] Make them sound more French. [assistant] (the model writes this part, token by token)
"Make them sound more French" only makes sense because the earlier turns are included. If an app left them out, the model would have no idea what "them" means.
The amount of text a model can take into account at once is called its context window, and apps often trim long conversations to stay within limits. That is why, in a very long chat, the AI may lose track of details from the beginning. Starting a new chat with a short summary usually helps.
Some services add a separate memory feature that saves facts about you between chats. That is an app feature built around the model, not something the model does on its own.
Step 5: Generating the answer
For each next token, the model calculates probabilities for many possible candidates. The app then picks one, usually with a controlled amount of randomness so the text does not sound mechanical. This explains two things you may have noticed:
- The same question can produce different answers. Regenerating is a quick way to see alternatives.
- A fluent sentence is not the same as a true one. The model picks words that fit; it does not check facts as it goes.
Try it yourself: ask the chat to explain tokens with an example, then regenerate the answer and compare the two versions.
Why AI makes things up
When a model produces confident but false information, people call it a hallucination. It happens because the model is built to produce plausible text, and a plausible-looking citation, statistic or biography is easy to generate even when the real one is unknown. Training has reduced this but not eliminated it. Higher-risk areas include:
- Exact numbers, dates and quotes.
- References to books, papers, court cases and web pages.
- Niche topics with little training data.
- Events after the model's training data ends.
Our fact-checking guide explains how to verify answers quickly.
Why AI may not know recent events
A model's knowledge comes from data collected up to a certain date, its knowledge cutoff. After that it knows nothing new unless the app gives it fresh information, for example through a web search tool or text that you paste in. When an assistant does search the web, its answer is only as good as the pages it finds, so the sources are still worth checking. If your question depends on recent information, paste the relevant text yourself or confirm the answer with an up-to-date source.
Models, makers and the model menu
Several companies develop large language models, including OpenAI (the GPT models behind ChatGPT), Anthropic (Claude), Google (Gemini), Meta (Llama), xAI (Grok), DeepSeek, Alibaba (Qwen) and Mistral AI. Some publish their model weights so that anyone can download and run them; others offer their models only through their own apps and APIs. Models differ in style, strengths, language coverage and how cautious they are. Our model guides and comparisons such as ChatGPT vs Claude describe them in more detail.
In ChatG, you can pick the model style you prefer in the menu, or leave it on ChatG Auto. ChatG is an independent site and is not affiliated with any of these companies.
FAQ
Does the AI understand what it says?
This is still debated. Models clearly capture a lot of structure about language and the world, and they can solve problems they have not seen before. But they do not have experiences, and they can fail in ways a person who understood the topic would not. In practice, treat AI as a capable tool, not an authority.
Does the AI learn from my conversation?
Not during the chat: the model's weights do not change while you talk to it. Some services may later use conversations to train future models, depending on their policy and your settings.
Is the AI connected to the internet?
The model itself is not. It works from what it learned in training plus whatever is in the conversation. Some apps add web search as a separate tool. Unless an answer shows sources that were looked up, assume it comes from training data that may be out of date.
Why are some answers better in English than in other languages?
Models usually see far more English text during training than text in most other languages, and other languages can take more tokens to express the same thing. Widely used languages are generally handled well; less common ones can be weaker.
Ready when you are
Open the chat and ask your first question. It's free, and there is nothing to install.
Start chatting

