Inference versus training

Training runs a forward pass, computes a loss, propagates gradients backward and updates the weights, repeated over the dataset many times. It must keep intermediate activations for the backward pass and store optimizer state, and it usually needs floating-point formats with enough range for small gradients. Inference runs the forward pass only, with frozen weights, one input or batch at a time. It needs far less memory and computation per sample and tolerates much lower precision, so 8-bit integers or narrower formats are common. Training happens once per model version, while inference runs every time the model is used.

What limits inference speed

Most of the arithmetic is multiply-accumulate operations inside matrix products and convolutions, which is why accelerators pack thousands of multiply-accumulate units. Feeding them is often the real bottleneck. With a batch of one, each weight fetched from memory is used for only one input, so performance is limited by memory bandwidth rather than arithmetic; generating text with a large language model, where every new token reads all the weights, is a typical example. Batching several requests reuses each fetched weight, raising throughput at the cost of latency. Latency and throughput therefore must be stated separately.

Making models smaller and cheaper

Quantization from FP32 to INT8 cuts weight storage and memory traffic to a quarter and lets compact integer units do the math, at the price of a small accuracy risk that calibration or quantization-aware training controls. Distillation trains a small student model to imitate a large teacher. Pruning removes weights or whole channels that contribute little, and structured sparsity patterns let hardware skip zeros. These techniques combine, and they are what makes running a model within the memory, power and heat budget of a phone or embedded device possible.

Cloud versus edge inference

Data-center inference runs large models on GPUs or dedicated accelerators with plenty of memory and power. Edge inference runs on the device, typically on a neural processing unit (NPU) in the system-on-chip, which specializes in low-precision matrix math, reuses data on chip and omits general-purpose machinery such as branch prediction, giving much higher energy efficiency than a CPU. Running on the device avoids network latency, works offline, keeps photos and audio local and saves server cost. The trade-off is that very large models do not fit within the device's limits without heavy compression.

Try it: questions about AI inference

In AI inference, what is the main benefit of converting (quantizing) weights from FP32 to INT8?

  1. APrecision always becomes higher than FP32
  2. BData shrinks to a quarter and computation gets faster and leaner
  3. CModel accuracy always improves, even without any retraining at all
Show answer and explanation

Answer: B. Data shrinks to a quarter and computation gets faster and leaner

Going from 32-bit to 8-bit weights cuts memory usage and data read to a quarter, a big win for inference limited by memory bandwidth. In addition, 8-bit integer multipliers are far smaller and more power-efficient than floating-point ones, allowing more operations for the same area and power. In exchange, only 256 values are representable, so errors arise and accuracy may drop slightly. Precision does not increase, nor does accuracy always improve.

Which dedicated circuit is built into smartphone SoCs and similar chips to perform AI inference quickly and with low power?

  1. APLL (phase-locked loop)
  2. BADC
  3. CNPU (neural processing unit)
Show answer and explanation

Answer: C. NPU (neural processing unit)

An NPU is a dedicated circuit that executes, in massive parallel, the multiply-accumulate operations dominating neural networks, often at low precision such as 8-bit integers or less. Its performance per watt is far higher than a general-purpose CPU's, letting phones handle photo enhancement, speech recognition and translation on-device. Performance is quoted in TOPS (trillions of operations per second), and some PC SoCs include an NPU as well.

FAQ

What is the difference between AI training and inference?

Training adjusts a model's weights using forward and backward passes over a dataset, which is very compute- and memory-intensive. Inference uses the trained, fixed weights to compute outputs for new inputs with forward passes only.

Why is AI inference often limited by memory bandwidth?

With small batches, each weight read from memory is used for only a few calculations, so the arithmetic units wait on data. Large models with batch size one, such as text generation, are the most memory-bound case.

Why do phones use an NPU for inference instead of the CPU?

An NPU packs many low-precision multiply-accumulate units and avoids general-purpose control overhead, so it spends far less energy per operation. That makes on-device features practical within battery and heat limits.

Questions that mention AI inference (3)

AI inference appears in 5 practice questions across 4 topics, including AI Hardware & Software Stack, Computer Arithmetic, CPUs and architecture.

  1. Which is NOT an advantage of running AI inference on the device itself (at the edge), such as a smartphone, rather than on cloud servers?
  2. Why are the NPUs in smartphone SoCs more power-efficient than CPUs for AI inference?
  3. Why is double-precision (FP64) performance on many consumer gaming GPUs much lower than single-precision (FP32), for example a few tens of times lower?

Books on AI Hardware & Software Stack Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary