What Is AI Inference? Definition and Examples
Quick answer
AI inference explained: what it means, how it differs from training, online vs batch serving, a runnable example and an illustrative per-query cost.
AI inference is the stage where a trained model is put to work: it takes new data it has never seen and produces a prediction, label or piece of text. Training teaches the model, inference uses it. Every time you type a prompt into a chatbot or a bank scores a loan application, inference is running.
Key takeaways
- Inference means using an already trained model on new inputs; no learning happens during it.
- It needs only a forward pass, so one request is far cheaper than a training step, but requests repeat endlessly.
- Online inference answers one request at a time; batch inference scores many records in one scheduled run.
- At scale, memory and batching limits matter as much as raw compute.
On this page:
- What AI inference means
- How inference works, with code
- Where inference is used
- Common mistakes and confusions
- Related terms
- Frequently asked questions
| Term | What happens | How often |
|---|---|---|
| Training | The model's weights are adjusted using many examples | Once, or occasionally repeated |
| Inference | The fixed model produces an output for a new input | Every request, all day |
| Fine-tuning | A trained model is trained a little more on specific data | Occasionally |
| Evaluation | Inference run on held-out data to measure quality | Before release and after changes |
What does AI inference mean?
It means applying a trained model to new data. According to IBM (page updated January 2026), AI inference is the act of using a trained AI model to make predictions on new data. TechTarget (2024) puts it as the process in which a trained model applies its understanding to generate original output.
A plain analogy: training is a student studying for years, inference is the exam where the student answers questions never seen before. Only the answering is inference. Typing a prompt into a chatbot is inference, because the model's weights are already fixed.
How does AI inference work?
A request goes through the model once, from input to output. IBM notes that, unlike model training, inference entails only a forward pass. There is no error calculation and no weight update, which is why a single request costs far less than a training step.
The code below is illustrative and runs if scikit-learn and joblib are installed. The first block is training, done once. The second block is inference, done for every new request.
import joblib
from sklearn.linear_model import LogisticRegression
# Training: run once
X = [[1], [2], [3], [4], [5], [6]]
y = [0, 0, 0, 1, 1, 1]
model = LogisticRegression().fit(X, y)
joblib.dump(model, "model.joblib")
# Inference: run for every new input
model = joblib.load("model.joblib")
for hours in ([1.5], [5.5]):
print(hours, "->", model.predict([hours])[0])The loop prints a prediction for each new row. The model is never changed by it.
Online versus batch inference
According to IBM, in online inference a trained model processes input data immediately, one input at a time. In batch inference, it processes a large volume of inputs asynchronously in groups. Choose online when a person is waiting, and batch when results can arrive later.
Why it costs money at scale
TechTarget notes that while training is a one-time investment, inference costs accumulate over time. Here is an illustrative calculation with made-up numbers. Suppose a chatbot serves 1,00,000 queries a day and each query uses compute worth Rs 0.20. The daily bill is Rs 20,000, and it repeats tomorrow. Real prices differ by model and provider.
Memory is the other limit. The authors of the PagedAttention paper (Kwon et al., arXiv) write that high-throughput serving of large language models requires batching sufficiently many requests at a time, and that the key-value cache memory for each request is huge and grows and shrinks dynamically.
Where is AI inference used?
It is used wherever a trained model answers a live or scheduled question. Two illustrative Indian scenarios: an Indian bank runs overnight batch inference to score 5 lakh loan applications for pre-approval, and the same bank runs online inference for a chat assistant that answers one customer question at a time.
Inference can also run on a phone, which lets features such as photo tagging work without a network connection, provided a small enough model is installed on the device. Larger language models usually run on servers.
What are the common mistakes and confusions?
- Thinking the model learns from your prompt. During inference the weights do not change. A chatbot may use earlier messages as context, but that is not training.
- Budgeting only for training. The recurring cost sits in serving requests.
- Mixing up latency and throughput. Online inference cares about the wait for one answer. Batch inference cares about how many records finish per hour.
Which terms are related?
Inference sits beside training, fine-tuning and evaluation. To see what the model is, read what an LLM is in simple words and how large language models are trained and used. To see how quality is measured, see LLM evaluation explained. For the bigger map, see AI vs machine learning vs generative AI vs agentic AI.
Next step
Run the code above, then change the input rows and watch the predictions. If you are preparing for interviews, practise explaining training versus inference in two sentences, and read LLM interview questions. For a structured path into AI, see the Certification in AI & ML (Launchpad) from Vishlesan i-Hub, IIT Patna, a 12-week programme.
Frequently asked questions
What is the difference between AI training and AI inference?
Training adjusts a model's weights using many examples, and is largely a one-time investment. Inference uses the finished model on new data and needs only a forward pass. Inference happens on every request, so its cost accumulates.
Is ChatGPT doing inference when I type a prompt?
Yes. When you send a prompt, the already trained model generates a reply. Its weights are not changed by your message. Earlier messages may be used as context, but that is not training.
What is batch inference vs online inference?
Online inference processes input immediately, one input at a time, so a person gets an answer right away. Batch inference processes many inputs asynchronously in groups, for example scoring applications overnight.
Why is inference expensive?
Each request uses compute, and requests repeat all day, so costs accumulate. For large language models, serving also needs a lot of memory, including a key-value cache for each request.
Can inference run on a phone without internet?
Yes, if a small enough trained model is installed on the device, since inference needs only the model and the input. Large language models usually run on servers because of their size.