Inference
Also known as: Model inference, AI inference
The stage at which a trained machine learning model is run on fresh inputs to produce predictions or generated outputs, as distinct from training.
In machine learning, inference is the use of a trained model. During training, a model's parameters are adjusted to fit data; during inference, those parameters are held fixed and the model is applied to inputs it has not seen before, such as a photo to classify, a sentence to translate or a prompt to answer. Every time someone sends a message to a chatbot or a phone recognizes a face, an inference computation runs. The term differs from statistical and logical inference, though all involve drawing conclusions from evidence.
For a large language model, inference proceeds token by token: the model processes the prompt, predicts a probability distribution over the next token, selects one and repeats. This makes inference cost scale with both model size and output length. Engineers reduce that cost with techniques such as quantization, batching many requests together, caching intermediate results, distilling large models into smaller ones and running models on specialized hardware such as GPUs and neural processing units.
Although training large models attracts more attention, inference can account for a large share of the total computing a widely used model consumes, because it runs every time the model is used. Running inference locally on laptops and phones, rather than in a data center, can improve privacy and reduce latency, and tools such as llama.cpp made this practical for many open-weight models. Some reasoning models deliberately spend extra computation at inference time, generating longer intermediate reasoning to improve their answers.
Key points
- Training sets a model's parameters, while inference applies those fixed parameters to fresh inputs.
- Language models generate output one token at a time, so longer responses cost more to produce.
- Quantization, batching, caching and distillation are common ways to make inference cheaper and faster.
- Running inference on local devices can improve privacy and responsiveness compared with cloud services.
From the source
...inference is the ability of trained AI models to recognize patterns and draw conclusions from information that they haven't seen before.
Related entries
Model Weights
The learned numerical values inside a machine learning model, set during training, that determine how it transforms inputs into outputs.
Quantization
Technique that stores and computes a model's numbers at lower precision, such as 8 or 4 bits, to cut memory use and speed up inference.
Graphics Processing Unit
Highly parallel processor originally designed to render images, now also widely used for scientific computing and for training and running AI models.
Neural Processing Unit
Specialized processor designed to run neural network computations efficiently, often built into phones and laptops for on-device AI.
llama.cpp
Open-source C and C++ engine for running large language models locally on consumer hardware, known for its quantized GGUF model format.
Ollama
Tool for downloading and running open-weight language models on a personal computer or server through a simple command line and local API.
Language model trained to generate extended reasoning before answering, trading extra computation at inference time for better problem solving.
Edge Computing
Distributed computing approach that processes data near where it is produced or used, rather than sending everything to distant centralized data centers.
Featured in guides
Referenced by
Other entries that discuss or point to Inference.