Sub topic 1
Why Edge Inference Is Different: Latency, Memory, Power, and Privacy
Prerequisites
This chapter assumes you understand tensors, image preprocessing, and the basic flow of a convolutional neural network. You should also know that inference is the process of using a trained model to produce a prediction. The examples use image classification, but the same constraints apply to detection and segmentation.
Edge Inference and Server Inference
In server inference, an application sends an image to a remote machine. That machine may have powerful CPUs, GPUs, large amounts of memory, and a stable power supply. The response then travels back to the application.
In edge inference, the model runs near the data source. A phone, camera, vehicle, or embedded computer performs the prediction locally. This removes the network round trip, but the device has fewer resources.
The total time for a server prediction includes several parts:
- Encoding and uploading the image.
- Waiting in a network queue.
- Running the model on the server.
- Downloading and decoding the result.
An edge prediction avoids most network delay. However, its processor may be much slower than a server GPU. The correct choice depends on the required response time, available hardware, and privacy rules.
The Main Device Constraints
| Constraint | What it limits | Typical design response |
|---|---|---|
| Latency | How quickly one prediction finishes | Use a smaller input or efficient model |
| Memory | Model weights, tensors, and application data | Reduce model size and peak tensor usage |
| Power | Energy used per prediction | Reduce computation and avoid unnecessary calls |
| Thermal limits | Sustained performance during long workloads | Measure after the device warms up |
| Privacy | Where sensitive images may be processed | Keep data on the device when possible |
Latency is often measured from the beginning of preprocessing to the end of postprocessing. Measuring only the model's internal execution can hide expensive image resizing, color conversion, or result filtering.
Memory has two important parts. Model memory stores the weights. Working memory stores intermediate tensors, input buffers, and output buffers. A model can have small weights but still require substantial working memory because of large intermediate feature maps.
Power matters when inference runs repeatedly. A camera application that predicts once per second has a different energy budget from an application that predicts on every video frame. Lowering the frame rate can save more energy than making a small model change.
A device may also reduce its processor speed when it becomes hot. This behavior is called thermal throttling. A model that runs quickly during a short test may become much slower after several minutes of continuous use.
Latency Is a System Property
A useful latency budget includes every stage:
For an interactive application, users experience the complete path, not just the model call. If the target is 100 milliseconds per frame, preprocessing, inference, and display updates must fit inside that budget together.
Batching several images can improve throughput on a server. It often increases delay and memory use on a phone, so it may be a poor choice for interactive vision.
Privacy and Reliability
Local inference can keep images, audio, or sensor data on the device. This reduces transmission risk and allows the application to work without a connection. It can also reduce cloud costs and make response time more predictable.
Privacy is not automatic. An application may still log images, upload diagnostic data, or store predictions. Review the complete data path, including crash reports and analytics.
A Practical Decision
Choose edge inference when low and predictable latency, offline behavior, or local data handling is important. Choose server inference when the model needs more memory or compute than the device provides, or when centralized updates are the main priority. A split design is also possible: run a small screening model locally and send only selected cases to a server.
Exercise
A camera app needs a prediction every 200 milliseconds, must work without a network, and runs continuously for ten minutes. Which constraints should you test first?
Show answer
Test end-to-end latency, sustained performance after the device heats up, memory use, and energy consumption. A short model benchmark alone is insufficient.