Skip to main content

Qualcomm Innovation Center, Inc.

AI Model Efficiency Toolkit (AIMET)

AIMET is a software toolkit for quantizing trained ML models.

AIMET improves the runtime performance of deep learning models by reducing compute load and memory footprint. Models quantized with AIMET facilitate its deployment on edge devices like mobile phones or laptops by reducing memory footprint.

AIMET employs post-training and fine-tuning techniques to minimize accuracy loss during quantization and compression. AIMET supports models from the ONNX and PyTorch frameworks.

How AIMET works

AIMET is designed to work with PyTorch and ONNX models.

You can find models quantized with AIMET on Qualcomm AI Hub Models - a collection of optimized and quantized models.

Why AIMET?

Benefits of AIMET

  • Advanced quantization techniques: Inference using integer runtimes is significantly faster than using floating-point runtimes. For example, models run 5x-15x faster on the Qualcomm Hexagon DSP than on the Qualcomm Kyro CPU. In addition, 8-bit precision models have a 4x smaller footprint than 32-bit precision models. However, maintaining model accuracy when quantizing ML models is often challenging. AIMET solves this using novel techniques like Data-Free Quantization that provide state-of-the-art INT8 results on several popular models.
  • Supports advanced model compression techniques that enable models to run faster at inference-time and require less memory
  • AIMET is designed to automate optimization of neural networks avoiding time-consuming and tedious manual tweaking. AIMET also provides user-friendly APIs that allow users to make calls directly from their PyTorch pipelines.

Please visit the AIMET on Github Pages for more details.

Quick Start

aimet-onnx and aimet-torch is available on PyPI.

Check our Quick Start to get started with latest AIMET package.

Build from source

To build the latest AIMET code from the source, see Build, install and run AIMET from source

Supported Features

Post-Training Quantization(PTQ)

Check out guide to get started on PTQ technique.

Following table summarizes basic technique such as Calibration to advanced techniques such as SeqMSE and Adaptive Rounding(AdaRound) that you can use with AIMET.

Technique ONNX PyTorch What does it do?
Calibration ✅ ✅ Computes Quantization parameters
AdaRound ✅ ✅ Rounds quantized weights
SeqMSE ✅ ✅ Optimizes encodings for each layer
BatchNorm Folding ✅ ✅ Folds batchnorm to bridge the gap between simulation and on-target
Cross Layer Equalization ✅ ✅ Rescales the weight to reduce range imbalance
BatchNorm re-estimation ✅ ✅ Re-estimates batchnorm statistics
AdaScale ✅ ✅ Learns per-weight scales via blockwise optimization to minimize quantization error
OmniQuant ❌ ✅ Optimizes quantized weights
SpinQuant ✅ ✅ Reduces activation outliers via Hadamard rotations

Quantization Aware Training(QAT)

AIMET supports Quantization Aware Training(QAT) via aimet-torch.

If you want to use both QAT and some of the advanced PTQ techniques from AIMET, we recommend the following workflow:

QAT workflow

Check detailed QAT guide here

Model Compression

  • Spatial SVD: Tensor decomposition technique to split a large layer into two smaller ones
  • Channel Pruning: Removes redundant input channels from a layer and reconstructs layer weights
  • Per-layer compression-ratio selection: Automatically selects how much to compress each layer in the model

Visualization

  • Weight ranges: Inspect visually if a model is a candidate for applying the Cross Layer Equalization technique. And the effect after applying the technique
  • Per-layer compression sensitivity: Visually get feedback about the sensitivity of any given layer in the model to compression

Results

AIMET can quantize an existing 32-bit floating-point model to an 8-bit fixed-point model without sacrificing much accuracy and without model fine-tuning.

DFQ

The DFQ method applied to several popular networks, such as MobileNet-v2 and ResNet-50, result in less than 0.9% loss in accuracy all the way down to 8-bit quantization, in an automated way without any training data.

Models FP32 INT8 Simulation
MobileNet v2 (top1) 71.72% 71.08%
ResNet 50 (top1) 76.05% 75.45%
DeepLab v3 (mIOU) 72.65% 71.91%

AdaRound (Adaptive Rounding)

ADAS Object Detect

For this example ADAS object detection model, which was challenging to quantize to 8-bit precision, AdaRound can recover the accuracy to within 1% of the FP32 accuracy.

Configuration mAP - Mean Average Precision
FP32 82.20%
Nearest Rounding (INT8 weights, INT8 acts) 49.85%
AdaRound (INT8 weights, INT8 acts) 81.21%
DeepLabv3 Semantic Segmentation

