A probabilistic framework for dynamic quantization

Gabriele Santini, Francesco Paissan, Elisabetta FarellaarXiv 2025 · DOI

Abstract

Deploying deep neural networks on resource-constrained microcontrollers requires aggressive quantization. While static quantization is memory-efficient, it lacks robustness to domain shifts. Conversely, dynamic quantization offers robustness but imposes high memory overheads. This paper presents a probabilistic framework for dynamic quantization that estimates activation ranges using a lightweight surrogate model. By predicting quantization parameters before full tensor computation, the method achieves the robustness of dynamic quantization with the low memory footprint of static approaches, making it ideal for edge AI applications.

Introduction

Quantization is a cornerstone of efficient deep learning deployment, reducing model precision (e.g., from 32-bit float to 8-bit integer) to fit within the limited memory and compute budgets of microcontrollers. Currently, practitioners must choose between two suboptimal paradigms: Static Quantization, which uses pre-calculated clipping ranges and fails under data distribution shifts, and Dynamic Quantization, which calculates ranges on-the-fly but requires buffering large intermediate tensors in high precision.

This paper addresses this "memory vs. robustness" trade-off by introducing a predictive approach. Instead of measuring the range of a computed tensor, the proposed framework estimates it using the statistical properties of the inputs and weights.

The Probabilistic Framework

The core innovation is a probabilistic surrogate model that treats network weights as independent and identically distributed (i.i.d.) normal variables. By leveraging this assumption, the authors derive mathematical formulas to estimate the mean and variance of an output tensor based solely on the statistics of the input and the known distribution of the weights.

Comparison of quantization schemes: (a) Static, (b) Dynamic, and (c) the proposed Probabilistic approach.

As shown in the figure above, the proposed method (c) introduces an "Estimation" block. This block predicts the optimal clipping interval ($s_{\text{out}}, z_{\text{out}}$) using hyperparameters ($\alpha, \beta$) calibrated on a small dataset. This allows the system to set up an integer pipeline and quantize output values one by one as they are generated, eliminating the need for massive intermediate buffers.

To further optimize performance, the authors introduce a sampling stride ($\gamma$). By sampling only a fraction of input patches to estimate the output range, the computational overhead is reduced quadratically with negligible impact on accuracy.

Experimental Evaluation

The framework was validated across diverse computer vision tasks, including object detection (YOLO11n), pose estimation, and image classification (ResNet50, MobileNetv2). A critical component of the evaluation was testing under domain shift. The authors created corrupted versions of standard datasets using white noise, motion blur, and color shifts to simulate real-world environmental changes.

Example of a 'Color Shift' corruption used to evaluate model robustness under domain shift.

Key Results and Insights

  • Robustness to Domain Shift: In "Out-of-Domain" scenarios involving noisy or corrupted data, static quantization suffered a significant performance drop of 12.6%. In contrast, the probabilistic method limited this drop to just 0.99%, performing nearly as well as full dynamic quantization.
  • In-Domain Accuracy: On standard benchmarks, the method showed only a 0.88% mAP drop compared to full-precision models when using per-channel quantization.
  • Hardware Feasibility: The system was implemented using the CMSIS-NN library on an ARM Cortex-M4 (STM32L476RG). The results confirmed that the predictive estimation fits within strict RAM constraints (often <1MB) and that the sampling stride can reduce estimation latency by over 10x.
  • Per-Channel Advantage: The study highlighted that per-channel quantization is significantly more effective than per-tensor quantization for maintaining robustness against spatial shifts and noise.

Conclusion

By shifting from a reactive to a predictive quantization paradigm, this framework enables robust, input-adaptive inference on the smallest of edge devices. While currently optimized for linear and convolutional layers, future work may extend these probabilistic surrogates to more complex architectures like Transformers, further bridging the gap between high-performance AI and embedded hardware.

Summary updated

BibTeX
@misc{santini2025probabilistic,
  author = {Gabriele Santini and Francesco Paissan and Elisabetta Farella},
  title = {{A probabilistic framework for dynamic quantization}},
  year = {2025},
  eprint = {2505.10689},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.10689},
}
Figure