AI Model Training vs Inference
Training is how an AI model learns its weights; inference is how it uses them. Compare compute, memory, hardware, costs and the techniques behind each.
Training is the phase where an AI model learns: it processes example data, measures its errors, and adjusts billions of internal numbers (weights) until its predictions improve. Inference is the phase where the finished model is used: it takes a new input and runs it through those fixed weights to produce an answer. Training happens once per model version and is extremely compute-heavy; inference happens every time anyone uses the model, so its costs grow with usage.
NVIDIA's explainer puts the dependency simply: "Inference can't happen without training" [1]. The reverse is also true in business terms. A model that is trained but never served earns nothing.
The core difference in one diagram
The top lane is a loop. The bottom lane is a one-way path. That difference drives almost everything else in this article: the hardware, the memory, the costs and the engineering tricks.
How training works
Training adjusts a model's weights to reduce a measured error. Google's Machine Learning Crash Course walks through the basic version, gradient descent, with a simple model [3]:
- Forward pass. Run a batch of example inputs through the model with its current weights to get predictions.
- Loss. Compare predictions with the targets using a loss function, a single number that says how wrong the model is.
- Gradients. Calculate how the loss would change if each weight moved slightly. In deep networks this step is called backpropagation.
- Update. Nudge each weight a small step in the direction that lowers the loss. The size of the step is the learning rate.
- Repeat. Do it again with the next batch, for many iterations, until the loss stops meaningfully decreasing [3].
For a large language model, the "targets" are usually the next token in a huge body of text. The model sees a passage, predicts each next token, and gets corrected on every one. Our guide to how large language models work covers that pretraining objective and the post-training steps that follow it.
Why training is so expensive
Training needs far more than the model's weights in memory. It also holds intermediate activations from the forward pass (needed to compute gradients), the gradients themselves, and the optimizer's running statistics. And it repeats this across enormous datasets.
The scale is hard to picture. NVIDIA states that "training Llama 3.1 with 405 billion parameters required roughly 38 yottaflops" of compute [1]. A yottaflop is 10ยฒโด floating-point operations.
Researchers have studied how to spend that compute. Kaplan and colleagues found in 2020 that language model loss improves as a power law with model size, data and training compute [4]. In 2022, Hoffmann and colleagues concluded that many large models were "significantly undertrained" and that, for a fixed compute budget, model size and training tokens should grow in equal proportion [5]. Their 70-billion-parameter Chinchilla model, trained on four times more data than the 280-billion-parameter Gopher with the same compute, outperformed it [5].
That result matters for inference too. The authors note that a smaller compute-optimal model uses "substantially less compute for fine-tuning and inference" [5]. Choices made during training set the bill for serving.
Tricks that make training feasible
- Mixed precision. Storing weights, activations and gradients in 16-bit floating point instead of 32-bit nearly halves memory use. A 32-bit master copy of the weights and a technique called loss scaling preserve accuracy [6].
- Fine-tuning instead of training from scratch. Most organizations start from a pretrained model and adapt it. NVIDIA describes fine-tuning as "the bridge between a foundation model trained on broad data and a model specialized for a specific domain" [1].
- Parameter-efficient fine-tuning. LoRA freezes the original weights and trains small add-on matrices. On GPT-3 175B, its authors report about 10,000 times fewer trainable parameters and about 3 times less GPU memory than full fine-tuning, with no added inference latency [7]. We cover this in our upcoming explainer on LoRA and QLoRA.
Fine-tuning is still training: it runs the full loop, just on less data and often fewer weights. If you are weighing it against retrieval, see RAG vs fine-tuning.
How inference works
At inference time the weights are frozen. There is no loss, no gradient and no update, only the forward pass. NVIDIA's glossary defines inference as the stage where a trained model produces outputs by making predictions on new data [2].
For a classic model, one forward pass produces one prediction, such as "spam" or "not spam." For a language model, inference is a loop of forward passes, one per generated token. NVIDIA splits it into two phases [1]:
- Prefill: "All input tokens are processed at once, flowing through every layer of the neural network."
- Decode: "The model begins generating outputs one token at a time."
Prefill is parallel and compute-heavy. Decode is sequential, and each step depends on the one before.
The KV cache and batching
To avoid recomputing the whole prompt on every decode step, Transformer models store the attention keys and values for past tokens in a key-value (KV) cache. (Our Transformer explainer explains where keys and values come from.) The cache is large and grows with each token. The vLLM researchers found that wasted cache memory limited how many requests a server could batch together. Their PagedAttention method manages the cache like virtual memory pages and improved throughput 2 to 4 times over the systems they compared, at similar latency [8].
Batching, meaning running many users' requests through the hardware at once, is the main lever for keeping accelerators busy. NVIDIA lists dynamic and in-flight batching among its inference techniques [2].
What inference teams measure
NVIDIA's glossary frames inference performance in three terms [2]:
- Latency: how long a user waits, often measured as time per generated token.
- Throughput: how many tokens the system produces per second across all users.
- Cost: usually expressed per token.
These pull against each other. Bigger batches raise throughput but can raise each user's latency. Overprovisioning hardware lowers latency but raises cost [2].
Tricks that make inference cheaper
- Quantization. Running a trained model at lower numerical precision. The LLM.int8() paper reported that 8-bit matrix multiplication "cut the memory needed for inference by half" with no performance loss on the models tested, including a 175-billion-parameter one [9]. See our upcoming explainer on model quantization.
- Smaller models. A small language model costs less per token to serve. Stanford HAI's 2025 AI Index reports that the inference cost for a system performing at the level of GPT-3.5 "dropped over 280-fold" between late 2022 and late 2024, helped by more capable small models [13].
- Other serving techniques. NVIDIA lists speculative decoding, pruning and layer fusion alongside quantization [2].
Training vs inference at a glance
Training | Inference | |
|---|---|---|
Goal | Learn weights from data | Use fixed weights on new inputs |
Passes | Forward + backward, then update | Forward only |
Weights | Change every step | Frozen |
Memory holds | Weights, activations, gradients, optimizer state | Weights, plus KV cache for language models |
Typical precision | Mixed 16/32-bit common [6] | Often lower, such as 8-bit [9] |
When it runs | Once per model version, on large clusters | Every request, continuously |
Cost scales with | Model size ร data ร experiments | Number of users ร tokens per request |
Key metrics | Loss, time to train, cost of a run | Latency, throughput, cost per token [2] |
Where it runs | Large accelerator clusters | Data centers, plus PCs and phones for small models |
Who does it | A few labs for frontier models; many teams fine-tune | Anyone who uses or deploys a model |
Hardware: increasingly split
The same chip can do both jobs, but the demands differ. Training needs huge compute and fast links between thousands of chips. Inference for interactive apps is often limited by memory bandwidth and latency.
Specialized inference hardware is not new. Google's first Tensor Processing Unit, described in a 2017 paper, was built to accelerate "the inference phase of neural networks" and had been deployed in its data centers since 2015 [11].
In 2026, Google split its eighth TPU generation into two chips. It says TPU 8t "shines at massive, compute-intensive training workloads," while TPU 8i "is designed with more memory bandwidth to serve the most latency-sensitive inference workloads" [12]. Google's stated reason is that the industry would benefit from "chips individually specialized to the needs of training and serving" [12]. Other companies are pursuing dedicated inference silicon too; for one news example, see our coverage of OpenAI's inference chip plans.
Our upcoming comparison of AI chips, CPUs, GPUs and TPUs goes deeper on the hardware.
The line is blurring: test-time compute
Traditionally, you made a model smarter by training it more. A newer approach spends more compute at inference instead, letting the model generate and check several candidate answers or reason through many steps before replying. NVIDIA calls this test-time scaling "a fast-growing area of interest" [1], and its glossary notes that reasoning models make a sequence of inference passes and produce more output tokens to reach better answers [2].
Research supports the trade. Snell and colleagues reported in 2024 that, on problems where a smaller model already had some success, spending inference compute wisely let it outperform a model 14 times larger in a FLOPs-matched comparison [10]. The practical upshot: inference is no longer a cheap afterthought. A single hard question can now cost many times more than a simple one.
Costs and environmental footprint
Training costs are concentrated: a large bill per model version. Inference costs are spread out but never stop, and they grow with every new user and every longer answer.
Both have environmental costs. Stanford HAI's 2026 AI Index highlights an estimated 72,816 tons of CO2 equivalent for training one frontier model (Grok 4), and estimates that inference water use for one widely used model (GPT-4o) may exceed the drinking water needs of 1.2 million people [14]. These are estimates, and the methods behind them deserve scrutiny, but they show that both phases matter. On the efficiency side, the 2025 AI Index reports that hardware energy efficiency has improved by about 40% each year [13].
How to decide where to spend
Most organizations never train a foundation model. The practical questions are narrower:
- Using a hosted model through an API? You are buying inference. Watch tokens per request, latency targets and the price per token.
- Need domain behavior the base model lacks? Try prompting and retrieval-augmented generation first. Fine-tune (a small training job) if you need consistent style, format or specialized skills.
- Serving your own model? Inference engineering dominates: pick the smallest model that meets quality, quantize where accuracy holds, batch requests, and size memory for the KV cache.
- Training from scratch? Usually only justified for frontier labs, unusual data, or strict control requirements. Small-scale training is getting more accessible, as our coverage of the nanochat project shows, but large-model pretraining remains a cluster-scale effort.
Frequently asked questions
Is inference just "running" the model?
Yes. Inference means passing new inputs through a trained model to get outputs, with the weights held fixed [2]. For a chatbot, every reply is inference, often hundreds or thousands of forward passes, one per token.
Does a model learn from my conversations during inference?
Not during inference itself. The weights are frozen while it answers, so nothing in the forward pass updates the model. A provider could later use logged conversations as training data for a future version, which is a policy question to check in each service's terms.
Is fine-tuning training or inference?
Training. Fine-tuning runs the same loop of forward pass, loss, gradients and weight updates, just starting from a pretrained model, often training only a few layers or adapters on domain-specific examples [1]. Methods like LoRA reduce how many weights are updated [7].
Why do GPUs dominate training?
Training is mostly enormous matrix multiplications repeated across huge datasets, which suits chips with thousands of parallel arithmetic units and fast memory. Inference also runs well on GPUs, but it can move to CPUs, NPUs or specialized chips when the model is small or quantized. Our AI chips comparison covers the trade-offs.
Which costs more overall, training or inference?
It depends on the model and how widely it is used. Training is a large one-time cost per version; inference cost scales with usage and, with reasoning models, with how much the model "thinks" per request [2][10]. We did not find a reliable, current public figure for the industry-wide split, so treat confident percentages with caution.
What is test-time compute?
It is extra computation spent at inference to improve an answer, such as generating several candidates and picking the best, or reasoning through more steps. Research shows it can sometimes substitute for a larger model [10].
Sources
- What's the Difference Between Deep Learning Training and Inference?, NVIDIA Blog, originally 2016, updated October 2025.
- What is AI Inference?, NVIDIA Glossary.
- Linear regression: Gradient descent, Google Machine Learning Crash Course.
- Scaling Laws for Neural Language Models, Kaplan et al., arXiv, 2020.
- Training Compute-Optimal Large Language Models, Hoffmann et al., arXiv, 2022.
- Mixed Precision Training, Micikevicius et al., arXiv, 2017.
- LoRA: Low-Rank Adaptation of Large Language Models, Hu et al., arXiv, 2021.
- Efficient Memory Management for Large Language Model Serving with PagedAttention, Kwon et al., arXiv, 2023.
- LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale, Dettmers et al., arXiv, 2022.
- Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters, Snell et al., arXiv, 2024.
- In-Datacenter Performance Analysis of a Tensor Processing Unit, Jouppi et al., arXiv, 2017.
- Our eighth generation TPUs: two chips for the agentic era, Google, 2026.
- The 2025 AI Index Report, Stanford HAI.
- Inside the AI Index: 12 Takeaways from the 2026 Report, Stanford HAI, April 13, 2026.