HAWQ: Hessian AWare Quantization of Neural Networks With Mixed-Precision

Zhen Dong, Zhewei Yao, Amir Gholami, Michael W. Mahoney, Kurt Keutzer

Introduction

Deploying large-scale neural networks on edge devices like smartphones and autonomous vehicles is constrained by strict memory and power limits. Quantization—representing weights and activations with fewer bits—is a primary strategy to address these constraints. However, uniform quantization often fails to balance efficiency and accuracy. HAWQ (Hessian AWare Quantization) addresses this by introducing a deterministic, second-order method to automatically select optimal bit-precisions for each layer.

The Challenge of Mixed-Precision

While mixed-precision quantization allows for more aggressive compression in robust layers while preserving precision in sensitive ones, the search space is immense. For a 50-layer network with 4 bit-width options, there are $4^{50}$ possible configurations. Previous methods relied on computationally expensive Reinforcement Learning (RL) or AutoML, which often lack a theoretical foundation and require significant search time.

Methodology: Leveraging the Hessian Spectrum

HAWQ utilizes the Hessian spectrum—the second-order derivatives of the loss function—to guide the quantization process systematically.

Sensitivity Analysis

The core premise is that layers residing in "sharp" regions of the loss landscape (characterized by high Hessian eigenvalues) are highly sensitive to the perturbations introduced by quantization. Conversely, layers in "flat" regions (low eigenvalues) can tolerate lower precision.

Top Hessian eigenvalues across different blocks of Inception-V3 on ImageNet, illustrating varying layer sensitivities.

The Ranking Metric ($S_i$)

To prioritize bits, HAWQ computes the top eigenvalue ($\lambda$) for each block using a matrix-free power iteration method. Blocks are ranked by $S_i = \lambda_i / n_i$, where $n_i$ is the number of parameters. This metric ensures that bits are allocated to layers that are both sensitive and parameter-dense.

Deterministic Fine-Tuning

After quantization, the model is fine-tuned to recover accuracy. HAWQ uses a second metric, $\Omega_i$, which combines Hessian sensitivity with the actual quantization error magnitude. Fine-tuning begins with the most sensitive blocks to stabilize the network early in the process.

Key Insights: The Geometry of Loss

A significant contribution of HAWQ is the visualization of the 3D loss landscape. By examining different blocks, the researchers confirmed that some layers exhibit steep, canyon-like landscapes, while others are remarkably flat.

Visualization of a 'sharp' loss landscape for the 2nd block of a neural network, indicating high sensitivity to quantization noise.

This geometric disparity proves that second-order information (curvature) is a far more reliable predictor of quantization robustness than first-order gradients. Unlike stochastic AutoML methods, HAWQ provides a transparent, mathematically grounded selection process.

Experimental Results

HAWQ was evaluated on CIFAR-10 (ResNet20) and ImageNet (Inception-V3, ResNet50, SqueezeNext), consistently outperforming state-of-the-art methods like RVQuant and HAQ.

  • ResNet50 (ImageNet): Compressed to 7.96MB (from ~98MB) with 75.48% top-1 accuracy, surpassing AutoML-based results.
  • Inception-V3 (ImageNet): Reduced from 91.2MB to 7.57MB with only a ~2% accuracy drop.
  • SqueezeNext (The 1MB Milestone): Achieved a model size of just 1.09MB while maintaining over 68% top-1 accuracy on ImageNet—a critical threshold for on-chip deployment.
  • Activation Compression: Achieved an 8x compression ratio for activations on ResNet20 with superior accuracy.

Conclusion

HAWQ demonstrates that second-order sensitivity analysis can replace expensive search-based quantization strategies. While computing Hessian eigenvalues adds some pre-processing overhead, it is significantly faster than RL-based searches and provides a clear theoretical path toward efficient neural network deployment.

Summary updated

BibTeX
@inproceedings{dong2019hawq,
  author = {Zhen Dong and Zhewei Yao and Amir Gholami and Michael W. Mahoney and Kurt Keutzer},
  title = {{HAWQ: Hessian AWare Quantization of Neural Networks With Mixed-Precision}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2019},
  doi = {10.1109/iccv.2019.00038},
}
Figure