What is inference in AI? Simple guide
The moment a trained model is used to produce an answer. Each chat reply is an inference.
Last reviewedIn plain English
Inference is the moment a trained model is actually used to produce an answer. Every time you send a message to a chatbot and get a reply, that is one inference. Training is when the model learns. Inference is when it works.
Training and inference
| Training | Inference | |
|---|---|---|
| What happens | The model learns from data | The model produces an answer |
| How often | Once, or occasionally for updates | Every time someone uses it |
| Who does it | The company building the model | The company running it, or you through an API |
| What it needs | Huge amounts of data and computing power | Much less per request, but it adds up |
A simple example
A model was trained months ago on a large body of text. Today you ask it for three subject lines for an email. The model reads your prompt and generates words one at a time until the answer is complete. That whole process is inference, and it took a moment, not months.
Why it matters
- Cost. When you pay for an AI API, you are mostly paying for inference, measured in tokens. Our guide to estimating AI API costs shows how to turn it into a budget.
- Speed. Larger models and longer outputs generally take longer to produce.
- Where it runs. Inference can happen in a provider's data centre or, for smaller models, on your own computer or phone.
Common mix-ups
- Inference is not learning. Chatting with a model does not change it. It only uses what it already learned and what is in the conversation.
- The same prompt can give different answers, because the output includes some randomness. See temperature.
Related terms
- ModelThe trained AI 'brain' that produces outputs. Companies release different models with different strengths and prices.
- APIA way for one program to talk to another. Developers use AI APIs to add AI features to their own apps.
- Training dataThe examples a model learned from. Its knowledge and biases come from this data.
Keep reading
- GuidesHow to estimate AI API costs, with a worked example5 min read