# Inference

> Inference is the stage where a trained AI model is used to produce outputs, such as answers, classifications or images, from new inputs, as opposed to training, where the model learns from data.

Also called: model inference, running a model, prediction, model serving, inference cost. Category: Models and training. Source: https://aibuildindex.com/glossary/inference

## In the index

- AI API integration: median $2,500, middle half $500 to $6,400, 1,993 priced briefs (https://aibuildindex.com/cost/ai-api-integration)
- AWS: median $4,800, middle half $900 to $14,500, 1,488 priced briefs (https://aibuildindex.com/tools/aws)

An AI model has two lives. In training it learns from data, which is slow and expensive and usually done by the model provider. In inference it is put to work: each time an application sends it an input and gets a result back, that is an inference call. For a business buying an AI build, almost all of the running cost and most of the speed questions sit in inference, which makes it the part of the model's life that matters most after launch.

## How it works

During inference the model's learned weights stay fixed. The application sends an input, the model performs its calculations, and a result comes back. For a language model, that means reading the prompt and generating a reply token by token. For an image classifier, it means returning a label and a confidence score.

Inference can be run in a few ways:

- **Through a provider's API.** The simplest route. The provider hosts the model and charges per use, typically per [token](https://aibuildindex.com/glossary/token) for language models.
- **On rented cloud hardware.** A team runs a model, often an [open-weight model](https://aibuildindex.com/glossary/open-weight-model), on graphics processors it rents, paying for the machines rather than per request.
- **On a device.** Small or compressed models can run on a phone, laptop or edge device, avoiding network calls.

Techniques such as [quantization](https://aibuildindex.com/glossary/quantization), caching and [batch processing](https://aibuildindex.com/glossary/batch-processing) reduce the cost or time of each inference. Requests that need an immediate answer, such as a live chat reply, are handled differently from bulk jobs, such as classifying a backlog of documents overnight.

## What it means for cost

Inference is the recurring cost of an AI build. It scales with how many requests the system handles and how large each one is. A prototype tested by a few people may cost very little to run; the same design used by thousands of customers can become a significant monthly expense. Choosing the right model size for each step, keeping prompts lean and processing bulk work in batches all reduce it.

Ask a builder for an estimate of inference cost at realistic volume, which parts of the system call a model, and whether cheaper options exist for the simpler steps.

## Common questions

### Is inference cheaper than training?

Each inference call is cheap compared with training a model, but inference happens continuously while training happens once. For a business using a provider's model, inference is usually the only model cost it pays.

### Why do some providers charge differently for input and output?

Generating output tokens one at a time takes more computation than reading input, so many providers price output higher. Builds that produce long answers therefore cost more to run than ones that return short labels.

### Can inference run without sending data to a provider?

Yes, if the model is self-hosted on your own infrastructure or on a device. That keeps data in-house but brings hardware, setup and maintenance work that a hosted API avoids.

## Related terms

- [Latency](https://aibuildindex.com/glossary/latency): Latency is the delay between sending a request to an AI system and receiving its response, which determines whether a feature feels instant, acceptable or too slow for its users.
- [Token pricing](https://aibuildindex.com/glossary/token-pricing): Token pricing is the usage-based billing model most AI model providers use, charging per number of tokens sent to and generated by the model, usually with separate rates for input and output and different rates for each model.
- [Quantization](https://aibuildindex.com/glossary/quantization): Quantization is a technique that stores an AI model's numbers at lower precision, which makes the model smaller and faster to run on cheaper hardware at the cost of a usually small loss in quality.
- [Batch processing](https://aibuildindex.com/glossary/batch-processing): Batch processing is running a large set of AI requests together as a background job rather than one at a time in real time, which suits work that can wait and is often cheaper through providers' batch services.
- [Large language model (LLM)](https://aibuildindex.com/glossary/large-language-model): A large language model is an AI model trained on very large amounts of text to predict the next word, which lets it write, summarise, translate, classify and answer questions in natural language.
