Training vs. inference
9 minHow a language model is made, what it actually does when you call it, and what that means for the apps you build.
You don't need the maths to build great AI apps. But a clear picture of what's happening under the hood will save you from the most common beginner mistakes. Two words cover it: training and inference.
Training: building the engine
Training is how a model is made. It happens once (well, once per model version), at enormous scale, inside the AI company.
In simple terms:
- Pre-training. The model reads a huge amount of text and learns to predict the next token. Doing that well at scale forces it to pick up grammar, facts, reasoning patterns, coding styles and much more.
- Post-training. The model is then refined to be helpful, honest and safe: following instructions, holding conversations, using tools, and declining harmful requests.
The result is a fixed set of numbers (the model's weights) that encodes everything it learned.
Training builds the engine. You never train it yourself. You drive it.
Inference: driving it
Inference is what happens every time you call the API. Your text goes in, the model runs, and it generates a response one token at a time, each new token chosen based on everything before it.
That one fact explains a lot of behaviour:
- Why longer answers take longer. Each output token is a step. 1,000 tokens of output takes noticeably longer than 100.
- Why streaming feels faster. You can show tokens as they're generated instead of waiting for the whole answer (you'll build this in Module 3).
- Why output costs more than input. Reading your input happens in parallel; writing the output happens step by step.
What this means for your apps
1. The model doesn't learn from your conversations
When you chat with Claude through the API, you're not changing the model. Your messages don't update its weights. That's why, in Module 0, you had to send the conversation history every time: the model only knows what's in the current request.
2. Its knowledge has a cut-off date
The model knows what was in its training data, up to a point in time. It won't know about yesterday's news, your company's internal docs, or your customer's order history unless you put that information in the request. Giving the model the right information at the right time is a core skill, and Module 4 (RAG) is built around it.
3. It can be confidently wrong
A model generates the most plausible continuation of your text. Usually that's correct. Sometimes it's a plausible-sounding mistake, often called a hallucination. You reduce this by:
- giving it the facts it needs (in the prompt or via documents),
- asking it to say when it isn't sure,
- checking important outputs, which you'll learn to do systematically with evals in Module 7.
4. Same prompt, different answers
Ask the same question twice and you may get two different wordings. That's normal: generation involves choice. When you need consistency (like data in a fixed format), you'll use structured outputs in Module 2 to guarantee the shape of the answer.
Try it
- Using your chat program from Module 0, ask: "What's today's date?" Notice how it handles not knowing.
- Now change your system prompt to include today's date (for example
"Today's date is 23 November 2026.") and ask again. You've just done the simplest form of giving a model fresh information. - Ask the same open question three times in three fresh conversations. Compare the answers: what stays the same, and what changes?