Tech explained · Explained simply

How does ChatGPT work?
A visual explanation

ChatGPT works by predicting the next small piece of text, a token, again and again. A large neural network called a transformer, trained on vast amounts of text, scores every possible next token given everything written so far; one is picked and the process repeats. Further training with human feedback teaches it to follow instructions and answer helpfully.

By , FounderUpdated 8 min read

Share

Quick answer: How does ChatGPT work?

  1. Tokens — text is split into tokens, small chunks that are often parts of words; in English one token is roughly three-quarters of a word.
  2. Prediction — for each step, the model assigns a probability to every possible next token and one is chosen.
  3. Transformer — the network architecture, introduced in 2017, uses 'attention' to weigh how each word relates to every other.
  4. Training — first on huge amounts of text to predict the next token, then with human feedback to follow instructions.
  5. Limits — it can state false things confidently ('hallucinate'), because it generates plausible text rather than looking up facts.

Key takeaways

  • ChatGPT does not search a database of answers; it generates text one token at a time from learned patterns.
  • GPT stands for generative pre-trained transformer, which describes exactly how it works.
  • Attention is the key innovation: it lets the model connect a word to the words that give it meaning, however far apart.
  • Human feedback training is what turned a raw text predictor into a helpful assistant.
  • Hallucinations are partly a training incentive problem: models are rewarded for confident guesses over saying 'I don't know'.

Ask ChatGPT "What is the capital of India?" and it answers "New Delhi" in a blink. It feels like it looked the answer up. It didn't. It wrote the answer one small piece at a time, each piece chosen because it was the most likely thing to come next given everything before it. That single idea, repeated with a very large neural network trained on a very large amount of text, explains almost everything ChatGPT does well, and most of the things it gets wrong. This guide walks through it visually, with the research papers it comes from.

How does ChatGPT work? At a glance: Tokens; Prediction; Transformer; Training; Limits.
At a glance: How does ChatGPT work?

How ChatGPT works in one diagram

ChatGPT is a large language model: a neural network that, given some text, predicts what text comes next. It does this in small units called tokens.

PROMPT → TOKENS ThecapitalofIndiais Delhi NEXT-TOKEN PROBABILITIES Delhi0.41India0.17the0.11Mumbai0.09its0.05 ILLUSTRATIVE NUMBERS · REAL MODELS SCORE ~100,000+ POSSIBLE TOKENS AT EVERY STEP, THEN SAMPLE ONE
Next-token prediction. The prompt is split into tokens; the model scores every possible next token; one is chosen and added, and the process repeats until the answer is complete. Probabilities here are illustrative.
Diagram of 5 steps for how chatgpt works in one diagram: 1. Split the text into tokens; 2. Turn tokens into numbers; 3. Run the transformer; 4. Score every possible next token; 5. Pick one and repeat.
How ChatGPT works in one diagram
  1. Split the text into tokens — your message becomes a sequence of tokens: words, parts of words and punctuation.
  2. Turn tokens into numbers — each token becomes a long list of numbers (an embedding) that captures something of its meaning.
  3. Run the transformer — layers of the network let every token "attend" to every other, building up a representation of what the text means.
  4. Score every possible next token — the output is a probability for each token in the vocabulary.
  5. Pick one and repeat — a token is sampled, added to the text, and the whole process runs again until the reply ends.
The transformer architecture is published
2017
ChatGPT launches
30 Nov 2022
Average English token
~¾ word
Weekly ChatGPT users OpenAI reported in October 2025
800 million

What is a token?

A token is the unit of text the model reads and writes. Common words are often a single token; longer or rarer words are split into pieces. OpenAI's guidance is that one token is roughly four characters of English text, or about three-quarters of a word, so 100 tokens is about 75 words5. Text in Hindi, Tamil or other Indian languages usually needs more tokens per word, because tokenisers were built mostly from English-heavy data.

Thinking in tokens explains small oddities, such as why models used to struggle to count the letters in a word: they never saw the letters, only the tokens.

What is a transformer, and what is attention?

The transformer is the neural network design behind ChatGPT. It was introduced in 2017 by researchers at Google in a paper titled "Attention Is All You Need"1. Its key mechanism, attention, lets the model, for each word, look at every other word in the text and decide how much each matters.

Themetrowaslatebecauseitbrokedown5%62%4%14%5%ATTENTION WEIGHTS FROM "it" · ILLUSTRATIVE · A REAL MODEL HAS MANY ATTENTION HEADS AND LAYERS
Attention, simplified. When processing 'it', the model weighs every earlier word; the strongest link is to 'metro', which tells the model what 'it' refers to. Weights are illustrative; real models have many attention layers and heads.

