arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.17544cs.LGcs.CV
收藏

面向FPGA深度学习加速的可训练定点量化方法

Trainable Fixed-Point Quantization for Deep Learning Acceleration on FPGAs

Cornell University(康奈尔大学);Tsinghua University(清华大学)

Dingyi Dai, Yichi Zhang, Jiahao Zhang, Zhanqiu Hu, Yaohui Cai, Qi Sun, Zhiru Zhang

AI总结:

本文提出可训练定点量化方法QFX,训练中自动学习小数点位置并支持无乘数量化以减少DSP占用,基于PyTorch实现且兼容FPGA HLS部署,在CIFAR-10、ImageNet上精度优于训练后量化,还在嵌入式FPGA加速器上验证了有效性。

摘要:

量化是将深度学习模型部署在嵌入式FPGA等资源受限设备上的关键技术。现有研究大多聚焦于矩阵乘法的量化,将BatchNorm、残差连接等其他层保留为浮点形式,尽管定点运算在FPGA上效率更高。常见做法是将预训练模型微调为定点格式以用于FPGA部署,但这可能会降低精度。\n本文提出QFX,一种新型可训练定点量化方法,可在模型训练过程中自动学习小数点位置。此外,我们在QFX中引入了无乘数量化策略以最小化DSP占用。QFX是基于PyTorch的库,能在反向传播期间以可微分方式高效模拟定点运算,且支持FPGA HLS。使用QFX训练的模型仅需极少工作量即可通过HLS直接部署,产生与软件版本完全一致的数值结果。我们的评估表明,与训练后量化相比,QFX可将包含逐元素层的模型量化到更少比特数,且在CIFAR-10和ImageNet数据集上均取得更高精度。我们还借助为嵌入式FPGA(AMD Xilinx Ultra96 v2)设计的前沿二值化神经网络加速器,验证了无乘数量化的有效性。我们计划将QFX以开源形式发布。

英文摘要:

Quantization is a crucial technique for deploying deep learning models on resource-constrained devices, such as embedded FPGAs. Prior efforts mostly focus on quantizing matrix multiplications, leaving other layers like BatchNorm or shortcuts in floating-point form, even though fixed-point arithmetic is more efficient on FPGAs. A common practice is to fine-tune a pre-trained model to fixed-point for FPGA deployment, but potentially degrading accuracy. This work presents QFX, a novel trainable fixed-point quantization approach that automatically learns the binary-point position during model training. Additionally, we introduce a multiplier-free quantization strategy within QFX to minimize DSP usage. QFX is implemented as a PyTorch-based library that efficiently emulates fixed-point arithmetic, supported by FPGA HLS, in a differentiable manner during backpropagation. With minimal effort, models trained with QFX can readily be deployed through HLS, producing the same numerical results as their software counterparts. Our evaluation shows that compared to post-training quantization, QFX can quantize models trained with element-wise layers quantized to fewer bits and achieve higher accuracy on both CIFAR-10 and ImageNet datasets. We further demonstrate the efficacy of multiplier-free quantization using a state-of-the-art binarized neural network accelerator designed for an embedded FPGA (AMD Xilinx Ultra96 v2). We plan to release QFX in open-source format.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