# How Does AI Work? A Plain-English Map From Training Data to Chatbot Reply

Where each part of modern AI fits: training data, training, the model, and the token-by-token loop that puts words on your screen — plus how AI, machine learning, deep learning and generative AI nest.

> machine learning basics · large language models · next-token prediction · About 7 min · Nov 16

## Key points

1. A chatbot answer is generated, not retrieved: your prompt is split into tokens, and a trained model repeatedly picks a likely next token until the reply is complete.
2. The pipeline has four stages — training data, training, model, generation — and only the last one happens while you are chatting; the other three happened months earlier.
3. AI is the umbrella term, machine learning is the subset that learns from examples instead of hand-written rules, deep learning is machine learning with many-layered neural networks, and generative AI is deep learning that produces new text or images.
4. Training works by starting from random parameters, scoring each next-word guess against the real next word, and nudging billions of numbers until the guesses get better.
5. A model is a file of learned numbers, not a searchable database of facts, so it always produces a plausible continuation rather than reporting that it does not know.
6. Instruction tuning and alignment training turn a raw text completer into an assistant-shaped responder, which is where its helpful tone and its refusals largely come from.
7. Because each sentence is optimized for plausibility, confident fluent output still needs verification, and anything requiring fresh facts or exact computation depends on tools outside the model.

---

Most explanations of AI start with math. Here is the plain version: when you type a question into ChatGPT and get a fluent answer back, nothing was looked up. Your text was cut into pieces, pushed through a very large pile of numbers, and turned into a bet about which piece of text should come next — repeated a few hundred times. Everything else in modern AI is either preparation for that moment or polish applied on top of it.

This article is a map rather than a manual. It has two halves. First, where the words actually come from: data, then training, then the model, then generation. Second, how the labels you keep hearing — AI, machine learning, deep learning, generative AI — sit around that pipeline. Each stage deserves its own deep dive later; here you only need to know what each part is for and how the parts connect.

```mermaid
flowchart LR
  A["Training data (text, images, examples)"] --> B["Training: adjust billions of numbers"]
  B --> C["Model: a file of learned numbers"]
  D["Your prompt"] --> E["Tokens: text cut into pieces"]
  E --> F["Model predicts the next token"]
  C --> F
  F --> G["Append token, repeat"]
  G --> H["Words on your screen"]
```

## The whole pipeline in one line

Data → training → model → generation. Training data is the raw material. Training is the process that squeezes patterns out of that material into numbers. The model is the result of that squeezing, stored as a file. Generation is what happens when your prompt is pushed through the file and text comes out.

The detail people usually miss: only the last stage happens while you chat. The first three happened months earlier, on someone else's computers, at a cost of millions of dollars. A chatbot does not consult a live encyclopedia, and it does not permanently learn from your conversation — though some products store past messages separately and feed them back in. That single fact explains a surprising amount of ordinary chatbot behavior.

## AI vs machine learning vs deep learning: how the labels fit

People search for "the difference between AI and machine learning" because the terms get used as if they were interchangeable. They are nested, from broadest to narrowest.

**AI** is the umbrella term for any machine doing something we would call intelligent. It includes systems with no learning at all — an old customer-service bot that matches keywords to pre-written answers is still AI. **Machine learning** is the subset where behavior comes from examples instead of rules a programmer wrote by hand: show the system thousands of cases and let it find the pattern. **Deep learning** is machine learning done with neural networks that have many layers stacked up, which is what made image recognition, speech recognition and modern language models work. **Generative AI** is the slice of deep learning whose output is new content — sentences, images, audio — rather than just a label like "cat" or "spam." [1][2]

So when a news story says "AI," it usually means generative AI; when a job posting says "machine learning," it usually means the training side; and "deep learning" usually means the neural network machinery underneath.