Earlier language models read text step by step and tended to forget the start of long sentences. Attention lets the connection between "it" and "metro" be made directly, however many words apart they are, and it can be computed for all words at once, which made it practical to train much bigger models on much more text. GPT stands for Generative Pre-trained Transformer: a model that generates text, is pre-trained on a large body of text, and uses this architecture.

Quick quizWhat does the 'T' in GPT stand for?

Transformer: the neural network architecture, introduced in 2017, that uses attention to relate every word to every other. 'Generative pre-trained' describes how it is built and what it does.

How is ChatGPT trained?

ChatGPT is trained in two broad stages.

Pre-training. The model is shown enormous amounts of text and trained to predict the next token, over and over, adjusting billions of internal numbers (parameters) each time it is wrong. OpenAI's 2020 GPT-3 paper showed that a model trained this way at large scale, 175 billion parameters, could perform many tasks just from instructions and examples in the prompt2. Pre-training gives a model broad knowledge of language and facts, but it produces a text predictor, not an assistant: ask it a question and it might continue with more questions.

Fine-tuning with human feedback. To turn the predictor into an assistant, OpenAI fine-tuned it on example conversations written by people and then used reinforcement learning from human feedback (RLHF): people ranked several model answers, a separate "reward model" learned their preferences, and the language model was trained to produce answers that score well3. In OpenAI's 2022 InstructGPT study, people preferred answers from a 1.3 billion parameter model trained this way over the 175 billion parameter GPT-33. ChatGPT, launched on 30 November 2022, applied the same approach to dialogue4.

How is ChatGPT trained?: Pre-training; Supervised fine-tuning; Reinforcement learning…; Tools and reasoning.
How is ChatGPT trained?

Pre-training

Learns language by predicting the next token across a huge body of text. Produces broad knowledge, no manners.

Supervised fine-tuning

Learns from example conversations showing what a good answer looks like.

Reinforcement learning from feedback

Learns from human (and later AI-assisted) rankings of answers which responses are more helpful and safe.

Tools and reasoning

Newer versions can search the web, run code and spend extra steps reasoning before answering.

Why does ChatGPT sometimes make things up?

ChatGPT sometimes states false things fluently because it generates plausible text, not checked facts. When the right answer is rare or absent in its training, the most plausible continuation can be wrong but confident: a fake citation, a non-existent law, a wrong date. These errors are called hallucinations.

In a 2025 paper, researchers at OpenAI argued that hallucinations persist partly because of how models are graded: most training and evaluation reward a correct answer and give nothing for "I don't know", so guessing scores better than admitting uncertainty, like a student guessing on a multiple-choice test6. Their proposed fix is to change evaluations to penalise confident errors more than abstentions. OpenAI said in 2026 that newer default models produce markedly fewer hallucinated claims on high-stakes prompts, but the problem has not disappeared8.

ChatGPT and Google Search answer questions in different ways. Search retrieves and ranks existing pages from an index; a language model generates new text from what it learned in training. The two are converging: Google adds AI-generated overviews to results, and ChatGPT can run web searches and cite what it finds. Our guide to how Google Search works covers the retrieval side.

Google SearchChatGPT (without search)
How it answersRetrieves and ranks existing pagesGenerates new text token by token
KnowledgeLive web indexTraining data up to a cut-off
SourcesLinks to pagesNone, unless it uses a search tool
Typical errorIrrelevant or low-quality pagesFluent but false statements

Table: How a search engine and a language model answer differently

What this means for people building products with AI

Checklist: What this means for people building products with AI — Design for being wrong; Ground answers in your own data; Tell users what it can't do; Watch the tokens; Test with real users.
What this means for people building products with AI
  • Design for being wrong — show sources, let people check, and make corrections easy.
  • Ground answers in your own data — retrieval from your documents reduces invention on product-specific questions.
  • Tell users what it can't do — clear limits build more trust than confident failures.
  • Watch the tokens — long prompts and Indian-language text cost more tokens, which affects speed and price.
  • Test with real users — people's trust in AI answers rises and falls quickly; measure it.

We cover the practical side in our guides to adding AI to an app and comparing ChatGPT, Claude and Gemini.

Key terms, defined

Large language model (LLM) — a neural network trained on large amounts of text to predict the next token.

Token — a chunk of text, often part of a word, that the model processes.

Transformer — the neural network architecture that uses attention to relate all parts of a text to each other.

Parameters — the internal numbers adjusted during training; large models have billions.

RLHF — reinforcement learning from human feedback: training a model on human preferences between answers.

Hallucination — a fluent, confident statement that is false.

How we researched this

The explanation follows the primary research papers: the transformer (Vaswani et al., 2017), GPT-3 (Brown et al., 2020), InstructGPT and RLHF (Ouyang et al., 2022) and OpenAI's 2025 analysis of hallucinations, plus OpenAI's own documentation on tokens and ChatGPT's launch. Usage figures are OpenAI's as reported by TechCrunch. The diagrams are our own simplified illustrations; probabilities and attention weights in them are illustrative. Last reviewed October 2026.

