Gradient-Based Deep Quantization of Neural Networks through Sinusoidal Adaptive Regularization

Ahmed T. Elthakeb, Prannoy Pilligundla, Fatemehsadat Mireshghallah, Tarek Elgindi, Charles-Alban Deledalle, Hadi EsmaeilzadeharXiv 2020

Introduction

As deep learning models transition from high-performance data centers to resource-constrained edge devices, efficiency has become a primary design constraint. Quantization—the process of reducing the precision of weights and activations from 32-bit floating point to low-bit integers—is a critical technique for minimizing storage and energy consumption. However, deep quantization (typically below 8 bits) introduces significant challenges. First, the search space for optimal per-layer bitwidths is vast and combinatorial. Second, the non-differentiable nature of rounding operations creates an "optimization gap," making standard gradient-based training difficult.

To address these issues, we present WaveQ, a novel regularization technique that leverages the periodic properties of sinusoidal functions. By treating the period of a sine wave as a differentiable proxy for bitwidth, WaveQ enables standard gradient descent to automatically learn the optimal quantization strategy for each layer, significantly outperforming traditional methods.

Methodology: The WaveQ Framework

The core innovation of WaveQ is a joint optimization framework that incorporates a unique sinusoidal regularization term into the standard training loss.

The Sinusoidal Regularizer

Instead of applying "hard" quantization during training, WaveQ introduces a $\sin^2$ function as a regularizer. This function has inherent periodic minima. By aligning these minima with the desired quantization levels, the regularizer naturally "pushes" weights toward these discrete points during the optimization process.

WaveQ utilizes a sinusoidal penalty surface to guide weights toward quantization levels while allowing for differentiable bitwidth optimization.

As shown in Figure 3, the period of the sine wave is directly coupled with the bitwidth $\beta$. Because the period is a continuous variable, its gradient can be computed, allowing the network to learn the optimal bitwidth for each layer concurrently with the weights.

Three-Phase Training Strategy

WaveQ employs a structured three-phase training schedule (Figure 3e) to ensure stable convergence:

  1. Exploration: Initial training with low regularization allows the network to find a high-performing region in the continuous weight space.
  2. Engagement: Regularization strength is increased, forcing the network to learn optimal bitwidths and drive weights toward quantization-friendly values.
  3. Fine-tuning: Learned bitwidths are fixed, and the regularizer is decayed to recover any precision lost during the engagement phase.

Experimental Evaluation

WaveQ was evaluated across several standard computer vision benchmarks, including ImageNet (AlexNet, ResNet-18, MobileNet-V2), CIFAR-10 (SimpleNet, ResNet-20, VGG-11), and SVHN. These datasets provided a robust testing ground for the algorithm's ability to handle varying model architectures and complexity levels.

Key Insights

  • Optimal Heterogeneity: WaveQ consistently discovers that uniform bitwidth assignments are suboptimal. The framework often identifies irregular patterns—such as allocating more bits to sensitive middle layers—that preserve accuracy better than human-designed heuristics.
  • Smooth Loss Landscapes: Unlike hard quantization, which creates jagged, non-differentiable surfaces, the sinusoidal regularizer provides a smooth path for weights. This allows for more effective navigation of the loss landscape.
  • Dynamic Weight Trajectories: Analysis of weight movements during training revealed a "jump" phenomenon, where weights transition between different waves of the regularizer as the bitwidth adjusts, eventually settling into the most efficient quantization "pockets."

Results and Impact

WaveQ demonstrates superior performance compared to state-of-the-art (SOTA) methods like PACT, LQ-Nets, and DoReFa.

WaveQ achieves a superior accuracy-efficiency trade-off compared to baseline quantized training techniques.

As illustrated in Figure 6, WaveQ shifts the accuracy-cost curve upward and to the left. Key results include:

  • Accuracy Improvements: On ImageNet, WaveQ improved the Top-1 accuracy of the DoReFa algorithm by an average of 4.8%.
  • Enhanced Efficiency: For ResNet-18 on ImageNet, WaveQ learned a heterogeneous bitwidth assignment (averaging ~3.57 bits) that outperformed a fixed 4-bit uniform assignment in terms of accuracy.
  • Energy Reduction: Simulations on the Stripes bit-serial accelerator showed that WaveQ's bitwidth reductions led to an average 77.5% reduction in energy consumption compared to full-precision models.

Limitations and Future Work

While WaveQ offers a powerful automated path to quantization, it is sensitive to the scheduling of regularization strengths ($\lambda_w$ and $\lambda_\beta$), which currently requires manual tuning. Furthermore, while energy savings are substantial on specialized bit-serial hardware, the benefits on standard GPUs may be less pronounced due to their fixed-width architectural constraints. Future research will explore extending this differentiable approach to other architectural parameters, potentially integrating WaveQ into broader Neural Architecture Search (NAS) frameworks.

Summary updated

BibTeX
@misc{elthakeb2020gradient,
  author = {Ahmed T. Elthakeb and Prannoy Pilligundla and Fatemehsadat Mireshghallah and Tarek Elgindi and Charles-Alban Deledalle and Hadi Esmaeilzadeh},
  title = {{Gradient-Based Deep Quantization of Neural Networks through Sinusoidal Adaptive Regularization}},
  year = {2020},
  eprint = {2003.00146},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2003.00146},
}
Figure