Skip to main content

The fastest way to make a model run slowly on an edge AI accelerator is to treat quantization as an export checkbox. On Jetson, many teams reach for TensorRT FP16 first and add INT8 later when they need more throughput. On Qualcomm Dragonwing, the HTP/NPU path is much more often an integer path from the beginning. That changes the migration plan. The happy path still starts with the same model you already trained:
The risky shortcut is this:
That does not carry over. A TensorRT calibration cache is a TensorRT artifact. The safer path is to re-quantize from the source model or FP32 intermediate, using real calibration samples from your product domain. For the running YOLO smart-camera case study, this means using real frames from the target camera path, not a generic image folder. Before you start:

Why this matters more than the export

Exporting PyTorch to ONNX gets you most of the way to a portable graph. Quantization decides whether that graph is accurate and fast on the target accelerator. A migration can fail in three different ways that all look like “the model is bad”:
That is why our best practice is to validate at every boundary: For a classifier, that might be top-1/top-5 accuracy. For YOLO, it might be mAP, recall at a fixed confidence threshold, and a few hand-inspected edge cases. For speech, it might be WER. For embeddings, it might be cosine similarity and retrieval quality. The exact metric depends on the product. The important part is picking it before tuning. Use the failing boundary to avoid blaming the wrong stage:

PTQ first, QAT when needed

There are two practical quantization paths: PTQ is the simplest good path: no retraining loop, quick iteration, and often enough for vision models with clean operators and representative calibration data. QAT is the heavier path. AIMET can help train the model with quantization effects in the loop, but that adds training infrastructure, model-owner time, and a new validation cycle. We recommend saving QAT for cases where PTQ misses a real product gate. A good decision rule:

Start with real calibration data

Calibration data is not a formality. It teaches the quantizer the activation ranges the model will see on device. Use samples that match production:
For a camera detector, a better calibration set is usually 100-500 boring product frames than 5,000 generic internet images. Include dark frames, motion blur, glare, crowded scenes, background-only scenes, and the edge cases that normally trigger false positives. For LLM/VLM/audio models, calibration is more runtime- and model-specific, but the same principle applies: prompts, context lengths, images, or audio clips should resemble the product workload.

Pick a precision lane

The common Qualcomm migration precisions are: For a standard object detector, our best practice is to start with a8w8, validate, and only move up in precision if the product metric requires it. That keeps the search small:

A practical QAIRT quantization flow

Assume you already exported and validated a static ONNX model. This is a compact recap of the artifact flow so the quantization decisions have context. Public Dragonwing docs commonly show a local QNN model-library lane with qnn-onnx-converter and qnn-model-lib-generator; DLC-style QAIRT/AI Hub flows use DLC artifacts. Verify tool names against your installed SDK. Local QNN model-library flow:
Create a calibration input list with raw inputs that match the model input tensor:
Then quantize by passing the calibration list during conversion:
If AI Hub or your QAIRT SDK gives you a DLC instead, use the equivalent DLC quantization path from that SDK release and record the tool version in the artifact manifest. Build the target context binary only after quantization passes your functional checks:
For a DLC artifact, use the SDK’s DLC model loader path, commonly --model libQnnModelDlc.so --dlc_path out/model_a8w8.dlc. For IQ-9/QCS9075, plan around HTP v73. For IQ-8275/QCS8275, plan around HTP v75. Set that architecture through the tested SDK sample config for your board, not by guessing. Context binaries are target-sensitive, so rebuild when the target SoC, SDK, BSP, or runtime package changes.

The retry ladder

When quantization hurts accuracy, avoid random flag hunting. Use a small ladder and take the first option that passes the metric. AIMET becomes attractive when the model owner can retrain or fine-tune and the PTQ loss is real, not a preprocessing bug.

Validate the application, not just tensors

Tensor metrics are useful, but product metrics win. For a detector, compare:
For an LLM, compare:
For audio, compare:
A quantized tensor can look close while the application still fails because preprocessing, output decoding, thresholds, or temporal logic changed. For the running YOLO case study, keep the quantization report small and concrete: The key field is the final decision: which artifact passed, which metric failed, and which retry step changed the result.

The smallest useful acceptance gate

For a first migration, keep the gate simple:
Suggested tensor gates: These are starting points, not universal truth. A detector, segmenter, embedding model, or speech model can need different tolerances. The best gate is the smallest one that predicts field behavior.

Takeaway

The trained model is usually portable. The deployment artifact is not. Quantization is where the portable model becomes a Qualcomm-ready model. Start with PTQ, use real calibration data, compare against the FP32 ONNX baseline, and keep the retry ladder short. If the simple path passes, take it. If it does not, AIMET QAT is the next serious tool, not a bag of random export flags.