需自备预训练浮点模型(PyTorch/Keras)作为输入,工具不提供模型;Python 需 >=3.10,PyTorch 需 2.3-2.6 或 TensorFlow 2.14/2.15;QAT 流程计算开销大,需预留数十 GPU 小时。
mct-model-optimization
SonySemiconductorSolutionsApache-2.0活跃维护面向边缘受限硬件的神经网络压缩工具包,提供量化感知训练和训练后量化等高级量化压缩能力,帮研究者把模型高效部署到资源紧张的设备上。
Model Compression Toolkit (MCT) is an open source project for neural network model optimization under efficient, constrained hardware. This project provides researchers, developers, and engineers advanced quantization and compression tools for deploying state-of-the-art neural networks.
pip install model-compression-toolkitREADME 未说明具体显存或 GPU 型号要求;仅给出各量化流程的计算开销参考:PTQ 约 1-10 CPU 分钟,GPTQ 约 1-3 GPU 小时,QAT 约 12-36 GPU 小时。
索尼开源的神经网络量化与压缩工具包,帮你在受限硬件上高效部署模型
面向边缘受限硬件的神经网络压缩工具包,提供量化感知训练和训练后量化等高级量化压缩能力,帮研究者把模型高效部署到资源紧张的设备上。
核心能力
- 支持 PTQ、GPTQ、QAT 三种量化流程
- 按层搜索最优权重量化位宽的混合精度搜索
- 用 TPC 描述目标硬件约束做硬件感知优化
- 无数据时用 BN 统计生成合成图做量化
- 结构化剪枝移除冗余输入通道并重建权重
容易踩的坑
- v2.6.1Release 2.6.1最新正式版2026-09-17 · 2026-09-17 07:19 UTC
What's Changed
Bug Fixes
-
Resolved Mixed Precision crash issue (Issue #1682)
- Mixed Precision: Filter non-finite candidates
Excludes candidates with non-finite (
NaN/Inf) sensitivity scores from the LP solver before optimization. - Mixed Precision: Handle non-finite sensitivity metrics in search manager
Hardens the mixed-precision search manager so
NaN/Infsensitivity metrics don't corrupt metric normalization, max-bit correction, or final distance-metric scaling.
- Mixed Precision: Filter non-finite candidates
Excludes candidates with non-finite (
-
Support scalar and 1D tensors in statistics collection in PyTorch (Issue #1451) Fixed an issue in PyTorch statistics collection for activation tensors with fewer than two dimensions.
Documentation and Others
- Clarify resource utilization data is an estimate (Issue #1293)
- Corrected quantization description in PTQ/GPTQ/QAT docstrings (Issue #1556)
- Updated IMX500 link in TPC README
-
- v2.6.0Release 2.6.02026-03-03 · 2026-03-03 08:06 UTC
查看更新说明
What's Changed
Breaking Change: TPC Settings (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1635)
- Changed the existing
get_target_platform_capabilitiesAPI (Breaking Change). Read more.
tpc = mct.get_target_platform_capabilities(tpc_version='1.0', device_type='imx500')- Added a new
get_target_platform_capabilities_sdspAPI to get TPC based on SDSP Converter version. Read more.
tpc = mct.get_target_platform_capabilities_sdsp(sdsp_version='3.14')- Migrated features from the EdgeMDT-TPC repository.
Added TPC v6.0
- Added new TPC version with support for torch.take and torch.index_select layers. (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1570, https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1591)
New API : MCTWrapper (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1578)
- Developed a new API that allows you to set parameters, perform quantization, and export model all at once. Read more.
wrapper = mct.MCTWrapper() _, quantized_model = wrapper.quantize_and_export(float_model=float_model, representative_dataset=representative_dataset, method='PTQ', framework='pytorch', use_mixed_precision=False)- Added tutorials of MCTWrapper. Try it!
Log Output Correction
- Modification of log output functionality using the logging module. (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1610)
Bug Fixes
- Modified weight quantization for Sin, Cos, and Exp layers in TPC v5.0 and v6.0. (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1647)
Tutorials
We've added new tutorials for various task. Try it!
-
PyTorch Tutorials
- YOLOX for Object Detection (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1558)
- DeepLabv3+ for Semantic Segmentation (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1563)
-
Keras Tutorials
- EfficientDet for Object Detection (https://github.com/SonySemiconductorSolutions/mct-model-optimization/pull/1596)
- Changed the existing
- v2.5.1Release 2.5.12026-01-05 · 2026-01-05 08:02 UTC
查看更新说明
What's Changed
Bug Fixes
- Support NumPy 2.4.0
- Fixed implementation due to the removal of "conversion of an array with ndim > 0 to a scalar" in NumPy 2.4.0
- Support NumPy 2.4.0
- v2.5.0Release 2.5.02025-12-01 · 2025-12-01 04:58 UTC
查看更新说明
What's Changed
XQuant Extension Tool (experimental) (#1502)
- Calculates the error for each layer by comparing the float model and quantized model, using both models along with the quantization log. The results are presented in reports. It identifies the causes of the detected errors and recommends appropriate improvement measures for each cause. Read more Troubleshoot Manual
New CustomLayer: MulticlassNMSOBB (for PyTorch) (#1508)
- Implemented a new CustomLayer: MulticlassNMSOBB, the Non-Maximum Suppression layer for the Object Detection (Oriented Bounding Box) task.
Bug Fixes
- Modify the Stack Layer settings in TPC (v1.0) (#1523)
Tutorials
- Add PyTorch Tutorial of PoseNet: We've added a new PyTorch tutorial of PoseNet model for the Human Pose Estimation task. Try it! (#1524)
Supported Python versions
- Python(>=3.10).(#1551 )
- v2.4.5Release 2.4.52025-12-01 · 2025-12-01 00:15 UTC
查看更新说明
What's Changed
Bug Fixes
- Limit networkx version(<3.6)
- Additional restrictions have been added to the MCT requirements due to the lack of support for certain functions in networkx 3.6 (Released in 2025/11/24).
- Limit networkx version(<3.6)
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Getting Started
Quick Installation
Pip install the model compression toolkit package in a Python>=3.10 environment with PyTorch>=2.3 or Tensorflow>=2.14.
pip install model-compression-toolkit
For installing from source, refer to the installation guide.
Important note: In order to use MCT, you’ll need to provide a pre-trained floating point model (PyTorch/Keras) as an input.
Tutorials and Examples
Our tutorials section will walk you through the basics of the MCT tool, covering various compression techniques for both Keras and PyTorch models. Access interactive notebooks for hands-on learning with popular models/tasks or move on to Resources section.
Supported Quantization Methods
MCT supports various quantization methods as appears below.
| Quantization Method | Complexity | Computational Cost | API | Tutorial |
|---|---|---|---|---|
| PTQ (Post Training Quantization) | Low | Low (~1-10 CPU minutes) | PyTorch API / Keras API | |
| GPTQ (parameters fine-tuning using gradients) | Moderate | Moderate (~1-3 GPU hours) | PyTorch API / Keras API | |
| QAT (Quantization Aware Training) | High | High (~12-36 GPU hours) | QAT API |
For each flow, Quantization core utilizes various algorithms and hyper-parameters for optimal hardware-aware quantization results. For further details, please see Supported features and algorithms.
Required input: Pre-trained floating point model (PyTorch/Keras)
Optional input: Representative dataset - can be either provided by the user, or generated utilizing the Data Generation capability
High level features and techniques
MCT offers a range of powerful features to optimize models for efficient edge deployment. These supported features include:
Quantization Core Features
🏆 Mixed-precision search . Assigning optimal quantization bit-width per layer (for weights/activations)
📈 Graph optimizations. Transforming the model to be best fitted for quantization process.
🔎 Quantization parameter search . Minimizing expected quantization-noise during thresholds search using methods such as MSE, No-Clipping and MAE.
🧮 Advanced quantization algorithms . Enhancing quantization performance for advanced cases is available with some algorithms that can be applied, such as Shift negative correction, Outliers filtering and clustering.
Hardware-aware optimization
🎯 TPC (Target Platform Capabilities). Describes the target hardware’s constrains, for which the model optimization is targeted. See TPC Readme for more information.
Data-free quantization (Data Generation) 
Generates synthetic images based on the statistics stored in the model's batch normalization layers, according to your specific needs, for when image data isn’t available. See Data Generation Library for more. The specifications of the method are detailed in the paper: "Data Generation for Hardware-Friendly Post-Training Quantization" [5].
Structured Pruning 
Reduces model size/complexity and ensures better channels utilization by removing redundant input channels from layers and reconstruction of layer weights. Read more (Pytorch API / Keras API).
Debugging and Visualization
🎛️ Network Editor (Modify Quantization Configurations) .
Modify your model's quantization configuration for specific layers or apply a custom edit rule (e.g adjust layer's bit-width) using MCT’s network editor.
🖥️ Visualization. Observe useful information for troubleshooting the quantized model's performance using TensorBoard. Read more.
🔑 XQuant (Explainable Quantization) . Get valuable insights regarding the quality and success of the quantization process of your model. The report includes histograms and similarity metrics between the original float model and the quantized model in key points of the model. The report can be visualized using TensorBoard.
🔑 XQuant Extension Tool. . Calculates the error for each layer by comparing the float model and quantized model, using both models along with the quantization log. The results are presented in reports. It identifies the causes of the detected errors and recommends appropriate improvement measures for each cause. Read more Troubleshoot Manual
Enhanced Post-Training Quantization (EPTQ)
As part of the GPTQ capability, we provide an advanced optimization algorithm called EPTQ. The specifications of the algorithm are detailed in the paper: "EPTQ: Enhanced Post-Training Quantization via Hessian-guided Network-wise Optimization" [4]. More details on how to use EPTQ via MCT can be found in the GPTQ guidelines.
Resources
-
User Guide contains detailed information about MCT and guides you from installation through optimizing models for your edge AI applications.
-
MCT's API Docs is separated per quantization methods:
- Post-training quantization | PTQ API docs
- Gradient-based post-training quantization | GPTQ API docs
- Quantization-aware training | QAT API docs
-
Debug – modify optimization process or generate an explainable report
Supported Versions
Currently, MCT is being tested on various Python, PyTorch and TensorFlow versions:
| PyTorch 2.3 | PyTorch 2.4 | PyTorch 2.5 | PyTorch 2.6 | |
|---|---|---|---|---|
| Python 3.10 | ||||
| Python 3.11 | ||||
| Python 3.12 |
| TensorFlow 2.14 | TensorFlow 2.15 | |
|---|---|---|
| Python 3.10 | ||
| Python 3.11 |
It is also being tested with IMX500 Converter and TPC versions:
PyTorch
TensorFlow
Results
MCT can quantize an existing 32-bit floating-point model to an 8-bit fixed-point (or less) model without compromising accuracy. Below is a graph of MobileNetV2 accuracy on ImageNet vs average bit-width of weights (X-axis), using single-precision quantization, mixed-precision quantization, and mixed-precision quantization with GPTQ.
For more results, please see [1]
Pruning Results
Results for applying pruning to reduce the parameters of the following models by 50%:
| Model | Dense Model Accuracy | Pruned Model Accuracy |
|---|---|---|
| ResNet50 [2] | 75.1 | 72.4 |
| DenseNet121 [3] | 74.44 | 71.71 |
Troubleshooting and Community
If you encountered a large accuracy degradation with MCT, check out the Quantization Troubleshooting for common pitfalls and some tools to improve the quantized model's accuracy.
Check out the FAQ for common issues.
You are welcome to ask questions and get support on our issues section and manage community discussions under the discussions section.
Contributions
We'd love your input! MCT would not be possible without help from our community, and welcomes contributions from anyone!
*Checkout our Contribution guide for more details.
Thank you 🙏 to all our contributors!
License
MCT is licensed under Apache License Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
References
[1] Habi, H.V., Peretz, R., Cohen, E., Dikstein, L., Dror, O., Diamant, I., Jennings, R.H. and Netzer, A., 2021. HPTQ: Hardware-Friendly Post Training Quantization. arXiv preprint.
[4] Gordon, O., Cohen, E., Habi, H.V., Netzer, A. (2025). EPTQ: Enhanced Post-Training Quantization via Hessian-guided Network-wise Optimization – ECCV 2024 Workshops
[5] Dikstein, L., Lapid, A., Netzer, A., & Habi, H. V., 2024. Data Generation for Hardware-Friendly Post-Training Quantization, Accepted to IEEE/CVF Winter Conference on Applications of Computer Vision (WACV) 2025