AI does ONE thing โ predict the next word.
Your brain does the same thing. But better. Much better.
AI predicts the next word. One dimension. Just text.
Your brain predicts the next sound โ a car is coming, you know before you see it. The next movement โ a cricket ball is flying, your hand is already moving. The next emotion โ your friend goes silent on a phone call for 2 seconds, and you know something is wrong. The next danger โ you step back from the edge without thinking.
Both are prediction machines. AI does one type. You do all of them, simultaneously, on 20 watts.
But HOW does AI learn to predict? And how does it use that skill when you chat with it?
Two completely different operations
Training โ how the model learns. Inference โ how the model responds. Same model. Completely different processes, hardware, costs, and timescales.
Training: How the Model Learns
Training is where the magic happens โ and where the billions of dollars go.
The Loop
The entire training process is one loop, repeated trillions of times:
Feed a sentence with the last word hidden: "The cat sat on the ___"
Model predicts using its current parameters: "banana" (wrong!)
Calculate the error โ how far is "banana" from "mat"? This distance is called the loss function
Adjust the parameters โ nudge all 5 trillion numbers slightly in the direction that would have made the answer closer to "mat." This is called gradient descent
Repeat with the next sentence
That's it. This loop runs trillions of times over months:
Data
Books, Wikipedia, GitHub, Reddit โ trillions of words from the internet
Hardware
~50,000 GPUs running 24/7
Time
3โ6 months
Cost
Estimated ~$1 billion for GPT-5
How Parameters Change
Remember from Episode 3 โ parameters are just numbers. During training, they change with every step:
Each parameter gets a tiny nudge โ gradient descent in action
Step 1: 0.4721 โ Step 2: 0.4719
Step 1: -1.2830 โ Step 2: -1.2850
Step 1: 0.0910 โ Step 2: 0.0890
Each change is tiny โ a fraction of a percent. But multiply that across 5 trillion parameters and trillions of training steps, and the model goes from predicting "banana" to predicting "mat."
Nobody programs intelligence
Nobody programs intelligence into the model. It emerges from this loop. Random noise in, useful predictions out. The model discovers grammar, facts, reasoning, and even humor entirely on its own โ just by correcting billions of prediction errors.
Inference: How the Model Responds
When you open ChatGPT and type a message โ that's inference.
Training is over. The parameters are frozen. Locked. Read-only. No learning is happening. The model is simply using what it already learned to predict the next token.
Token by Token
Inference works one token at a time:
Your prompt: "Write a professional email to reschedule a meeting"
The model predicts:
- "Subject" โ done, add it to the output
- ":" โ done, add it
- "Request" โ done
- "to" โ done
- "Reschedule" โ done
- ...and so on, token by token
Why ChatGPT 'types'
This is why you see ChatGPT "typing" โ it's not writing the whole answer and then showing you. It genuinely doesn't know word 2 until word 1 is done. Each word is a fresh prediction.
How Token Count Works
This is where it gets interesting. Every single token prediction requires the model to read all previous tokens.
Say your prompt is 50 tokens and the answer is 100 tokens:
Prediction Model reads Generates
| Token 1 | 50 tokens (your prompt) | "Subject" |
|---|---|---|
| Token 2 | 51 tokens (prompt + token 1) | ":" |
| Token 3 | 52 tokens (prompt + tokens 1-2) | "Request" |
| ... | ... | ... |
| Token 100 | 149 tokens (prompt + tokens 1-99) | "Paul" |
The context grows with every word. That's why:
Longer conversations get slower โ more to re-read each time
Long answers cost more โ each token requires more compute
There's a context limit โ 128K tokens max, then older messages get cut off
Input vs Output Tokens โ Why They Cost DifferentAI companies charge differently for input and output tokens:
Input Tokens Output Tokens
What Your prompt AI's answer
| Processing | All at once, in parallel | One at a time, sequential |
|---|---|---|
| Speed | Fast (parallel on GPU) | Slower (each waits for previous) |
| GPT-5 pricing | $2.50 / million tokens | $10 / million tokens |
| Why | One forward pass | Each token = separate forward pass |
Output tokens cost 4x more
Output tokens cost 4x more because each one requires its own prediction pass AND re-reading all previous tokens. Input tokens are processed in a single parallel operation โ much cheaper.This is also why streaming exists. When you see ChatGPT showing you words one at a time, it's not a UI effect โ the model is genuinely generating them one at a time. It can't show you the full answer instantly because it doesn't know the full answer until it's predicted every token.
The Key Difference: Parameters
This is the single most important distinction:
๐ฅ Training
CHANGE
Parameters adjust with every prediction step. That's how the model learns.
Inference
FROZEN ๐
Parameters are read-only. The model uses what it learned but never updates.
Training Inference
| Parameters | CHANGE with every step | FROZEN โ read-only |
|---|---|---|
| Goal | Learn from data | Respond to you |
| GPUs | 50,000 | 1โ8 |
| Time | 3โ6 months | Seconds |
| Cost | ~$1 billion | ~$0.002 per chat |
| How often | Once | Millions / day |
Your conversations don't teach the model anything
When your chat ends, nothing was learned. The model is identical before and after your conversation. That's why ChatGPT doesn't "remember" you across sessions โ inference is completely read-only.
The Full Picture โ Interactive Diagram
The training loop (left) versus the inference pipeline (right) โ side by side:
๐ฅ TRAINING โ Learning Phase
๐ Training Data
Books, Wikipedia, GitHub, Internet
Trillions of words
๐ Feed a Sentence
"The cat sat on the ___"
โ "banana"
โ
โ "mat"
๐ Calculate Error
How far is "banana" from "mat"? (Loss Function)
๐ง Adjust Parameters
Nudge 5 trillion numbers slightly
0.4721
โ
0.4719
(Gradient Descent)
๐ Repeat ร TRILLIONS of times
Until "banana" becomes "mat"
REPEAT LOOP
Training Resources
50,000 GPUs ยท 3โ6 months ยท ~$1 Billion
Parameters: ADJUSTING with every step
INFERENCE โ Using Phase
๐ฌ Your Prompt
"Write a professional email to
reschedule a meeting"
๐ Load Frozen Parameters
Same 5 trillion numbers from training
Read-only. Never change.
๐ฎ Predict Next Token
One token at a time:
"Subject" โ ":" โ "Request" โ "to" โ ...
next
token
๐ Output (token by token)
Subject: Request to Reschedule
Dear Mr. Sharma,
I would like to reschedule our
meeting to Friday...
Best regards, Abhishek Paul
Done
No learning happened. No parameters changed.
Inference Resources
1โ8 GPUs ยท Seconds ยท ~$0.002 per chat
Parameters: FROZEN ๐ (read-only)
VS
Comparison
๐ฅ Training
Inference
What happens
Model LEARNS from data
Model RESPONDS to you
Parameters
Change every step
Frozen ๐ (read-only)
GPUs
50,000
1โ8
Time
3โ6 months
Seconds
Cost
~$1 Billion
~$0.002
How often
Once
Millions / day
๐ก Training = School (expensive, once)Inference = Exam (cheap, unlimited)
@making_in_time_ ยท Learn AI Infrastructure โ Episode 4
The analogy that sticks
Training = School (expensive, done once, shapes who you are).
Inference = Taking an exam (cheap, unlimited, uses what you already learned).The Brain Comparison
Your brain and AI are both prediction machines. But the comparison reveals how different they really are:
AI (GPT-5) Your Brain
| Predicts | Next word (text only) | Next sound, movement, emotion, danger โ all senses |
|---|---|---|
| Training | 50,000 GPUs, 6 months, ~$1 billion | Dal chawal, mummy ki daant, gully cricket. Free. |
| Inference speed | ~50-100 tokens/second | Instant (parallel across all senses) |
| Re-reads context | Yes, every single token | No โ persistent memory, no re-reading |
| Energy | Thousands of watts | 20 watts |
AI has to re-read your entire conversation for every single word it generates. Your brain doesn't re-read your entire life every time you speak. That's a fundamental architectural difference โ and it's why AI still has a long way to go.
The honest truth
AI training costs $1 billion and takes 6 months. Your brain was trained by dal chawal, mummy ki daant, and gully cricket. For free. On 20 watts. And it can feel, laugh, love, and know when to stay quiet. We're just getting started.
Practical Takeaways
Training and inference are completely different operations โ different hardware, costs, and timescales
Parameters change during training, freeze during inference โ that's the core difference
AI only predicts the next token โ everything else (coding, reasoning, humor) emerges from this one skill
Output tokens cost more than input โ because each requires a separate prediction pass
Your conversations don't teach the model anything โ inference is read-only
Longer answers = more compute = more cost โ every token re-reads the full context
The single most important thing
Training is where the model becomes intelligent. Inference is where it demonstrates that intelligence. One is expensive and happens once. The other is cheap and happens billions of times a day. Understanding this distinction unlocks everything else in AI engineering.
Next: Episode 5 โ Context Window
What does "128K tokens" actually mean? Why does AI forget what you said 5 minutes ago? And why does your conversation suddenly get dumber halfway through? The answer is the context window โ and it's the most practical concept in AI engineering.
This is part of a 98-episode series covering AI engineering from tokens to production deployment.