# Low-Level Details of Post-Training INT8 Quantization and Calibration

**URL:** <https://community.ultralytics.com/t/low-level-details-of-post-training-int8-quantization-and-calibration/1506>\
**Category:** Discussion\
**Tags:** curious\
**Created:** [September 26, 2025, 12:45pm UTC](https://community.ultralytics.com/t/low-level-details-of-post-training-int8-quantization-and-calibration/1506 "2025-09-26T12:45:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kallinteris-Andreas](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/kallinteris-andreas/32/838_2.png) [@Kallinteris-Andreas](https://community.ultralytics.com/u/Kallinteris-Andreas)\
**Post date:** [September 26, 2025, 12:45pm UTC](https://community.ultralytics.com/t/low-level-details-of-post-training-int8-quantization-and-calibration/1506/1 "2025-09-26T12:45:00Z")

</div>

I’m looking for a low-level explanation of how post-training quantization (PTQ) and, specifically, the INT8 calibration process works. My goal is to understand the underlying mechanics and best practices.

Here are my specific questions:

1. How do INT8 calibration algorithms work?
2. What are the best practices for the calibration dataset?
  - Should it be the same as the training dataset?
  - What are the consequences of using a different dataset?

3. How does Post-Training Quantization compare to Quantization-Aware Training (QAT)?

## sources:

- [https://huggingface.co/docs/optimum/concept\_guides/quantization](https://huggingface.co/docs/optimum/concept_guides/quantization)
- [Model Export with Ultralytics YOLO - Ultralytics YOLO Docs](https://docs.ultralytics.com/modes/export/)

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [September 26, 2025, 1:58pm UTC](https://community.ultralytics.com/t/low-level-details-of-post-training-int8-quantization-and-calibration/1506/2 "2025-09-26T13:58:59Z")

</div>

1. I honestly don’t know very well, but this is a great article.

> **[Achieving FP32 Accuracy for INT8 Inference Using Quantization Aware Training...](https://developer.nvidia.com/blog/achieving-fp32-accuracy-for-int8-inference-using-quantization-aware-training-with-tensorrt/)**
>
> ○ TensorRT is an SDK for high-performance deep learning inference and with TensorRT 8.0, you can import models trained using Quantization Aware Training (QAT) to run inference in INT8 precision…

A quick overview is that the process is calibrating the model weights to ensure that it ‘responds’ the same when converting to INT8 precision. That’s why you need the calibration data, which gives the calibration process a ‘test’ measurement to find the best conversion.

1. Calibrate with as much data as you can. Provide samples that are diverse and representative of your use case, definitely want to include a few examples of every class (at least). You can use your training, validation, and/or test set images, but you can probably also use it on new data, although it might not calibrate well. The article linked above might help with additional understanding.
2. PTQ is quick and easy compared to QAT, but generally you’ll lose some performance with PTQ. QAT will help the model stay as accurate as possible, but using PTQ from FP32 → INT8 will have some accuracy loss (generally FP32 → FP16 there is no accuracy loss).
