🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Edge ML Deployment

AI System DesignEdge ComputingđŸŸĸ Free Lesson

Edge ML Deployment

What You'll Learn

  • 1Compute on-device model size and memory from parameter count and bit width
  • 2Predict inference latency from FLOPs, accelerator peak and a realistic efficiency factor
  • 3Budget fleet-wide OTA bandwidth for full and delta updates
  • 4Choose between post-training quantization and quantization-aware training

Why This Matters

Edge ML enables inference on devices - phones, IoT sensors, autonomous vehicles - where latency, privacy, and connectivity constraints make cloud inference impractical. Deploying ML to edge requires aggressive model optimization, hardware-aware design, and efficient update mechanisms.


Architecture Overview

Edge ML Deployment ArchitectureCloud / Training SideLarge Model TrainingModel ValidationCompression Pipeline1. Quantization (INT8/INT4)2. Pruning (Structured)3. Knowledge Distillation4. Architecture SearchHardware OptimizationTensorRT CompilationONNX RuntimeCoreML / TFLiteOpenVINOModel Registry & OTA Update ServerEdge / Device SideModel Update ManagerOTA | Delta UpdatesRuntime EngineTFLite | CoreML | ONNXOn-Device Inference PipelineInput Preprocessing -> Model Execution -> PostprocessingHardware Acceleration: GPU | NPU | DSP | CPULocal Cache & StorageTelemetry & LoggingModel Compression TechniquesQuantizationFP32 -> INT8/INT42-4x size reduction<1% accuracy lossPruningRemove redundant weights50-90% sparsityStructured preferredDistillationTeacher -> Student5-10x smaller modelRetains 95%+ accuracyNAS for EdgeHardware-aware searchLatency constraintsPlatform-specificLow-RankMatrix FactorizationEmbedding CompressionTensor DecompositionEdge Hardware TargetsMobile (ARM)NVIDIA JetsonGoogle Coral/TPUIntel MovidiusFPGA / ASICMCUOTA Updates | Delta Patches | A/B Testing | Rollback | Version ManagementModel Push / OTATelemetry / Feedback

Core Components

1. Model Quantization

Quantization reduces model weight precision from FP32 to lower bit-widths (INT8, INT4, INT2):

  • Scale & zero-point computation: Maps the floating-point range to integer range using scale = (rmax - rmin) / (qmax - qmin) and zero_point = qmin - rmin/scale.
  • Tensor quantization: Rounds and clips each weight to the target integer range.
  • Per-channel quantization: Computes separate scale/zero-point per output channel for better accuracy.
  • Calibration: Uses a small calibration dataset to determine optimal quantization ranges (static quantization) or computes them dynamically at inference time (dynamic quantization).

2. Pruning

Pruning removes redundant weights to create sparse models:

  • Unstructured pruning: Removes individual weights below a magnitude threshold, creating sparse matrices that require specialized hardware for speedup.
  • Structured pruning: Removes entire channels, filters, or attention heads based on norm-based importance, providing guaranteed speedup on standard hardware.
  • Iterative pruning: Gradually increases sparsity over multiple rounds, fine-tuning between each round to recover accuracy.
  • Lottery ticket hypothesis: Identifies sparse subnetworks (winning tickets) that can match full model performance when trained from the same initialization.

3. Knowledge Distillation

Knowledge distillation trains a smaller student model to mimic a larger teacher model:

  • Soft targets: The teacher's softmax outputs at temperature T provide rich information about inter-class relationships (dark knowledge).
  • Distillation loss: Combines KL divergence between teacher and student soft targets with cross-entropy on hard labels, weighted by alpha.
  • Student architecture: Typically half the layers and hidden dimensions of the teacher, achieving 5-10x compression while retaining 95%+ accuracy.

4. Edge Model Update Manager

Manages model lifecycle on edge devices:

  • Version tracking: Maintains current model versions per model name.
  • Update checking: Compares server versions against local versions to identify needed updates.
  • Rollback support: Stores previous versions for instant rollback if an update fails.
  • Update history: Tracks all updates with timestamps for auditing.

Sizing for the Device

Three constraints decide whether a model ships: the bytes you can store, the milliseconds the accelerator gives you, and the bandwidth the fleet can absorb.

Storage is a direct function of parameter count and bit width:

A 25 million parameter model is 100 MB at FP32 (32 bits), 25 MB at INT8 and 12.5 MB at INT4. A phone with a 200 MB model budget therefore fits comfortably at INT8 but must drop quantization weights or prune before it fits at FP32, and a Cortex-M class microcontroller with 2 MB of flash forces INT4 with structured pruning on top.

