AIPC: Evidence-Guided Agent Workflows for PyTorch Project Deployment
Organizations: Qualcomm Technologies, Inc · Qualcomm Technologies, Inc. · Independent Researcher
Abstract
Deploying and optimizing a PyTorch inference project on a dedicated accelerator, especially an on-device NPU, requires more than using a framework device API as with CUDA. The project must be converted into hardware-runtime artifacts and adapted to the target toolchain and application interface. Differences in model formats, quantization flows, operator support, and toolchain interfaces create cross-layer problems spanning PyTorch/ONNX models, toolchains, runtimes, and device execution. LLM Agents can invoke tools to address such problems, but may drift because of insufficient domain knowledge, large configuration and repair spaces, or poor path selection. We propose AIPC (AI Porting & Conversion), an Agent method for deploying PyTorch inference projects. AIPC combines structured Skills with toolchain, runtime, and profiling evidence to drive cross-layer diagnosis and repair, organizing model adaptation, artifact building, on-target execution, accuracy repair, and performance optimization into one deployment flow. We evaluate AIPC on the on-device NPU path of Qualcomm QAIRT across vision, speech, LLM, and diffusion models. In two optimization cases, 6/7 Skill-arm Whisper-Small runs meet predefined accuracy and latency criteria versus 0/6 control runs, while YOLO-Worldv2 achieves a 2.791x end-to-end speedup versus 1.599x for the control. Under a pre-fixed deployment contract, Skill, tool permissions, and check conditions, some runs achieve zero in-run human intervention (0-HITL). We also examine Qwen3.8-27B as a locally deployable model for driving an Agent workflow.
Figures & tables
| Case | Skill | Result | LLM | Time (min) | Cost (USD) | Observation |
|---|---|---|---|---|---|---|
| Real-ESRGAN | Y | O3/?0/X0 / 3; H0 | LUNA-X | 19.8/18.4/17.7 | 1.9/1.9/1.7 | |
| Real-ESRGAN | N | O2/?0/X1 / 3; H0 | LUNA-X | 18.7/7.7/8.1 | 1.3/0.5/0.5 | Unexpected output |
| YOLO-Worldv2 | Y | O3/?0/X0 / 3; H0 | LUNA-X | 18.0/19.0/22.6 | 1.9/2.2/2.3 | |
| YOLO-Worldv2 | N | O1/?2/X0 / 3; H0 | LUNA-X | 14.0/7.0/10.2 | 1.0/0.5/0.7 | Unexpected output: 2; ambiguous configuration: 1 |
| MeloTTS | Y | O0/?1/X0 / 1; H0 | TERRA-M | 128.0 | 13.5 | Waveform gate not met |
| MeloTTS | Y | O0/?1/X0 / 1; H1 | LUNA-X | 261.0 | 5.858 | HITL: relaxed gate to stop retries |
| Case | Symptom | Diagnosis | Repair |
|---|---|---|---|
| YOLO-Worldv2 | Unsupported Einsum | ONNX rewrite | Einsum reshape / transpose / matmul |
| MeloTTS ( Skill=Y ) | VTCM capacity exceeded ( 11.16 MiB > 8 MiB ) | HTP VTCM capacity limit | Convolution time tiling |
| Qwen3-0.6B | Single-graph mapping ~1.50 GiB | Single-graph size limit | Graph split |
| SD1.5 | U-Net weight mapping fails | HTP/FastRPC weight-mapping limit | Graph split |
| Model | Skill | Result | Time (min) | Observation |
|---|---|---|---|---|
| Real-ESRGAN | Y | O3/?0/X0 / 3; H0 | 39.0/23.1/29.0 | |
| Real-ESRGAN | N | O2/?0/X1 / 3; H0 | 25.5/16.2/X69.5 | Python inference code missing |
| YOLO-Worldv2 | Y | O3/?0/X0 / 3; H0 | 40.0/38.7/68.2 | False incompatibility. |
| YOLO-Worldv2 | N | O0/?1/X2 / 3; H1 | 52.3/X28.7/X14.6 | Postprocessing ROI error; drifted to DLC/GPU |
| Whisper-tiny | Y | O2/?0/X1 / 3; H0 | 47.8/20.0/X10.0 | Decoder on CPU. |
| Whisper-tiny | N | O0/?1/X0 / 1; H4 | 110.5 | DLC path; encoder-only stop |
| Item | YOLO-Worldv2 | Whisper-Small |
|---|---|---|
| Precision / SDK | W8A8 / QAIRT 2.48.40.260702 | W8A16 / QAIRT 2.51.40.260930 (aligned with AI Hub) |
| Agent model (thinking level) | gpt-5.6-luna (xhigh) | glm-5.3 [ 61 ] (no thinking), deepseek-v4.1-flash [ 62 ] (high), claude-5-5-sonnet [ 63 ] (medium) |
| Runs | 14: 4 per arm in the accuracy series; 3 per arm in the performance series, starting from the deliverable of each arm’s first accuracy run (fixed before the performance runs began; 96.3% of FP32 for the Skill arm, 85.8% for the Agent-only arm), with accuracy criteria judged against this baseline | 13: Skill 7, No-Skill 6 |
| Data | COCO val2017 [ 64 ] : calibration 400 / development 1,000 / final 3,600 images; FP32 [email protected]:0.95 = 0.3702 | LibriSpeech [ 65 ] : final 300 utterances (test-clean); FP32 WER 2.784% |
| Pre-set criteria | [email protected]:0.95 and [email protected] 95% of FP32, plus per-class recall, whole-class disappearance, and empty-detection-rate criteria; accuracy drop 1.0 percentage point in the performance series | Loadable; WER FP32 + 0.217 percentage points; decoder and encoder each 1.2 the same-session AI Hub precompiled package |
| Timing | batch 1, NPU backend only, HTP burst, 3 warm-up runs; preprocessing / NPU / postprocessing timed separately | Native I/O; each binary in its own process, measured alternately with the AI Hub package in the same session |
| Skill | Agent-only | |
|---|---|---|
| (a) Accuracy series (4 runs per arm) | ||
| Per-run [email protected]:0.95 (relative to FP32) | 97.2%, 96.4%, 87.0%, 96.5% | 73.6%, 76.7%, 96.4%, 85.5% |
| Overall-accuracy criterion ( 95% of FP32) | 3/4 | 1/4 |
| All criteria | 1/4 | 1/4 |
| (b) Performance series (3 runs per arm) | ||
| End-to-end latency (ms, start end) | 18.16 6.48 | 13.85 8.57 |
| Change | Adoption (Skill vs. control) | Measured effect |
|---|---|---|
| Boxes and scores sharing one output separate outputs † | 4/4 vs. 4/4 | The naive reference detects no boxes; 74.6% after splitting |
| Activation calibration min-max entropy | 4/4 vs. 2/4 | +8.4 percentage points |
| Scores output before Sigmoid (logit domain) † | 3/4 vs. 1/4 | Delivered artifacts 96.4%–97.2% vs. 73.6%–87.0% |
| 2 fused outputs 6 multi-scale head outputs † | 3/4 vs. 1/4 | +6.55 percentage points alone in ablation |
| Per-channel weight quantization with CLE † | both arms | +5.95 percentage points with 6 outputs (96.2%) |
| NCHW NHWC input/output | 3/3 vs. 0/3 | Critical-path cycles 7.4% |
| Arm | Loadable | WER met | Decoder met | Encoder met | All criteria | Encoder ms | Decoder ms |
|---|---|---|---|---|---|---|---|
| Skill | 7/7 | 7/7 | 7/7 | 6/7 | 6/7 | 29.68–36.69 | 2.92–3.63 |
| No-Skill | 4/6 | 3/6 | 1/6 | 0/6 | 0/6 | 38.63–378.87 | 3.91–42.93 |
| Naive reference | Yes | Yes | Yes | No | No | 63.54 | 3.35 |
AI Accelerator Inference
AI accelerator inference studies hardware and software for running neural networks faster and more efficiently across data-center, edge, and mobile devices.
See all 105 papers