[论文解读] HAWQ: Hessian AWare Quantization of Neural Networks with Mixed-Precision
HAWQ 使用 Hessian 基于二阶信息自动分配层级混合精度并确定性微调顺序,在 CIFAR-10 和 ImageNet 模型上实现更高的压缩,同时维持或提升准确率。
Model size and inference speed/power have become a major challenge in the deployment of Neural Networks for many applications. A promising approach to address these problems is quantization. However, uniformly quantizing a model to ultra low precision leads to significant accuracy degradation. A novel solution for this is to use mixed-precision quantization, as some parts of the network may allow lower precision as compared to other layers. However, there is no systematic way to determine the precision of different layers. A brute force approach is not feasible for deep networks, as the search space for mixed-precision is exponential in the number of layers. Another challenge is a similar factorial complexity for determining block-wise fine-tuning order when quantizing the model to a target precision. Here, we introduce Hessian AWare Quantization (HAWQ), a novel second-order quantization method to address these problems. HAWQ allows for the automatic selection of the relative quantization precision of each layer, based on the layer's Hessian spectrum. Moreover, HAWQ provides a deterministic fine-tuning order for quantizing layers, based on second-order information. We show the results of our method on Cifar-10 using ResNet20, and on ImageNet using Inception-V3, ResNet50 and SqueezeNext models. Comparing HAWQ with state-of-the-art shows that we can achieve similar/better accuracy with $8 imes$ activation compression ratio on ResNet20, as compared to DNAS~\cite{wu2018mixed}, and up to $1\%$ higher accuracy with up to $14\%$ smaller models on ResNet50 and Inception-V3, compared to recently proposed methods of RVQuant~\cite{park2018value} and HAQ~\cite{wang2018haq}. Furthermore, we show that we can quantize SqueezeNext to just 1MB model size while achieving above $68\%$ top1 accuracy on ImageNet.
研究动机与目标
- 通过量化在不对各层采用统一精度的情况下,减小模型大小与推理能耗。
- 提出一种基于 Hessian 的方法,自动确定每一层的量化精度。
- 提供一个确定性、基于二阶信息的量化模型微调顺序。
- 在 CIFAR-10 和 ImageNet 上展示最先进或具有竞争力的高压缩下的准确性。
提出的方法
- 将网络划分为块,并通过矩阵无关的幂迭代(Hessian matvec)对每个块计算 Hessian 特征值。
- 定义每块的敏感度指标 S_i = lambda_i / n_i,用于对量化精度选项进行排序(lambda_i 为顶层 Hessian 特征值,n_i 为块大小)。
- 基于降序的 S_i 为块分配相对比特精度顺序,以指导混合量化。
- 定义一个微调顺序,使用 Omega_i = lambda_i * ||Q(W_i) - W_i||^2,以优先考虑具有高曲率和大扰动的块。
- 将 Hessian 近似为按顶层特征值缩放的对角块矩阵,以降低复杂度。
- 在派生的顺序中对块进行分块的、受 Hessian 指导的量化及随后分块微调。
- 提供消融研究,显示排序和 Hessian 指导对性能的影响。
实验结果
研究问题
- RQ1Hessian 谱信息是否可以指导在混合量化中选择相对的按层/块的量化精度?
- RQ2基于 Hessian 指导的分块量化和后续微调能否在保持与现有方法相当的准确性的同时实现更高的压缩?
- RQ3Hessian 基于排序对大视觉模型的收敛速度和最终准确率有何影响?
- RQ4相较于现有量化方法,HAWQ 在 CIFAR-10 的 ResNet20 以及 ImageNet 的 Inception-V3、ResNet-50、SqueezeNext 上的表现如何?
主要发现
- HAWQ 在 CIFAR-10 的 ResNet20 上实现与基线相似或更高的准确性,同时在激活方面实现显著更高的压缩(激活压缩最高可达 8x)。
- 在 ImageNet 上,HAWQ 对 Inception-V3 实现高达 12.04x 的权重+激活压缩,Top-1 约为 75.52%(相较 Direct),并在准确性和模型大小方面超越若干替代方法。
- 在 ImageNet 的 ResNet-50 上,HAWQ 达到 75.48% Top-1,模型大小 7.96 MB,准确性和大小均优于 HAQ。
- 对于 ImageNet 的 SqueezeNext,HAWQ 将模型大小降至 1 MB,Top-1 准确率 68.02%,远超直接量化,实现极致紧凑部署。
- 消融实验显示 Hessian 指导的排序(包括量化和微调)相比反向排序基线显著改善收敛速度和最终准确性。
- 该方法表明二阶信息提供了一种有原理且可扩展的方式,在多种架构中执行混合精度量化。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。