Skip to content

Inference

Also called: model inference, AI inference

Published:

How is inference different from training?

Google's machine learning glossary gives two readings. In traditional machine learning, inference means applying a trained model to unlabeled examples to make predictions; for large language models, it is the process of using a trained model to generate a response to a prompt [1]. The glossary also notes that statistics uses the word differently [1].

During training a model runs forward and backward passes and adjusts its parameters to reduce error. Inference involves only the forward pass [2]. The two stages usually run separately, although a deployed model can still be fine-tuned over time [2].

Where do you see inference?

A spam filter deciding whether an email is spam, based on how closely it resembles the examples it saw in training, is running inference [2]. So is a large language model building an answer one predicted token at a time [2]. Social media platforms use the same step to estimate which content a user is likely to engage with [2].

What drives the cost of inference?

How you run it matters most. Batch inference processes groups of inputs on a schedule and is the cheaper option. Online inference generally costs more and adds complexity, but time-sensitive systems such as chatbots and autonomous vehicles need it [2]. Hardware matters too: GPUs are the industry standard for running deep learning models, and more specialised chips such as TPUs and NPUs are also used [2].

Frequently asked questions

Is inference the same as prediction?

They are close. Inference is the process of running the trained model; the prediction or response is its output.

Is asking a chatbot a question an inference?

Yes. Each request is an inference step in which the trained model produces a response to new input.

Sources

  1. Machine Learning Glossary: Generative AI — Google for Developers
  2. What is AI inference? — IBM