Frequently asked questions

What does GPT stand for?

GPT stands for Generative Pre-trained Transformer. Generative because it produces new text; pre-trained because it first learns from a large body of text before being specialised; and Transformer because that is the type of neural network architecture it uses, introduced by Google researchers in 2017.

Does ChatGPT search the internet?

The core model generates answers from patterns learned in training rather than by looking things up. ChatGPT can also use a search tool to retrieve current web pages and cite them, which it does for some questions or when asked. Without search, its knowledge stops at its training cut-off date.

What is a token in ChatGPT?

A token is a chunk of text the model reads and writes: often a word, part of a word or a punctuation mark. In English, one token is on average about four characters, or roughly three-quarters of a word. Indian-language text often uses more tokens per word, which affects speed and cost.

Why does ChatGPT make things up?

Because it generates the most plausible continuation of text, not verified facts, it can produce fluent but false statements, called hallucinations. OpenAI researchers argued in 2025 that training and evaluation reward confident guessing over admitting uncertainty, much like a multiple-choice test that gives no credit for leaving a blank.

How is ChatGPT trained?

In two broad stages. Pre-training teaches a transformer to predict the next token across enormous amounts of text, which gives it broad knowledge of language. Then fine-tuning, including reinforcement learning from human feedback (RLHF), trains it on demonstrations and human rankings of answers so it follows instructions and responds helpfully and safely.

How many people use ChatGPT?

OpenAI said in October 2025 that ChatGPT had 800 million weekly users, up from 100 million weekly users in November 2023. Reports in 2026 put the figure higher, but OpenAI's own confirmed numbers are the safest reference.

Sources

  1. Vaswani et al. — Attention is all you need (2017), arXiv
  2. Brown et al. — Language models are few-shot learners (GPT-3, 2020), arXiv
  3. Ouyang et al. — Training language models to follow instructions with human feedback (2022), arXiv
  4. OpenAI — Introducing ChatGPT (30 November 2022)
  5. OpenAI Help Center — What are tokens and how to count them
  6. Kalai et al. — Why language models hallucinate (2025), arXiv
  7. TechCrunch — Sam Altman says ChatGPT has hit 800M weekly active users (October 2025)
  8. TechCrunch — OpenAI releases GPT-5.5 Instant, a new default model for ChatGPT (May 2026)
  9. Checked October 25, 2026. Figures that change — fees, salaries, prices — are reviewed every six months; if something is out of date, tell us.
Pass it on

Know someone who'd enjoy this?

Send it to them — one tap, no sign-up. Good ideas travel best between friends.

Keep exploring

Where to go from here

Join free

Get the ideas, not the noise.

Sign up with Google and we’ll send you short UX psychology tips by email — why people tap, stall and leave, and what to do about it. Unsubscribe anytime. Prefer something to keep? Get the free Laws of UX guide as a PDF.

Get the free Laws of UX PDFFree · no spam · unsubscribe anytime
Technology is the easy part

Adoption is where products win or fail.

A behavioral UX audit of your app or SaaS product: why users hesitate, stall and leave, and a prioritized fix list. Fixed price, 2–4 weeks.

Free certification

Turn what you know into a credential.

Free, test-based UX, UI and product certifications. Answer real product scenarios, graded on our server, and earn a founder-signed certificate anyone can verify and you can add to LinkedIn.

  • Credential ID
  • QR verification
  • LinkedIn-ready
Free PDF · 74 pages · 2 editions

The Laws of UX, in one field guide

60 research-backed principles in 6 categories — what each one means, why it works on the human brain and how to use it on your own screens. Written by Sushant Singh, founder of Science of Apps, who has scaled consumer apps to lacs of users and spent 10+ years leading product across startups and digital businesses in the US, EU & India.

Pick your edition
Free. No card, no paywall — just your email.
Free PDF · 74 pages

Get Laws of UX by email

Choose your edition

You’ll also get occasional UX psychology tips. Unsubscribe anytime. Privacy policy

Free PDF · 90 pages · 2 editions

100+ Subscription Paywalls, decoded

110 real paywalls from top apps, taken apart, rated out of 5 and decoded with the Laws of UX — plus the frameworks, copy and checklists to ship your own. By Sushant Singh, founder of Science of Apps.

  • 110 paywalls rated
  • 34 Laws of UX
  • 12 frameworks

Which paywall scored 4.8 out of 5, and which scored 2.6? It’s all inside.

Pick your edition
Free. No card, no paywall — just your email.
Free PDF · 90 pages

Get 100+ Paywalls, Decoded by email

Choose your edition

You’ll also get occasional UX psychology tips. Unsubscribe anytime. Privacy policy