EPTQ: Enhanced Post-Training Quantization via Hessian-guided Network-wise Optimization
Ofir Gordon, Elad Cohen, Hai Victor Habi, Arnon Netzer
TL;DR
This work tackles the challenge of deploying DNNs on edge devices by enhancing Post-Training Quantization (PTQ) through network-wide optimization that accounts for cross-layer dependencies. It introduces Enhanced PTQ ($EPTQ$), which leverages a label-free Hessian bound to construct a Sample-Layer Attention ($SLA$) score and a Hessian-based MSE ($Hmse$) metric to guide weight quantization and the rounding policy. The method combines a Hessian-guided knowledge-distillation loss with a gradual activation quantization scheme to recover accuracy lost during quantization, achieving state-of-the-art performance on ImageNet, COCO, and Pascal VOC without data augmentation. The approach is validated across diverse architectures and tasks, with ablations showing the pivotal roles of SLA, Hmse, and the gradual quantization strategy, and the authors provide public code for reproducibility.
Abstract
Quantization is a key method for deploying deep neural networks on edge devices with limited memory and computation resources. Recent improvements in Post-Training Quantization (PTQ) methods were achieved by an additional local optimization process for learning the weight quantization rounding policy. However, a gap exists when employing network-wise optimization with small representative datasets. In this paper, we propose a new method for enhanced PTQ (EPTQ) that employs a network-wise quantization optimization process, which benefits from considering cross-layer dependencies during optimization. EPTQ enables network-wise optimization with a small representative dataset using a novel sample-layer attention score based on a label-free Hessian matrix upper bound. The label-free approach makes our method suitable for the PTQ scheme. We give a theoretical analysis for the said bound and use it to construct a knowledge distillation loss that guides the optimization to focus on the more sensitive layers and samples. In addition, we leverage the Hessian upper bound to improve the weight quantization parameters selection by focusing on the more sensitive elements in the weight tensors. Empirically, by employing EPTQ we achieve state-of-the-art results on various models, tasks, and datasets, including ImageNet classification, COCO object detection, and Pascal-VOC for semantic segmentation.