Latency comes from work divided by effective throughput:

Take a 0.6 GFLOP model on a 1 TOPS NPU at an efficiency : the compute term is ms. Add 8 ms of pre and post-processing and 4 ms on the first frame for model load, and you get 12 ms cold and 10 ms warm. If the measured number is 80 ms, the gap is operator fallbacks running on CPU or thermal throttling, not the arithmetic, so profile per-operator before blaming the model.

Fleet rollout is a bandwidth problem:

One million devices pulling a 100 MB full model inside 24 hours is 100 TB, or about 1.16 GB per second sustained (9.3 Gbps). The same fleet taking a 2 MB delta over the same window needs only 23 MB per second (185 Mbps). Delta patches are not an optimization, they are the difference between a rollout that fits your CDN bill and one that does not.

Failure Modes

The classic edge failure is a quantized model that passes an offline accuracy check but breaks on the long tail of real inputs, so hold an accuracy gate per device class and fall back to the previous version automatically. The second is an interrupted update leaving a half-written artifact: write to a staging slot, verify a checksum, then atomically flip the active slot, keeping the previous version for one-tap rollback. The third is thermal throttling, where the first 100 inferences look fine and the next 900 slow down threefold, so benchmark sustained load rather than a single frame.

Common Mistakes

Shipping INT4 based on a single accuracy number

Fix: Gate per device class and per critical slice, and use quantization-aware training when post-training quantization loses more than a point.

Overwriting the active model file in place

Fix: Write to a staging slot, verify the checksum, then flip atomically so a failed download never bricks the device.

Benchmarking latency with one warm inference

Fix: Measure sustained throughput over hundreds of frames to catch thermal throttling and memory pressure.

Best Practices

  • Keep the previous model version on device for at least one release so rollback is instant
  • Ship delta patches and stagger the rollout across device cohorts over the update window
  • Profile operators on the target runtime, because CPU fallback silently dominates the budget

Key Takeaways

  • Size is S = P x b / 8: 25M parameters is 100 MB at FP32, 25 MB at INT8, 12.5 MB at INT4
  • Latency is FLOPs over efficiency times peak; 0.6 GFLOP at 30 percent of 1 TOPS is 2 ms of compute
  • A million devices pulling 100 MB in a day is 1.16 GB/s, while a 2 MB delta needs only 23 MB/s
  • Structured pruning and operator fusion buy real speed; unstructured sparsity does not on commodity runtimes

Frequently Asked Questions

How much accuracy does INT8 really cost?

Usually under one point when you use per-channel scaling and a representative calibration set, and often zero on CNNs. The risk is not the average case but the slices: a face detector can lose far more on low-light frames than the headline number suggests. Measure per-slice, keep a fallback to FP16 for the failing slice, and escalate to quantization-aware training only when post-training quantization misses the gate.

When should I use INT4 instead of INT8?

When memory, not compute, is the binding constraint: microcontrollers, on-device language models where the KV cache dominates, or devices where the FP32 copy cannot be resident at all. INT4 typically costs 1 to 3 accuracy points without quantization-aware training, so plan on QAT, and expect a runtime that supports weight-only INT4 with activation INT8 rather than full integer math.

How do I roll out an update to a million devices safely?

Use a staged rollout by cohort: 1 percent canary, then 10, 50, 100 percent over the update window, with automatic halt when crash rate or latency regresses. Send deltas rather than full images, verify checksums before flipping the active slot, and keep the previous version resident for rollback. Push telemetry back on update success rate so you learn about a bad build in minutes rather than from support tickets.

Interview Questions

Q1: What is the trade-off between INT8 and INT4 quantization?

INT8 gives a 4x size reduction over FP32 with typically under 1 point of accuracy loss and integer-only inference. INT4 gives 8x but usually loses 1 to 3 points unless you use quantization-aware training. Prefer INT8 for production and reserve INT4 for memory-bound targets such as microcontrollers or very large on-device models.

Q2: How do you handle model updates on devices with limited connectivity?

Send delta patches sized in megabytes instead of full images, cache downloads when the device is on unmetered links, and stage the artifact with a checksum before an atomic switch. Keep the previous version for rollback, fall back to the cached model if the update fails, and stagger fleet traffic so 1 million devices do not pull at once.

Q3: When should you choose structured over unstructured pruning?

Structured pruning removes whole channels or heads, so any standard runtime gets the speedup: 50 percent channel sparsity is roughly 2x fewer FLOPs. Unstructured pruning only helps on hardware with sparse tensor cores or a sparse-aware library. On edge targets with no sparse support, structured pruning is the only one that moves latency.

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-07

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert AI System Design Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement