[论文解读] Nonuniform-to-Uniform Quantization: Towards Accurate Quantization via Generalized Straight-Through Estimation
本文提出了一种新型量化方法——非均匀到均匀量化(N2UQ),通过学习灵活的非均匀输入阈值实现均匀量化,从而在保持硬件效率的同时实现类似非均匀量化方法的高精度。该方法引入了一种广义直通估计器(G-STE),用于通过阈值进行梯度反向传播,并结合保熵正则化,使2-bit ResNet-50在ImageNet上的top-1准确率达到69.7%,仅比全精度模型低0.6%。
The nonuniform quantization strategy for compressing neural networks usually achieves better performance than its counterpart, i.e., uniform strategy, due to its superior representational capacity. However, many nonuniform quantization methods overlook the complicated projection process in implementing the nonuniformly quantized weights/activations, which incurs non-negligible time and space overhead in hardware deployment. In this study, we propose Nonuniform-to-Uniform Quantization (N2UQ), a method that can maintain the strong representation ability of nonuniform methods while being hardware-friendly and efficient as the uniform quantization for model inference. We achieve this through learning the flexible in-equidistant input thresholds to better fit the underlying distribution while quantizing these real-valued inputs into equidistant output levels. To train the quantized network with learnable input thresholds, we introduce a generalized straight-through estimator (G-STE) for intractable backward derivative calculation w.r.t. threshold parameters. Additionally, we consider entropy preserving regularization to further reduce information loss in weight quantization. Even under this adverse constraint of imposing uniformly quantized weights and activations, our N2UQ outperforms state-of-the-art nonuniform quantization methods by 0.5~1.7 on ImageNet, demonstrating the contribution of N2UQ design. Code and models are available at: https://github.com/liuzechun/Nonuniform-to-Uniform-Quantization.
研究动机与目标
- 通过在保持均匀输出级别同时实现灵活的输入阈值学习,弥合非均匀量化与均匀量化之间的性能差距。
- 解决在均匀量化器中训练非均匀输入阈值时的不可行梯度问题。
- 通过保熵正则化减少低比特DNN中的量化误差与信息损失。
- 通过避免非均匀输出的后处理,保持硬件效率,支持直接的位运算。
提出的方法
- 提出一种非均匀到均匀量化器(N2UQ),在学习非均匀输入阈值的同时生成等距的输出级别。
- 提出一种广义直通估计器(G-STE),其源自随机量化,可实现通过非均匀阈值的梯度流动。
- 在G-STE中采用基于期望的反向近似方法,以处理阈值参数的不可行梯度问题。
- 应用保熵正则化,通过适应底层权重分布来最小化权重量化过程中的信息损失。
- 采用可微分的量化函数,将实数值输入映射到基于学习阈值的均匀输出级别。
- 使用G-STE与正则化方法,通过反向传播端到端训练整个网络,实现阈值与网络权重的联合优化。
实验结果
研究问题
- RQ1能否设计一种量化方法,兼具非均匀量化方法的表征能力,同时保持均匀量化方法的硬件效率?
- RQ2在均匀量化框架中,如何有效实现可学习、非均匀输入阈值的梯度反向传播?
- RQ3何种正则化策略最能有效保留低比特权重量化过程中的信息?
- RQ4是否可通过包含可学习阈值与感知熵的统一训练框架,超越现有非均匀量化方法的性能?
主要发现
- N2UQ在2-bit量化ResNet-18上实现了69.7%的ImageNet top-1准确率,与全精度模型的差距缩小至仅2.1%。
- 2-bit N2UQ ResNet-50实现了67.1%的top-1准确率,仅比全精度模型低0.6%。
- 所提出的G-STE方法有效支持了非均匀输入阈值的训练,相比基线均匀量化方法,准确率提升了3.0%。
- 保熵权重正则化相比基线方法,准确率提升1.9%,优于权重范数和可学习缩放因子基线方法。
- 消融实验表明,阈值学习与保熵正则化均不可或缺,二者结合可实现最高性能。
- 学习到的阈值能自适应数据分布——在密集区域采用更小的区间,在稀疏尾部采用更大的区间,从而降低量化误差。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。