Skip to main contentEL
Independent Digital Museum of Artificial Intelligence

Thematic guide · LLM

How does ChatGPT work?

ChatGPT does not simply retrieve a prepared answer from a database, and it does not write like a person who first forms a complete thought. It generates text step by step using a large language model trained to predict likely next tokens.

1. Text is split into tokens

Before a language model can process a sentence, text is converted into smaller units called tokens. A token may be a whole word, part of a word, or another symbol, depending on the tokenizer. The exhibit Words become numbers shows the basic transition from language to numerical representations.

2. The Transformer processes context

The Transformer uses attention mechanisms so that different parts of a sequence can influence each other. This does not mean the model “pays attention” like a person. Attention is a mathematical mechanism for weighting relationships. The Tokens & Attention experiment provides a deliberately simplified educational view.

3. Pretraining learns statistical patterns

During pretraining, the model processes very large amounts of text and adjusts parameters to improve prediction. The resulting system encodes complex statistical patterns about language and associations present in its data. That is not the same as possessing a guaranteed database of facts.

4. Instructions and evaluation come after pretraining

A general pretrained model is not yet a conversational product. Further stages can include instruction training, alignment, and testing and safety. Exact techniques vary across systems and organisations, so the Museum presents these as a family of practices rather than one secret recipe.

5. The answer is generated token by token

Given a prompt, the model computes probabilities for possible next tokens and chooses according to its generation settings. The process repeats. This also explains an important limitation: a model can produce a sentence that is linguistically plausible but factually wrong.

Why can hallucinations occur? Because the generation objective is not, by itself, “retrieve the truth”; it is to continue text plausibly. Search, retrieval, evaluation and external sources can improve reliability, but they do not automatically remove the problem.

ChatGPT and the model are not exactly the same thing

ChatGPT is a product and interface that uses language models together with additional systems. “LLM” refers to the underlying model or model family. Keeping the distinction clear prevents every product behaviour from being attributed to the base model alone.

What happens when you press “send”

In practice, a conversational application can do more than make one call to a base model. Your message may be combined with system instructions and conversation history that fits within the available context. If the product has tools, it may decide that it needs search, calculation, document retrieval or another action. Tool results can be returned to the model before the final answer is produced.

This is why two applications using related models can behave differently. The model is one component of a larger system: rules, interfaces, tools, safety mechanisms and product choices surround it. When a system gives a poor answer, the cause may lie in the training data, the model, the prompt, retrieved sources, or the way the product combines those components.

How to read an answer critically

For questions where accuracy matters, ask for a source and verify it independently. If an answer contains a precise number, date or quotation, do not assume the detail is correct simply because it is presented confidently. Linguistic fluency is a property of generation; verification is a separate process.