Skip to main content
QUICK REVIEW

[论文解读] SQuant: On-the-Fly Data-Free Quantization via Diagonal Hessian Approximation

Cong Guo, Yuxian Qiu|arXiv (Cornell University)|Feb 14, 2022
Advanced Neural Network ApplicationsComputer Science被引用 19
一句话总结

SQuant 提出了一种快速、无需数据的训练后量化框架,通过基于对角 Hessian 近似的新型约束绝对误差和(CASE)目标函数优化,实现亚秒级量化时间,并在无需合成数据、反向传播或微调的情况下,相比现有无需数据方法实现超过30%的准确率提升。该方法消除了对合成数据、反向传播或微调的需求,使在仅支持推理的设备上实现即时量化成为可能,且计算开销极低。

ABSTRACT

Quantization of deep neural networks (DNN) has been proven effective for compressing and accelerating DNN models. Data-free quantization (DFQ) is a promising approach without the original datasets under privacy-sensitive and confidential scenarios. However, current DFQ solutions degrade accuracy, need synthetic data to calibrate networks, and are time-consuming and costly. This paper proposes an on-the-fly DFQ framework with sub-second quantization time, called SQuant, which can quantize networks on inference-only devices with low computation and memory requirements. With the theoretical analysis of the second-order information of DNN task loss, we decompose and approximate the Hessian-based optimization objective into three diagonal sub-items, which have different areas corresponding to three dimensions of weight tensor: element-wise, kernel-wise, and output channel-wise. Then, we progressively compose sub-items and propose a novel data-free optimization objective in the discrete domain, minimizing Constrained Absolute Sum of Error (or CASE in short), which surprisingly does not need any dataset and is even not aware of network architecture. We also design an efficient algorithm without back-propagation to further reduce the computation complexity of the objective solver. Finally, without fine-tuning and synthetic datasets, SQuant accelerates the data-free quantization process to a sub-second level with >30% accuracy improvement over the existing data-free post-training quantization works, with the evaluated models under 4-bit quantization. We have open-sourced the SQuant framework at https://github.com/clevercool/SQuant.

研究动机与目标

  • 解决现有无需数据量化(DFQ)方法中依赖合成数据生成和反向传播所导致的高计算成本与准确率下降问题。
  • 通过消除对训练数据、微调或反向传播的需求,实现在资源受限的仅支持推理设备上的即时量化。
  • 开发一种无需网络架构知识或输入数据即可利用二阶 Hessian 信息的无需数据优化目标。
  • 在保持高准确率的同时,将 DFQ 加速至亚秒级别,尤其在低比特量化(如 4-bit)下表现优异。
  • 通过直接最小化权重扰动误差,采用渐进式、线性复杂度的算法,在无需数据的后训练量化中实现最先进准确率。

提出的方法

  • 提出一种新颖的无需数据优化目标——约束绝对误差和(CASE),源自网络损失的 Hessian 矩阵,可在无需输入数据的情况下衡量权重扰动。
  • 将基于 Hessian 的目标分解为三个对角子项:逐元素、逐核和输出通道,分别对应权重张量的不同维度。
  • 在离散域中渐进地组合并优化这些子项,以最小化 CASE 目标,避免反向传播并降低计算复杂度。
  • 引入一种具有线性时间复杂度的渐进算法,高效求解 CASE 目标,实现每层和全网络的亚秒级量化。
  • 采用对角 Hessian 近似来估计损失函数的二阶信息,实现在无训练数据或模型梯度访问情况下的准确权重舍入。
  • 设计一种作为黑盒后处理步骤的框架,无需架构知识或合成数据生成。

实验结果

研究问题

  • RQ1无需数据的量化方法是否能在不依赖合成数据生成或微调的情况下实现高准确率?
  • RQ2在无需数据设置中,损失函数的二阶 Hessian 信息是否可被有效近似并利用以指导权重量化?
  • RQ3是否能通过离散、不可微的优化目标(如 CASE)直接最小化权重扰动误差,而无需反向传播?
  • RQ4是否可将无需数据量化优化的复杂度降低至亚秒级别,同时保持高准确率?
  • RQ5所提出的基于 Hessian 的、无需数据的 CASE 目标与 AdaRound 等现有数据驱动方法相比,在准确率和速度方面表现如何?

主要发现

  • SQuant 实现了亚秒级量化时间,每层仅需 4 ms,全 ResNet18 网络仅需 84 ms,显著快于先前的 DFQ 方法。
  • 在 4-bit 量化下,SQuant 相比现有无需数据后训练量化方法准确率提升超过 30%,在低比特场景下表现强劲。
  • 在 8-bit 量化下,SQuant 平均准确率损失仅为 0.1%,在 6-bit 量化下为 1.8%,优于最先进无需数据方法。
  • 该方法无需合成数据、反向传播或微调,可在仅支持推理的设备上部署,内存和计算开销极低。
  • SQuant 通过直接优化 CASE 目标,优于无需数据的 AdaRound 和其他基于 Hessian 的方法,避免了基于梯度方法的漫长优化路径。
  • 消融实验表明,结合逐元素、逐核和通道级优化(SQuant-E&K&C)可获得最高准确率,充分利用了最多的 Hessian 信息。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。