![Nested boxes showing AI containing machine learning, which contains deep learning, next to older rule-based AI](https://caltechsites-prod-assets.resources.caltech.edu/scienceexchange/images/AI-vs-ML-VennDiagram-NoBG-FNL.0ee82bc0.max-1000x1000.png)

## Step 1: Training data — where the patterns come from

A learning system needs examples, and examples need answers attached. In classic machine learning those answers are labels a human supplied: thousands of MRI images marked "tumor" or "no tumor." Labeling is slow and expensive, which is why early machine learning was limited by how much labeled data existed.

Large language models got around that bottleneck with a trick: for ordinary text, the answer is already in the text. Hide the next word, guess it, then reveal it and check. No human labeling is needed, so training can run over an enormous quantity of books, web pages and code. This is why a model can pick up grammar, style and a wide scattering of facts: they all show up as patterns in how words follow one another.

## Step 2: Training — turning examples into billions of numbers

Inside the network are numbers called **parameters** (or weights). At the start they are random, so the model's guesses are garbage. Training is a loop:

1. Show the model a chunk of text and ask it to predict the next word.
2. Compare the guess with the word that actually came next, and score how wrong it was.
3. Nudge every parameter a tiny amount in the direction that would have made the guess slightly less wrong.
4. Repeat, billions of times, over billions of words.

No one programs the rules of grammar or decides where a fact should be stored. The numbers settle into values that make correct predictions more likely, and those values end up encoding statistical regularities — word order, tone, translation pairs, and facts that appear often enough in the text to leave a trace. "Compressed" is a useful metaphor here, but don't push it too far: models do sometimes reproduce passages close to verbatim, which is one reason the metaphor is only approximate.

## Step 3: The model — what actually gets shipped

What gets saved after training is a file containing the architecture (mostly a design called a transformer) plus billions of parameter values. That file is the model. It is not a database of facts with an index you can query; there are no rows to look up. Everything it "knows" is spread across those numbers as a tendency to produce certain continuations.

This is worth sitting with, because it explains the failure mode everyone complains about. A database returns an error when the record is missing. A model cannot do that — it always produces a most-likely next token, whether or not the underlying facts support one.

## Step 4: Answering — how your prompt becomes words on screen

When you hit send, your text is first split into **tokens**: chunks that may be a whole word, part of a word, punctuation, or a word with a leading space attached. As a rough English rule of thumb, one token is about four characters, or about three-quarters of a word [3]. Models work in tokens, not words, which is why limits are quoted in token counts rather than page counts.

Then the loop runs: the model scores every token in its vocabulary for "how likely is this to come next?", picks one, appends it, and runs again with the longer text. The picking usually has some randomness, so the same question can produce differently worded answers. The process stops when the model emits an end marker or hits a length limit. The words appear on your screen one chunk at a time, because that is literally how they are made.

Two consequences follow. First, there is no outline written in advance: each token is chosen with only the text so far in front of it, which is why long answers can drift or contradict themselves. Second, every sentence is optimized to be plausible, not to be true — and plausible and true are not the same target.

## Step 5: Post-training — why it answers instead of just continuing

A model straight out of step 2 is a text completer, not an assistant. Ask it a question and it may continue with more questions, because that is what often follows a question in the training text. So there is a final layer of work: **instruction tuning**, where the model is trained on human-written prompt-and-response pairs so it learns the shape of an answer; and then **alignment** training, where humans rank several candidate answers and the model is adjusted toward the ones people preferred [4]. This stage is what gives a chatbot its helpful, cautious, assistant-like manner, including its refusals — learned behavior, though deployed products often add separate safety filters on top.

## What this map lets you judge

Once you can place each part, a few practical judgments become obvious.

- **Knowledge is frozen and impersonal.** The model's facts come from training data with a cutoff date, and your conversation is not folded back into its parameters. Fresh information has to arrive another way — usually by being pasted into your prompt or fetched by a tool outside the model.
- **Fluency is not evidence.** Because the objective is a likely continuation, confident, well-formatted prose can be built on nothing. Checking names, numbers, quotes and citations is your job unless a tool did the checking.
- **The model only writes; tools do.** When an AI product shows current prices, does arithmetic reliably, or books a meeting, something other than the model is doing that work — search, a calculator, an API. That hand-off is exactly where "AI agents" live.
- **Wording matters more than it feels like it should.** Since your prompt becomes part of the context the next token is predicted from, adding constraints and examples genuinely changes the odds.

None of this requires knowing the math. It requires knowing where each part of the system sits — which is what the diagram above is for. From here, the natural next step is to zoom into the first two stages: what "learning from data" actually means, and why deep learning took over from earlier approaches.

## Mind map

```mermaid
flowchart LR
  A["How does AI work?"] --> B["Pipeline"]
  A --> C["Labels"]
  B --> B1["Training data: examples with answers"]
  B1 --> B2["Training: nudge billions of parameters"]
  B2 --> B3["Model: file of learned numbers"]
  B3 --> B4["Generation: predict next token, repeat"]
  B4 --> B5["Words on screen"]
  B3 --> B6["Post-training: instruction tuning + alignment"]
  B6 --> B5
  C --> C1["AI: umbrella"]
  C1 --> C2["Machine learning: learns from examples"]
  C2 --> C3["Deep learning: many-layered networks"]
  C3 --> C4["Generative AI: produces text or images"]
  B4 --> D["Why it can be confidently wrong"]
  B3 --> E["Why knowledge has a cutoff"]
```

## Glossary

- Machine learning：a way of building software where behavior comes from examples rather than rules a programmer wrote by hand.
- Neural network：layers of simple calculating units whose connection strengths are adjusted during training; stacking many layers is what "deep" refers to.
- Parameters (weights)：the adjustable numbers inside a model; training means tuning these, and the trained values are what the model "knows."
- Token：the chunk of text a model actually reads and writes — a word, part of a word, punctuation, or a word with a leading space; roughly ¾ of an English word.
- Next-token prediction：the model's one job — given the text so far, score how likely each possible next token is, then pick one.
- Model：the saved result of training — an architecture plus its parameter values — which is what runs when you send a prompt.
- Instruction tuning and alignment：extra training on human-written answers and human rankings, which turns a text completer into a helpful, instruction-following assistant.

## Sources

1. [Caltech Science Exchange: AI vs. machine learning vs. deep learning — nested definitions and the Venn diagram used in this article](https://scienceexchange.caltech.edu/topics/artificial-intelligence-research/artificial-intelligence-vs-machine-learning)
2. [IBM: AI vs. machine learning vs. deep learning vs. neural networks — how the four layers relate](https://www.ibm.com/think/topics/ai-vs-machine-learning-vs-deep-learning-vs-neural-networks)
3. [OpenAI Help Center: what tokens are and English token rules of thumb](https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them)
4. [Sebastian Raschka: LLM training, RLHF and its alternatives — pretraining, supervised fine-tuning, alignment](https://magazine.sebastianraschka.com/p/llm-training-rlhf-and-its-alternatives)

---

Original article: https://eulore.ai/articles/how-does-ai-work-a70b309a

> **Eulore** · Start small. Go deep.
>
> Eulore is an AI learning tool built around connected articles, each a 5–10 minute read. Ask questions as you go and help shape what comes next. That’s how this article was created.
>
> Start your own series → https://eulore.ai
