Towards Accurate Network Quantization with Equivalent Smooth Regularizer

Kirill Solodskikh, Vladimir Chikin, Ruslan Aydarkhanov, Dehua Song, Irina Zhelavskaya, Jiansheng WeiECCV 2022

Authors: Researchers from Huawei’s Noah’s Ark Lab and Skoltech

Introduction

Quantization is a critical technique for deploying deep learning models on resource-constrained mobile and edge devices. By converting 32-bit floating-point weights and activations into low-bit integers (e.g., INT4 or INT8), developers can significantly reduce memory footprints and accelerate inference. However, this process often results in a non-trivial loss of accuracy. This paper introduces a novel approach to mitigate this degradation by replacing traditional, non-smooth quantization error functions with a family of Equivalent Smooth Regularizers (SQR).

The Optimization Challenge

The primary hurdle in quantization-aware training (QAT) is the non-differentiable nature of the rounding function. The standard "rounding" operation is a step function with a gradient that is zero almost everywhere and undefined at transition points. While the Straight-Through Estimator (STE) is a common workaround, it introduces a gradient mismatch that can hinder convergence.

Alternative methods, such as Mean Squared Quantization Error (MSQE), attempt to regularize weights toward integer values. However, MSQE is non-smooth at rounding boundaries (e.g., at 0.5). These "sharp" boundaries create steep gradients that aggressively force weights toward the nearest integer grid point, often overrunning the actual task loss (such as classification accuracy) and trapping the model in sub-optimal local minima.

Figure 1: Comparison of MSQE and QSin. Unlike MSQE, QSin (an SQR) is smooth at transition points, preventing aggressive 'snapping' and allowing the task loss to effectively guide weight updates.

Proposed Method: SQR and QSin

The authors propose a new class of regularizers, SQR, designed to be twice differentiable ($C^2$ smooth) everywhere, including transition points. An SQR must satisfy three criteria:

  1. Order Preserving: It mimics the trend of actual quantization error.
  2. Equivalence: It is bounded by and scale-equivalent to the actual quantization error.
  3. Smoothness: It eliminates the gradient jumps found in MSQE.

The QSin Regularizer

The paper introduces QSin as a specific instance of SQR. Inside the quantization range, it utilizes a $\sin^2(\pi x)$ function, which is smooth, periodic, and reaches zero at integer points. Outside the range, it transitions to a quadratic function to penalize values exceeding the clipping threshold (clamping error).

Round Free (RF) Training

Instead of rounding values in the forward pass (as in standard QAT), the authors propose Round Free (RF) Training. This involves training full-precision weights directly using the QSin regularizer. The quantization scale factors ($s$) are treated as learnable parameters, and the weight regularizer coefficient ($\lambda_w$) is increased progressively during training. This strategy gradually "pushes" weights toward integer values without the optimization shocks associated with discrete rounding.

Experimental Results

Image Classification

The researchers evaluated QSin on ImageNet (ILSVRC12) using popular architectures:

  • ResNet-18 (4-bit): Achieved 69.7% top-1 accuracy, outperforming PACT (69.2%) and nearly matching the full-precision baseline of 69.8%.
  • MobileNet-V2 (4-bit): Achieved 68.7%, significantly surpassing LSQ (68.1%) and DSQ (64.8%).

Image Super-Resolution (SR)

In SR tasks, quantized models often suffer from "plaid artifacts"—checkerboard patterns in smooth areas caused by sub-optimal weight clusters. QSin effectively eliminates these artifacts by providing a smoother optimization landscape. On the Urban100 dataset (4x EDSR), QSin achieved a PSNR of 26.0 dB, matching specialized state-of-the-art methods and preserving intricate textures that other quantization methods distorted.

Conclusion

By addressing the fundamental smoothness issues in quantization optimization, the SQR framework provides a robust path toward high-accuracy low-bit models. The proposed QSin regularizer allows the task loss to maintain influence during training, leading to weight distributions that are better suited for final discrete inference. Future work may extend this approach to other sensitive low-level vision tasks like denoising and deblurring.

Summary updated

BibTeX
@inproceedings{solodskikh2022towards,
  author = {Kirill Solodskikh and Vladimir Chikin and Ruslan Aydarkhanov and Dehua Song and Irina Zhelavskaya and Jiansheng Wei},
  title = {{Towards Accurate Network Quantization with Equivalent Smooth Regularizer}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20083-0\_43},
}
Figure