For some models like the DeepLabv3 semantic segmentation model, AdaRound can even quantize the model weights to 4-bit precision without a significant drop in accuracy.

Configuration mIOU - Mean intersection over union
FP32 72.94%
Nearest Rounding (INT4 weights, INT8 acts) 6.09%
AdaRound (INT4 weights, INT8 acts) 70.86%

Quantization for Recurrent Models

AIMET supports quantization simulation and quantization-aware training (QAT) for recurrent models (RNN, LSTM, GRU). Using QAT feature in AIMET, a DeepSpeech2 model with bi-directional LSTMs can be quantized to 8-bit precision with minimal drop in accuracy.

DeepSpeech2
(using bi-directional LSTMs)
Word Error Rate
FP32 9.92%
INT8 10.22%

Model Compression

AIMET can also significantly compress models. For popular models, such as Resnet-50 and Resnet-18, compression with spatial SVD plus channel pruning achieves 50% MAC (multiply-accumulate) reduction while retaining accuracy within approx. 1% of the original uncompressed model.

Models Uncompressed model 50% Compressed model
ResNet18 (top1) 69.76% 68.56%
ResNet 50 (top1) 76.05% 75.75%

Resources

Contributions

Thanks for your interest in contributing to AIMET! Please read our Contributions Page for more information on contributing features or bug fixes. We look forward to your participation!

Team

AIMET aims to be a community-driven project maintained by Qualcomm Innovation Center, Inc.

License

AIMET is licensed under the BSD 3-clause "New" or "Revised" License. Check out the LICENSE for more details.

Metadata

Release files for aimet-onnx 2.45.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for aimet-onnx 2.45.0
File Actions
aimet_onnx-2.45.0-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for aimet_onnx-2.45.0-cp310-abi3-win_arm64.whl
aimet_onnx-2.45.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for aimet_onnx-2.45.0-cp310-abi3-win_amd64.whl
aimet_onnx-2.45.0-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details for aimet_onnx-2.45.0-cp310-abi3-manylinux_2_34_x86_64.whl
aimet_onnx-2.45.0-cp310-abi3-macosx_15_0_arm64.whl CPython 3.10 abi3 macOS 15.0+ ARM64 Details for aimet_onnx-2.45.0-cp310-abi3-macosx_15_0_arm64.whl

Total release size: 87.5 MB

Release files / aimet_onnx-2.45.0-cp310-abi3-win_arm64.whl

Download URL aimet_onnx-2.45.0-cp310-abi3-win_arm64.whl
Size 784.0 kB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
148e850047b2d3ec01e8930fa8db4efbb63fb2b8ef6566a4d80ec26b1dd6bb2d
BLAKE2b-256 checksum
How to use checksums
bf97716626637c6ef025afe4c2707dcf0d49656ec17ecd13fedd0abdd5905adf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / aimet_onnx-2.45.0-cp310-abi3-win_amd64.whl

Download URL aimet_onnx-2.45.0-cp310-abi3-win_amd64.whl
Size 818.3 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
27917ed38ca3aeb7406caa5238132521c3a8da3082ddb14d20cdca6733d8a22d
BLAKE2b-256 checksum
How to use checksums
6c6c9b286af4e48ae8fa6b2a3c99faaf3438a81f3551b0ff1f50d437472c0528
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / aimet_onnx-2.45.0-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL aimet_onnx-2.45.0-cp310-abi3-manylinux_2_34_x86_64.whl
Size 85.1 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
ae723ff87b804d8644a95e34e6003acc981c1abbee39b09e5a4eee1155991b3c
BLAKE2b-256 checksum
How to use checksums
0e7cd16557d067abc96cb562e4e0493862a49c6034e62e146a34eabbc1144a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / aimet_onnx-2.45.0-cp310-abi3-macosx_15_0_arm64.whl

Download URL aimet_onnx-2.45.0-cp310-abi3-macosx_15_0_arm64.whl
Size 868.4 kB
Tags CPython 3.10 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
b0aca23d9e1a25a749eb57c9c9d8472ac1b333ecbf2a863d6ad8d3345fa0a98d
BLAKE2b-256 checksum
How to use checksums
44e65dec7c1f874c5c23575008ab83ac86f6aaee21a08fde4cd55ef991f01bf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for aimet-onnx 2.45.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.45.0 This release

4 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page