The short answer
In AI models, inference is the process of running a trained model on new input to get an output. The output might be a label, a score, a number or a block of generated text. Training comes first, when the model learns its internal settings, called parameters, from data. Inference comes after. The parameters stay as they are, and the model is used.
How inference differs from training
Training is the learning stage. The model is shown many examples, its predictions are compared with the correct answers, and its parameters are adjusted to reduce its errors. Training usually needs a lot of data and computing time.
Inference does none of that. A trained model takes a new input, passes it through its fixed parameters, and returns an output. Each single prediction is one run of inference.
The learning side is covered in how do neural networks and machine learning actually learn.
An example: a spam filter
A spam filter shows the difference clearly. During training, it is given many emails, each labeled as spam or not spam. Once trained, it receives an email it has never seen and outputs a spam label or score. Each time it checks a new message, it is running inference. The training step happened earlier and is not repeated for each message.
Other examples
- An image classifier reads a new photo and predicts what it shows.
- A speech recognizer turns a new audio clip into text.
- A language model generates a reply to a prompt, one piece of text at a time.
Where inference runs
Inference can run on a phone, a laptop, a server or a data center. Small models can run on ordinary processors. Larger models often need graphics processing units (GPUs) or other accelerators to respond quickly enough.
Serving a model to many users typically needs an inference server. See what is an inference server for how that software works.
Inference in the older sense
In classic AI, inference has a different meaning: logical reasoning from facts and rules. The types of inference in artificial intelligence are explained separately.
Key points
- Inference is running a trained model on new input.
- Training adjusts the model’s parameters, and inference uses them as they are.
- Inference runs every time the model is used, so speed and cost matter.