NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Optimal Quantization for Batch Normalization in Neural Network Deployments and Beyond

Dachao Lin, Peiqin Sun, Guangzeng Xie, Shuchang Zhou, Zhihua ZhangarXiv 2020

Abstract

This paper presents a mathematically rigorous framework for converting Batch Normalization (BN) layers into pure fixed-point operations, facilitating the deployment of deep neural networks on hardware without floating-point units. By establishing that the required precision scale grows quadratically with activation bit-width, the authors provide an optimal recipe for high-performance inference on low-power embedded devices.

Introduction

Quantized Neural Networks (QNNs) are essential for deploying AI on edge devices like smartphones and IoT sensors. By utilizing low bit-width integers (e.g., 4-bit or 8-bit) instead of 32-bit floating points, significant memory and power savings are achieved. However, Batch Normalization (BN) remains a bottleneck. BN's standard form—$\gamma \frac{x-\mu}{\sigma} + \beta$—involves reciprocals and square roots, typically requiring floating-point arithmetic. Existing solutions often keep BN in high precision or use heuristics that compromise accuracy. This work introduces a method to perform BN using only integer arithmetic while maintaining the exact output of the original floating-point model.

Methodology

The proposed approach "absorbs" BN parameters into the quantization process of subsequent layers through several steps:

  1. Affine Fusion: The combination of quantized convolutional output, BN, and the next layer's quantization is simplified into a single operation: $\text{clip}(\lfloor \frac{N+b}{t} \rfloor, 0, A)$, where $N$ is the integer output and $b, t$ are floating-point constants.
  2. Integer Conversion: Floating-point division by $t$ is replaced with a fixed-point operation using a shared quantized scale $K$: $\lfloor \frac{N \times K + B}{T} \rfloor$, where $K, B,$ and $T$ are integers.
  3. Theoretical Bounds: The authors prove the existence of a minimal integer $K_n$ that ensures error-free conversion for $n$ quantization levels.
  4. Optimal Search: A numerical algorithm identifies the smallest $K$ for specific hardware constraints, optimizing efficiency.

Analysis of Precision Scaling

A key theoretical contribution is the "Quadratic Rule," which states that the required precision scale $K_n$ grows quadratically—$\Theta(n^2)$—relative to the number of quantization levels $n$. For 8-bit activations ($n=255$), a scale $K$ of approximately 15-16 bits is necessary to maintain precision.

The growth of the precision scale $K_n$ as a function of quantization levels $n$, demonstrating quadratic scaling in both linear and log-log plots.

Choosing $K$ as a power of 2 allows the division to be implemented as a simple bit-shift, making it highly efficient for Digital Signal Processors (DSPs) and FPGAs.

Experimental Results

The method was validated on ImageNet (ILSVRC-2012) using VGG16 and ResNet18 architectures. The authors compared three modes: QT (standard quantized training), bt (BN absorbed into floating-point math), and BT (the proposed pure fixed-point method).

Accuracy comparison across different bit-widths and models, showing that the proposed fixed-point method (BT) matches floating-point performance.

As shown in the results, the BT mode achieves accuracy identical to the floating-point absorbed version (bt). For instance, on ImageNet with 4-bit ResNet18, the BT mode reached 68.15% Top-1 accuracy. For 8-bit configurations (8W8A), the method maintained a Top-1 accuracy of 70.81% for VGG16, demonstrating scalability to higher bit-widths without accuracy loss.

Conclusion and Future Work

This work successfully eliminates floating-point operations in the inference path, enabling "total fixed-number hardware" deployment. While the conversion is rigorous, the initial calculation of constants $b$ and $t$ still relies on floating-point precision, which could be a source of minor errors if the initial precision is extremely limited. Future research may extend this "affine-to-fixed-point" logic to other normalization techniques like Instance or Layer Normalization, which are prevalent in Transformer architectures.

Summary updated

BibTeX
@misc{lin2020optimal,
  author = {Dachao Lin and Peiqin Sun and Guangzeng Xie and Shuchang Zhou and Zhihua Zhang},
  title = {{Optimal Quantization for Batch Normalization in Neural Network Deployments and Beyond}},
  year = {2020},
  eprint = {2008.13128},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2008.13128},
}
Figure