What is AI Inference?
Inference is when a trained AI model takes a new input (an image, sensor data, text) and produces a prediction or decision. It is the "run-time" phase of AI: the model no longer learns, it only uses what it has learned.
Training vs inference
| Feature | Training | Inference |
|---|---|---|
| What it does | Updates the weights | Runs a forward pass with fixed weights |
| Compute load | Very high (forward + backward pass, many iterations) | One forward pass per input |
| Duration | Hours – weeks | Milliseconds – seconds |
| Hardware | Powerful GPUs | GPU, CPU, NPU or microcontroller |
| Frequency | Occasionally | Continuously, on every new input |
How is inference made faster?
Two measures matter in the field: latency (how long one input takes to produce a result) and throughput (how many inputs are processed per second). Common ways to improve them:
- Quantization: converting 32-bit floating-point (FP32) weights to 8-bit integers (INT8). Model size drops to about a quarter and speed improves on compatible hardware; the small loss in accuracy must always be measured.
- Pruning and smaller architectures: removing unnecessary connections, or choosing a smaller model from the start.
- Optimised runtimes: tools such as ONNX Runtime, TensorRT, OpenVINO and TensorFlow Lite compile the model for the target hardware.
- Batching: raises throughput but can lengthen the latency of a single input.
Example: memory and latency budget
Take an image model with 25 million parameters:
- FP32: 25,000,000 × 4 bytes = 100 MB
- INT8: 25,000,000 × 1 byte = 25 MB
If the line passes 2 products per second, there are 500 ms per product. Image capture, pre-processing, inference, post-processing and writing the result to the PLC must all fit in that time. If inference alone takes 300 ms, 200 ms is left for everything else; a round trip to the cloud can easily break this budget.
Edge or cloud?
| Edge inference | Cloud inference | |
|---|---|---|
| Latency | Low, independent of the network | Depends on network latency |
| Connection loss | Keeps working | Stops |
| Data privacy | Data stays on site | Data leaves the site |
| Model size | Limited by the hardware | Large models possible |
Common mistakes
- Pre-processing differently from training: a different colour order (RGB/BGR), normalisation or image size silently lowers accuracy.
- Timing only the model: end-to-end latency must be measured including pre- and post-processing.
- Skipping validation after quantization.
- Not monitoring field performance: accuracy can drop as the data changes.
Where is it used in industry?
Visual quality control on the line, fault detection from vibration and anomaly detection in sensor data are typical inference applications. We aim to explore edge inference capabilities in future versions of our data acquisition products. For inference on microcontrollers see our TinyML and predictive maintenance with NPU MCUs posts, and for preparing the model see model training and optimization.
Related Terms
- What is Industrial AI?How Industrial AI differs from general-purpose AI: field measurement data, validation on unseen sites and an application that runs every day.
- Model Training and Optimization: Pre-training, Fine-tuning, LoRA, QuantizationWhat are pre-training, fine-tuning, LoRA and quantization? Core concepts for running models on edge devices, with parameter and memory examples.
- What are Embedded Systems?What is an embedded system? MCU vs MPU, bare-metal vs RTOS vs embedded Linux, a real-time timing budget example and the role in industrial devices.
- What is Deep Learning?What deep learning is and how it works: multi-layer neural networks, with predictive maintenance and visual inspection examples from vibration and images.
- What is Computer Vision?What computer vision is: classification, detection, segmentation, a camera resolution calculation, IoU and mAP, industrial uses and common mistakes.