Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Part 1
Inference is a trained AI model answering your prompt. Say you type, write me a haiku about coffee, and press enter. That prompt travels to a model running on GPUs, the chips that do the heavy math, and a finished haiku writes back to your screen, all within seconds.
Step 1: your prompt becomes tokens
First, the model doesn't read your sentence as one block. It chops it into tokens, small word-pieces, a bit like Scrabble tiles. Here that gives six: Write, me, a, haiku, about, coffee. That split is illustrative. Real systems often break words into even smaller pieces.
Step 2: tokens travel to a data center
When you press enter, your coffee prompt goes through the tokenizer, and the six tokens head over the internet to a data center. That's just a warehouse of computers. Inside, a GPU, a chip built to do lots of small calculations at once, runs the model.
GPUs: many cooks, one cookbook
Think of the trained model as a finished cookbook. It holds patterns the model already learned, and nobody rewrites it while answering. The GPUs are a huge kitchen of cooks, each handling one tiny step at the same moment, all reading from that same book. That's why answers come back fast.
Step 3: one token at a time
Think of it as supercharged phone autocomplete. The model reads all the text so far, picks a likely next token, say "Morning", and appends it. Then the longer text goes back in, and the loop repeats. One token at a time, until the haiku is finished.
The whole trip, in seconds
Zoom out and the whole trip takes seconds. You press enter, the tokenizer turns your coffee prompt into six tokens, and they head to the GPU model in the data center. Each new token streams back and becomes words on your screen, which is why the haiku types out gradually. The model learned nothing along the way.
Learning once vs. answering every time
Training is the chef writing one giant cookbook from a mountain of recipes. It's learning patterns from huge amounts of text, and it happens once, over weeks or months. Inference is the busy kitchen, cooking from that finished book. Your coffee haiku was one ticket, and every prompt adds another.
Why inference now dominates cost
Training is expensive, but it ends. Inference never ends, because every answer needs GPU time. Multiply that by millions of prompts a day, plus longer answers, and inference usually becomes the bigger ongoing cost for a popular model.
- Training: a big bill, paid once
- Inference: a bill on every prompt
- Millions of users, every single day
Training writes the cookbook once; inference cooks every single order.
Training writes the cookbook once; inference cooks every single order. So each time you press enter, a kitchen of GPUs cooks your answer, one token at a time, and that cooking cost comes back with every prompt.

