[论文解读] Any-Precision Deep Neural Networks
本文提出了一种任意精度深度神经网络(DNNs)框架,使单个微调后的模型能够在无需微调或校准的情况下,动态地以任意位宽进行推理。通过联合训练多种位宽并使用知识蒸馏,该模型在各类视觉任务中实现了与专用低精度模型相当的精度,从而在效率与精度之间实现了灵活的运行时权衡。
We present any-precision deep neural networks (DNNs), which are trained with a new method that allows the learned DNNs to be flexible in numerical precision during inference. The same model in runtime can be flexibly and directly set to different bit-widths, by truncating the least significant bits, to support dynamic speed and accuracy trade-off. When all layers are set to low-bits, we show that the model achieved accuracy comparable to dedicated models trained at the same precision. This nice property facilitates flexible deployment of deep learning models in real-world applications, where in practice trade-offs between model accuracy and runtime efficiency are often sought. Previous literature presents solutions to train models at each individual fixed efficiency/accuracy trade-off point. But how to produce a model flexible in runtime precision is largely unexplored. When the demand of efficiency/accuracy trade-off varies from time to time or even dynamically changes in runtime, it is infeasible to re-train models accordingly, and the storage budget may forbid keeping multiple models. Our proposed framework achieves this flexibility without performance degradation. More importantly, we demonstrate that this achievement is agnostic to model architectures and applicable to multiple vision tasks. Our code is released at https://github.com/SHI-Labs/Any-Precision-DNNs.
研究动机与目标
- 解决实际部署中模型精度与运行时效率之间的平衡挑战。
- 克服现有方法需为不同精度级别重新训练或维护多个模型的局限性。
- 使单个模型能够在推理时实现动态精度调整,且性能无下降。
- 证明通过知识蒸馏在多个位宽上联合训练可生成鲁棒且泛化能力强的低精度模型。
- 实现与模型架构无关的灵活性,并适用于多种视觉任务与基准测试。
提出的方法
- 在反向传播过程中同时训练多个位宽(例如1、2、4、8、32位)的单一DNN模型,使用共享的全精度(FP32)参数作为主要可训练权重。
- 在训练过程中通过量化操作使用直通估计(STE)反向传播梯度,实现端到端优化。
- 采用递归知识蒸馏:使用最近的更高精度模型的软标签监督低精度输出,从而提升低精度区域的泛化能力。
- 通过更新一致性平均(UCA)确保不同位宽之间的梯度一致性,该指标通过计算不同位宽间梯度的余弦相似度进行衡量。
- 通过在运行时截断权重和激活的最低有效位,实现任意位宽的推理,无需重新训练或校准。
- 利用多精度位宽的联合优化,提升模型对对抗攻击的鲁棒性,因为模型在不同精度级别下学习到了一致的表示。
实验结果
研究问题
- RQ1能否训练单个DNN模型,使其在推理时实现动态精度调整,而无需重新训练或校准?
- RQ2在多个位宽上联合训练对模型精度和泛化能力有何影响,特别是在低比特区域?
- RQ3与专用模型相比,知识蒸馏在多精度低比特模型中的性能提升程度如何?
- RQ4与单精度模型相比,所提出的框架是否保持或提升了对对抗攻击的鲁棒性?
- RQ5该多精度方法是否无需架构修改即可在不同模型架构和视觉任务上实现泛化?
主要发现
- 任意精度DNNs在CIFAR-10和ImageNet上的分类精度与同一位宽下专用模型相当或更优:ResNet-20在FP32下达到93.98%的top-1精度,在1位下通过知识蒸馏达到92.15%。
- 在Pascal VOC 2012语义分割任务中,该方法优于专用模型:1位下达到61.3%的mIoU,而专用1位模型为59.5%。
- 知识蒸馏显著提升了低比特性能:ResNet-50在ImageNet上4位下使用KD时达到74.75%的top-1精度,而未使用KD时为74.43%。
- 不同位宽之间的更新一致性平均(UCA)保持在0.9–1.0之间,表明训练过程中梯度一致性极强。
- 任意精度模型对FGSM对抗攻击表现出更强鲁棒性,其FP32模型精度相比专用模型提升了超过10%。
- 该框架与模型架构无关,可在分类与分割任务中泛化,包括ResNet、DenseNet以及基于ResNet-50的DeepLabV3。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。