Definition · AI basics
Inference
Inference is the use of a trained AI model to give results from new input. A classifier gives a class for an example it did not see in training. A language model gives a response to a prompt. Training sets the model weights. Inference uses those weights and does not change them. Each request uses processor time, memory and energy.
Last reviewed
Key points
- Inference is the use of a trained model on new input. Training changes the model weights, and inference only reads them.
- A language model does inference in two phases. Prefill reads all of the prompt, and decode makes the response one token at a time.
- Memory is frequently the limit. For a 13B parameter model on one NVIDIA A100, the vLLM paper shows about 65% of memory for weights and near 30% for request data.
- Each request has a cost. Google gives 0.24 Wh for the median Gemini Apps text prompt in May 2025, a figure no third party checked.
- The inference interface is an attack surface. OWASP names cost abuse and model extraction through the model API as risks.
How inference works
Inference has three steps for each request:
- The application sends input to the model. For a language model, the input is a prompt cut into tokens.
- The model runs the input through its model weights. The weights do not change.
- The model gives a result: a class, a score, an image or text.
A language model gives text in two phases. DistServe (Zhong and others, 2024) names them:
| Phase | What it does | Metric |
|---|---|---|
| Prefill | Reads all the prompt tokens at one time | Time to first token (TTFT) |
| Decode | Adds one token after the last | Time per output token (TPOT) |
The model keeps data for earlier tokens in a KV cache. Thus decode does not read the full text again.
Why inference matters
Inference is where a model costs money, and where users and attackers touch it.
- Memory: the weights and the KV cache must fit in the memory of the processor.
- Energy: each request uses power in a data center.
- Attack surface: each user who can send a request can try to misuse the model.
In practice
Memory sets the limit
For a 13B parameter model on one NVIDIA A100 with 40GB, the vLLM paper (Kwon and others, 2023) shows this layout:
- About 65% of memory holds the weights.
- Near 30% holds the data of the requests.
- In the serving systems they tested, only 20.4% to 38.2% of KV cache memory held token data. The remaining memory was waste.
Their system, vLLM, gave 2 to 4 times the throughput at the same latency. Quantization and speculative decoding are other methods to make inference less costly.
Each request uses energy
The inference interface is an attack surface
OWASP LLM10:2025 “Unbounded Consumption” lists risks of an open inference interface:
- Denial of Wallet: attackers use the “cost-per-use model” of cloud AI to make the bill large. See denial of AI service.
- Model extraction: crafted queries to the model API let an attacker make a shadow model. See model extraction.
- Resource floods: long inputs and costly queries use up processor time.
OWASP gives “rate limiting and user quotas” as one control.
Where definitions disagree
The word “inference” has four meanings near AI:
| Source | Meaning |
|---|---|
| Machine learning (Google glossary) | Use a trained model on new input |
| Statistics | A “somewhat different meaning” (Google glossary) |
| EU AI Act, Recital 12 | Get outputs, and also “derive models or algorithms” from data |
| AI security (NIST) | An attribute inference attack infers sensitive attributes of a training data record |
The EU AI Act meaning is wide. Its “capability to infer” covers outputs, and also models or algorithms derived from inputs or data. Read the source before you compare two uses of the word.
Questions and answers
What is the difference between training and inference?
Training changes a model. In the NIST definition, the model learns parameters that make its error on training data as small as possible. Inference uses the trained model on new input to give a result, and the weights stay the same. Inference occurs for each request.
Is an inference attack an attack on inference?
Not always. NIST defines an attribute inference attack as an attack against machine learning models. It infers sensitive attributes of a training data record, given partial knowledge about the record. Here the target of the attack is the training data.
Sources
- Machine Learning GlossaryGoogle for Developers
- NIST glossary: training stage (from NIST AI 100-2e2025)NIST
- NIST glossary: deployment stage (from NIST AI 100-2e2025)NIST
- DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model ServingarXiv (Zhong et al.), 18 Jan 2024
- Efficient Memory Management for Large Language Model Serving with PagedAttentionarXiv (Kwon et al.), 12 Sep 2023
- Efficient Memory Management for Large Language Model Serving with PagedAttentionarXiv (Kwon et al.), 12 Sep 2023
- Measuring the environmental impact of AI inferenceGoogle Cloud, 22 Aug 2025
- Measuring the environmental impact of delivering AI at Google ScalearXiv (Elsworth et al.), 21 Aug 2025
- LLM10:2025 Unbounded ConsumptionOWASP GenAI Security Project
- EU AI Act, Recital 12Future of Life Institute (text of Regulation (EU) 2024/1689)
- NIST glossary: attribute inference attacks (from NIST AI 100-2e2025)NIST
Guides that use this term
Related topics
In the news
- HP tells that the PC market will shrink in 2027 and bets on AI PCs
- Sarvam model score goes from 42.6 to 73.9 on agent tests
- Two AI models sent signals through one inference server
- Kiro Enterprise gets Claude Fable 5.2 at 6 times the credits
- SkillPrivus finds privacy risks in 307 of 563 AI agent skills
- AWS Lambda adds GPUs, and 48 requests use one AI model
- OpenRouter removes 3 AI providers after months of prompt theft
- Positron says two-thirds of AI workloads are inference
- OpenAI agents do 46% of research tasks of 2 to 4 hours
- Amazon adds one gateway that sends AI requests across GPU clusters
- AWS will not repair two flaws in its Multi Model Server
- AWS Lambda increases its function time limit to 30 minutes
- Valkey 9.2 adds an AI cache that claims a maximum of 40% lower cost
- Nvidia data centre sales increased 110 percent to $107.6 billion
- AWS fixes a bug in an AutoGluon tool that can write files
- Azure Databricks enters Beta on Azure Government for US agencies
- New turn in Fireworks AI breach as Uber confirms 149,346 victims
- Swarm Shepherd warns 3 sessions or more before agent problems show
- Hugging Face sends AI model requests to OpenRouter
- A small decision head is as accurate as a large one
- BELLS-O tests 33 AI safety filters for speed and cost
- OpenAI keeps India API data in India for GPT-6 Luna
- Amazon SageMaker adds billing by use for live voice AI
- Red Hat releases AI 3.4 for AI agents on hybrid cloud
- NVIDIA gives its agent safety tool OpenShell to an open source group
- Fused-Softmax gives attention 2.1 to 3.2 times the speed on AMD GPUs
- Google Cloud shows six open AI tools for Kubernetes
- Anthropic releases Claude Fable 5.2 and Mythos 5.2 models
- Amazon TorchNeuron operates PyTorch code on Trainium chips
- Groq seeks an $8 billion valuation, 2.5 times its August mark
- Nvidia shows Agentic AI Stack to lower the cost of AI agents
- Meta strategy chief Dave Wehner becomes CFO of AI firm Fireworks
- Google opens Z4M servers with 168,000 GiB of fast local storage
- RunSybil shows a model template can get out of a Python sandbox
- Google releases XLA Serving Engine, a C++ runtime for AI models
- Tana lets teams put Claude and ChatGPT agents in meetings
- Tencent tells of 90 billion tasks done by its WorkBuddy agent
- ASRock Rack shows an NVIDIA rack with 72 Rubin GPUs and liquid cooling
- Amazon adds OpenAI GPT-5.6 models to its US government cloud
- UK chip startup Fractile raises £577M before it ships a chip
- Akamai launches a sandbox to contain code that AI agents write
- Oracle will offer Google TPU chips in its cloud from 2027
- SUSE adds NVIDIA agent safety to its closed AI platform
- Dell says 80% of AI tokens come from open models
- OpenAI gives its Open Responses standard to a neutral group
- NVIDIA expands Cosmos with 5 data blueprints for physical AI
- NVIDIA adds Confidential Bare Metal for AI model makers
- Gartner says agent workflow costs will increase 5 times or more
- More thinking makes reasoning models cancel the not all interpretation of some
- Nscale adds the NVIDIA Nemotron 3.5 Super VL model
- A study shows that accuracy is not a good test for AI agent teams
- NVIDIA makes the full Run:ai platform open source
- A new refinement step helps 6 methods of low-bit quantization