Skip to main content
QUICK REVIEW

[Paper Review] HAQ: Hardware-Aware Automated Quantization with Mixed Precision

Kuan Wang, Zhijian Liu|arXiv (Cornell University)|Nov 21, 2018
Advanced Neural Network ApplicationsComputer Science29 references49 citations
TL;DR

HAQ uses reinforcement learning with hardware-in-the-loop to automatically assign mixed-precision bitwidths per layer, optimizing latency, energy, and model size across edge and cloud accelerators. It yields hardware-specialized quantization policies with minimal accuracy loss.

ABSTRACT

Model quantization is a widely used technique to compress and accelerate deep neural network (DNN) inference. Emergent DNN hardware accelerators begin to support mixed precision (1-8 bits) to further improve the computation efficiency, which raises a great challenge to find the optimal bitwidth for each layer: it requires domain experts to explore the vast design space trading off among accuracy, latency, energy, and model size, which is both time-consuming and sub-optimal. Conventional quantization algorithm ignores the different hardware architectures and quantizes all the layers in a uniform way. In this paper, we introduce the Hardware-Aware Automated Quantization (HAQ) framework which leverages the reinforcement learning to automatically determine the quantization policy, and we take the hardware accelerator's feedback in the design loop. Rather than relying on proxy signals such as FLOPs and model size, we employ a hardware simulator to generate direct feedback signals (latency and energy) to the RL agent. Compared with conventional methods, our framework is fully automated and can specialize the quantization policy for different neural network architectures and hardware architectures. Our framework effectively reduced the latency by 1.4-1.95x and the energy consumption by 1.9x with negligible loss of accuracy compared with the fixed bitwidth (8 bits) quantization. Our framework reveals that the optimal policies on different hardware architectures (i.e., edge and cloud architectures) under different resource constraints (i.e., latency, energy and model size) are drastically different. We interpreted the implication of different quantization policies, which offer insights for both neural network architecture design and hardware architecture design.

Motivation & Objective

  • Automate the search for layer-wise mixed-precision quantization policies without human heuristics.
  • Incorporate hardware feedback directly into the optimization loop to optimize real hardware metrics.
  • Demonstrate specialization of quantization policies across diverse hardware architectures (edge vs. cloud).
  • Provide insights into how different hardware characteristics shape optimal quantization strategies.

Proposed method

  • Formulate quantization as a reinforcement learning problem with a DDPG agent.
  • Use a layer-wise continuous action space to choose per-layer bitwidth, then discretize to {2,4,6,8} bits.
  • Gather direct latency and energy feedback from hardware accelerators as constraints in policy optimization.
  • Quantize weights/activations using linear quantization with per-layer bitwidth and KL-divergence-based clipping for weights.
  • Retrain quantized models for one epoch and use validation accuracy as the RL reward (scaled).
  • Explore policies across multiple hardware setups (edge/cloud, spatial/temporal architectures) to learn specialized strategies.

Experimental results

Research questions

  • RQ1Can hardware-aware reinforcement learning automatically discover optimal per-layer bitwidths for different hardware architectures?
  • RQ2Does specializing quantization policies to specific hardware yield significant gains in latency/energy with negligible accuracy loss?
  • RQ3How do resource constraints (latency, energy, model size) influence learned bitwidth allocations across layers?
  • RQ4What insights about neural network and hardware design emerge from the learned policies across edge vs. cloud and different accelerator designs?

Key findings

  • HAQ reduces latency by 1.4× to 1.95× and energy by about 1.9× with negligible accuracy loss compared to fixed 8-bit quantization.
  • Optimal quantization policies vary drastically across hardware architectures (edge vs. cloud, BISMO vs. BitFusion), illustrating the need for hardware-specific optimization.
  • Depthwise vs. pointwise layers exhibit different bitwidth allocations depending on whether latency, energy, or model size is optimized, reflecting memory vs. compute bottlenecks.
  • Compared to rule-based baselines (e.g., PACT, Deep Compression), HAQ achieves higher accuracy at similar or smaller model sizes under various constraints.
  • The learned policies align with roofline-model reasoning, attributing different layer strategies to memory bandwidth and compute capacity of the target hardware.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.