AI Inference

What is AI Inference?

AI inference is the process of running a trained AI model on new inputs to produce outputs, such as answers, predictions or generated content. It is the stage at which AI does useful work.

Updated November 2026 · 2 min read


AI inference is the work an AI model does after training, when it takes a new prompt or data point and produces a response, much like a student sitting an exam after months of study. Training teaches a model patterns from data. Inference applies those patterns to new inputs: a language model answering a question, an image model classifying a photo, a fraud model scoring a transaction. Every time someone uses AI, inference is running. It is where AI delivers value, and for most organizations, it is where AI costs come from.

How does AI inference work in language models?

Language model inference has two phases:

  • Prefill: the model processes all input tokens at once, building an internal representation of the prompt. This phase determines the time to first token.
  • Decode: the model generates output one token at a time, each based on everything before it. This phase determines how fast the response streams.

The model stores intermediate results from earlier tokens in a KV cache so it does not recompute them for every new token. Because output must be generated one token at a time, decoding uses hardware far less efficiently than processing input in parallel, which is why output tokens usually cost more. See input and output tokens.

Ways inference is delivered

  • Through APIs, where a provider runs the model. See LLM API.
  • Serverless, where a platform scales compute automatically. See serverless inference.
  • Self-hosted, on the organization's own or rented hardware. See self-hosted LLM.
  • On device, such as small models running on phones or laptops.
  • In batches, for work that does not need an immediate answer. See batch inference.

What matters in inference

  • Quality: whether the outputs are good enough for the task.
  • Latency: how quickly responses arrive. See tokens per second.
  • Throughput: how many requests can be served at once.
  • Cost: what each request or task costs. See inference cost.

These pull against each other. A larger model may give better answers but cost more and respond more slowly. Choosing the right balance for each use is the core of inference design.

An example

Consider a hypothetical bank using AI in three places. Fraud scoring runs inference on every card transaction and must respond in under 100 milliseconds, so it uses a small, specialized model on dedicated hardware. A customer assistant needs good conversational quality with responses starting within a second, so it uses a mid-sized model through an API. Monthly analysis of complaint trends needs the best reasoning but no speed, so it runs a large model through a discounted batch API overnight. Each use gets the inference setup that fits its quality, speed and cost needs.

Techniques for making inference faster and cheaper are covered in inference optimization.

Frequently asked questions

What is the difference between AI training and AI inference?

Training teaches a model patterns from large amounts of data, usually in a large, one-time effort. AI inference applies those patterns to new inputs, such as answering a question or scoring a transaction, every time the model is used. For most organizations, inference is where both the value and the ongoing cost of AI come from.

What are the prefill and decode phases of AI inference?

In language model inference, prefill processes all input tokens at once and determines the time to the first token. Decode then generates output one token at a time, which determines how quickly the response streams. Decode uses hardware less efficiently than parallel prefill, which is why output tokens usually cost more.

How do you choose the right AI inference setup for a use case?

Balance quality, latency, throughput and cost for each use. Fast real-time decisions may need a small model on dedicated hardware, conversational tools a mid-sized model through an API and deep analysis with no time pressure a large model through a discounted batch API. A single AI inference setup rarely suits every use.