Inference

Inference is the process of running a trained AI model on new input to produce an output, such as generating a response to a prompt, as opposed to training the model in the first place.

Key takeaways

  • Inference is running a trained model on new input to produce an output, without changing the model.
  • Training happens once (or periodically); inference happens every time the model is actually used.
  • Larger models generally cost more and take longer to run inference on than smaller ones.
  • Quantization and specialized hardware are common ways to speed up and reduce the cost of inference.
  • Inference cost and speed, not training cost, dominate the day-to-day economics of running an AI product at scale.

What is inference in AI?

Inference is what happens every time you send a prompt to an AI model and get a response back. The model has already been trained; inference is simply using that finished model's learned weights to process new input and produce a prediction or generated output, without changing the model itself.

Inference vs training

Training is the expensive, one-time (or periodic) process of teaching a model by adjusting its weights across a massive dataset, often taking weeks and enormous computing resources. Inference is what happens afterward, every single time the model is used, and while each individual inference request is far cheaper than training, the cumulative cost of serving millions of requests is a major factor in running an AI product.

What affects inference speed and cost

Larger models generally require more computation per token generated, making inference slower and more expensive. Techniques like quantization, which reduces the precision of a model's numbers, and specialized inference hardware are widely used to make serving models faster and cheaper without retraining them.

Why inference matters

Most of the real-world cost and latency users experience with AI products comes from inference, not training. As models are deployed to more users, optimizing inference — through better hardware, smaller distilled models, or techniques like caching — becomes as important to a product's viability as the quality of the model itself.

Frequently asked

What is the difference between training and inference?
Training is the process of teaching a model by adjusting its weights on a large dataset; inference is using that already-trained model to generate a response to new input.
Why is inference expensive at scale?
Even though a single inference request is cheap compared to training, serving millions of requests from many users adds up, especially for larger models that require more computation per response.
How can inference be made faster?
Common approaches include quantization to reduce a model's numerical precision, using smaller distilled models, and running inference on specialized AI hardware.

Mentioned in the news