arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2211.08110cs.ARcs.AIcs.CV
收藏

HeatViT:用于视觉Transformer的硬件高效自适应令牌修剪

HeatViT: Hardware-Efficient Adaptive Token Pruning for Vision Transformers

Northeastern University(东北大学);Simon Fraser University(西蒙弗雷泽大学);CoCoPIE LLC(CoCoPIE有限责任公司)

Peiyan Dong, Mengshu Sun, Alec Lu, Yanyue Xie, Kenneth Liu, Zhenglun Kong, Xin Meng, Zhengang Li, Xue Lin, Zhenman Fang, Yanzhi Wang

摘要:

虽然视觉Transformer(ViTs)在计算机视觉领域不断取得新的里程碑,但其复杂的网络架构以及高计算和内存成本阻碍了其在资源有限的边缘设备上的部署。在本文中,我们提出了一个硬件高效的图像自适应令牌修剪框架,称为HeatViT的高效而准确的ViT加速嵌入式FPGA。通过分析ViTs中固有的计算模式,我们首先设计了一个有效的基于注意力的多头标记选择器,它可以逐步插入到Transformer块之前,以动态地识别和合并输入图像中的非信息标记。此外,我们通过添加微型控制逻辑来实现硬件上的令牌选择器,以大量重用为主干ViT构建的现有硬件组件。为了提高硬件效率,我们进一步采用8位定点量化,并提出了多项式近似的正则化效果的量化误差的ViTs中常用的非线性函数。最后,我们提出了一种延迟感知的多阶段训练策略,以确定用于插入令牌选择器的Transformer块,并优化插入令牌选择器的期望(平均)修剪率,以提高模型的准确性和硬件上的推理延迟。与现有的ViT剪枝研究相比,在相似的计算成本下,HeatViT可以实现0.7% $\sim$ 8.9%的高精度;而在相似的模型精度下,HeatViT可以实现超过28.4% $\sim$ 65.3%的计算减少,对于ImageNet数据集上各种广泛使用的ViT,包括DeiT-T,DeiT-S,DeiT-B,LV-ViT-S和LV-ViT-M。与基线硬件加速器相比,我们在Xilinx ZCU 102 FPGA上实现的HeatViT实现了3.46 $\times$ $\sim$ 4.89 $\times$加速比。

英文摘要:

While vision transformers (ViTs) have continuously achieved new milestones in the field of computer vision, their sophisticated network architectures with high computation and memory costs have impeded their deployment on resource-limited edge devices. In this paper, we propose a hardware-efficient image-adaptive token pruning framework called HeatViT for efficient yet accurate ViT acceleration on embedded FPGAs. By analyzing the inherent computational patterns in ViTs, we first design an effective attention-based multi-head token selector, which can be progressively inserted before transformer blocks to dynamically identify and consolidate the non-informative tokens from input images. Moreover, we implement the token selector on hardware by adding miniature control logic to heavily reuse existing hardware components built for the backbone ViT. To improve the hardware efficiency, we further employ 8-bit fixed-point quantization, and propose polynomial approximations with regularization effect on quantization error for the frequently used nonlinear functions in ViTs. Finally, we propose a latency-aware multi-stage training strategy to determine the transformer blocks for inserting token selectors and optimize the desired (average) pruning rates for inserted token selectors, in order to improve both the model accuracy and inference latency on hardware. Compared to existing ViT pruning studies, under the similar computation cost, HeatViT can achieve 0.7%$\sim$8.9% higher accuracy; while under the similar model accuracy, HeatViT can achieve more than 28.4%$\sim$65.3% computation reduction, for various widely used ViTs, including DeiT-T, DeiT-S, DeiT-B, LV-ViT-S, and LV-ViT-M, on the ImageNet dataset. Compared to the baseline hardware accelerator, our implementations of HeatViT on the Xilinx ZCU102 FPGA achieve 3.46$\times$$\sim$4.89$\times$ speedup.

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

↑