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

使用神经常微分方程的微型Transformer模型的成本高效FPGA实现

A Cost-Efficient FPGA Implementation of Tiny Transformer Model using Neural ODE

Keio University(庆应义塾大学)

Ikumi Okubo, Keisuke Sugiura, Hiroki Matsutani

AI总结:

本文提出一种以Neural ODE为骨干的轻量级混合Transformer模型,并通过QAT量化后在FPGA上实现,在STL10上达到79.68%准确率,整体加速9.85倍、能效提升7.10倍。

摘要:

Transformer已被用于图像识别任务,并显示出优于CNN和RNN的性能,但其训练成本高且计算复杂度大。为了解决这些问题,混合方法已成为近年来的研究趋势,即用MHSA(多头自注意力)替换ResNet的一部分。在本文中,我们提出了一种轻量级混合模型,该模型使用Neural ODE(神经常微分方程)作为骨干网络而非ResNet,从而可以在重用相同参数的同时增加构建块的迭代次数,缓解每次迭代参数量的增长。所提出的模型部署在中等规模的FPGA设备上用于边缘计算。该模型进一步通过QAT(量化感知训练)方案进行量化,以降低FPGA资源利用率,同时抑制精度损失。量化后的模型在包含96×96像素图像的STL10数据集上实现了79.68%的top-1准确率。特征提取网络的权重存储在片上,以最小化内存传输开销,从而实现更快的推理。通过消除内存传输开销,推理可以无缝执行,从而加速推理。所提出的FPGA实现将骨干网络和MHSA部分加速了34.01倍,并在考虑软件预处理和后处理的情况下实现了整体9.85倍的加速。与ARM Cortex-A53 CPU相比,FPGA加速实现了7.10倍更高的能效。本文在Xilinx ZCU104板上演示了所提出的轻量级Transformer模型用于96×96像素图像的图像识别,并且可以通过修改预处理层应用于不同的图像尺寸。

英文摘要:

Transformer has been adopted to image recognition tasks and shown to outperform CNNs and RNNs while it suffers from high training cost and computational complexity. To address these issues, a hybrid approach has become a recent research trend, which replaces a part of ResNet with an MHSA (Multi-Head Self-Attention). In this paper, we propose a lightweight hybrid model which uses Neural ODE (Ordinary Differential Equation) as a backbone instead of ResNet so that we can increase the number of iterations of building blocks while reusing the same parameters, mitigating the increase in parameter size per iteration. The proposed model is deployed on a modest-sized FPGA device for edge computing. The model is further quantized by QAT (Quantization Aware Training) scheme to reduce FPGA resource utilization while suppressing the accuracy loss. The quantized model achieves 79.68% top-1 accuracy for STL10 dataset that contains 96$\times$96 pixel images. The weights of the feature extraction network are stored on-chip to minimize the memory transfer overhead, allowing faster inference. By eliminating the overhead of memory transfers, inference can be executed seamlessly, leading to accelerated inference. The proposed FPGA implementation accelerates the backbone and MHSA parts by 34.01$\times$, and achieves an overall 9.85$\times$ speedup when taking into account the software pre- and post-processing. The FPGA acceleration leads to 7.10$\times$ better energy efficiency compared to the ARM Cortex-A53 CPU. The proposed lightweight Transformer model is demonstrated on Xilinx ZCU104 board for the image recognition of 96$\times$96 pixel images in this paper and can be applied to different image sizes by modifying the pre-processing layer.

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

↑