[论文解读] Network Quantization with Element-wise Gradient Scaling
本文提出了一种新型方法——逐元素梯度缩放(EWGS),通过同时考虑每个梯度的符号以及量化器连续输入与离散输出之间的量化误差,在量化神经网络的反向传播过程中自适应地缩放梯度。EWGS在无需额外超参数调优或训练调度的情况下,显著提升了训练稳定性和精度,在CIFAR-10和ImageNet数据集上,针对多种网络架构和位宽配置,均实现了当前最优性能。
Network quantization aims at reducing bit-widths of weights and/or activations, particularly important for implementing deep neural networks with limited hardware resources. Most methods use the straight-through estimator (STE) to train quantized networks, which avoids a zero-gradient problem by replacing a derivative of a discretizer (i.e., a round function) with that of an identity function. Although quantized networks exploiting the STE have shown decent performance, the STE is sub-optimal in that it simply propagates the same gradient without considering discretization errors between inputs and outputs of the discretizer. In this paper, we propose an element-wise gradient scaling (EWGS), a simple yet effective alternative to the STE, training a quantized network better than the STE in terms of stability and accuracy. Given a gradient of the discretizer output, EWGS adaptively scales up or down each gradient element, and uses the scaled gradient as the one for the discretizer input to train quantized networks via backpropagation. The scaling is performed depending on both the sign of each gradient element and an error between the continuous input and discrete output of the discretizer. We adjust a scaling factor adaptively using Hessian information of a network. We show extensive experimental results on the image classification datasets, including CIFAR-10 and ImageNet, with diverse network architectures under a wide range of bit-width settings, demonstrating the effectiveness of our method.
研究动机与目标
- 为解决由直通估计器(STE)引起的量化神经网络中次优梯度流动问题,该方法不考虑量化误差,对所有梯度一视同仁。
- 通过引入更自适应的梯度更新机制,提升低比特网络量化中的训练稳定性和精度。
- 开发一种基于二阶信息动态调整每层梯度缩放的方法,避免对超参数进行大规模搜索。
- 在多种网络架构和位宽配置下,验证所提方法的泛化能力与有效性。
提出的方法
- EWGS在反向传播过程中,根据梯度符号以及量化器连续潜在输入与离散输出之间的量化误差,自适应地缩放每个梯度元素。
- 该方法利用损失函数相对于离散输出的Hessian矩阵的迹作为缩放因子,通过Hutchinson方法高效估计。
- 缩放因子在每层自适应更新,以反映网络中不同层量化器的敏感度差异。
- 该方法将标准STE的固定梯度流动替换为反映量化过程局部曲率与误差敏感度的梯度缩放机制。
- 该方法可无缝集成到现有量化框架中,无需架构修改或额外训练调度。
- 梯度缩放以逐元素方式进行,实现对离散量化级别周围损失曲面局部几何结构的细粒度适应。
实验结果
研究问题
- RQ1是否可以通过考虑量化误差的梯度缩放,提升量化神经网络的训练稳定性和精度,相比标准STE?
- RQ2基于Hessian信息的自适应梯度缩放,对低比特网络量化中的收敛性和性能有何影响?
- RQ3EWGS是否能在无需重新调优超参数的情况下,泛化到不同网络架构和位宽设置?
- RQ4在极端位宽设置(如1-bit)下,EWGS是否能超越使用STE的现有量化方法?
- RQ5在量化网络中,固定与自适应缩放因子对最终模型精度的影响如何?
主要发现
- 在CIFAR-10和ImageNet数据集上,针对ResNet-18、MobileNet-V2和ResNet-20等多种网络架构,EWGS在不同位宽下相比STE实现了1%的精度提升。
- 在CIFAR-10数据集上,使用ResNet-20且权重与激活均为1-bit时,EWGS达到85.6%的top-1精度,优于STE的84.7%,并接近最佳报告结果(85.3%)的水平,仅需适当缩放。
- 在ImageNet数据集上,对权重仅二值化的ResNet-18,EWGS达到67.3%的top-1精度,而STE为66.3%,表明其在训练稳定性和收敛性方面表现更优。
- 该方法在所有测试设置中持续优于STE及其他基线量化方法(如PROFIT和DoReFa-Net),在不同框架中均表现出强泛化能力。
- 当使用固定缩放因子0.01时,EWGS性能与最佳调优结果相当,表明其在无需大量超参数调优的情况下仍具鲁棒性。
- 训练曲线显示,尤其是在1-bit设置下,EWGS的训练损失更低,验证精度更高,证实了其更优的训练动态。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。