[论文解读] VAQF: Fully Automatic Software-Hardware Co-Design Framework for Low-Bit Vision Transformer
VAQF 自动设计基于 FPGA 的 ViT 加速器,针对二值权重、低精度 ViT,通过编译引导的量化策略实现实时 FPS 目标。
The transformer architectures with attention mechanisms have obtained success in Nature Language Processing (NLP), and Vision Transformers (ViTs) have recently extended the application domains to various vision tasks. While achieving high performance, ViTs suffer from large model size and high computation complexity that hinders the deployment of them on edge devices. To achieve high throughput on hardware and preserve the model accuracy simultaneously, we propose VAQF, a framework that builds inference accelerators on FPGA platforms for quantized ViTs with binary weights and low-precision activations. Given the model structure and the desired frame rate, VAQF will automatically output the required quantization precision for activations as well as the optimized parameter settings of the accelerator that fulfill the hardware requirements. The implementations are developed with Vivado High-Level Synthesis (HLS) on the Xilinx ZCU102 FPGA board, and the evaluation results with the DeiT-base model indicate that a frame rate requirement of 24 frames per second (FPS) is satisfied with 8-bit activation quantization, and a target of 30 FPS is met with 6-bit activation quantization. To the best of our knowledge, this is the first time quantization has been incorporated into ViT acceleration on FPGAs with the help of a fully automatic framework to guide the quantization strategy on the software side and the accelerator implementations on the hardware side given the target frame rate. Very small compilation time cost is incurred compared with quantization training, and the generated accelerators show the capability of achieving real-time execution for state-of-the-art ViT models on FPGAs.
研究动机与目标
- 通过量化降低模型大小和计算量,推动 Vision Transformer 在边缘设备上的高效部署。
- 提出一个全自动框架,输出激活精度和加速器设置以达到目标帧率。
- 将二值权重与低精度激活集成,以在准确性和吞吐量之间取得平衡。
- 展示在 Xilinx 板卡上使用 Vivado HLS 的 FPGA 基于 ViT 加速。
提出的方法
- 引入 VAQF 流程,该流程以 ViT 结构和目标 FPS 作为输入,通过编译步骤确定激活精度。
- 将 ViT 权重量化为二进制,激活量化为低精度,受硬件可行性引导。
- 为全连接层(FC)和多头注意力开发计算引擎,采用循环切块、数据打包和基于 LUT 的二值权重算术。
- 实现分层优化和 FPGA 数据路径设计,在 BRAM/DSP/LUT 限制下最大化吞吐量。
- 对激活精度进行二分搜索,以满足 FPS 目标并生成相应的加速器参数。
- 使用 DeiT-base,在 ZCU102 上通过 Vivado HLS 评估实现,报告在 24 FPS(8-bit 激活)和 30 FPS(6-bit 激活)下满足 FPS 要求。
实验结果
研究问题
- RQ1一个全自动框架是否能够确定在 FPGA 上对量化 ViT 达到指定帧率所需的激活精度?
- RQ2哪些软硬件协同设计策略能够在 FPGA 平台上实现带二值权重和低精度激活的实时 ViT 推理?
- RQ3VAQF 如何在 ViT 模型的不同激活精度下平衡准确性与吞吐量?
- RQ4数据打包、切块和基于 LUT 的计算对量化 ViT 的 FPGA 资源利用率有何影响?
主要发现
- 二值权重 ViT 采用全精度激活,在 ImageNet-1K(验证集)上达到 79.5% 的 top-1 准确率,比全精度 81.8% 的模型下降 2.3%。
- 8-bit 激活保持 77.6% 的准确率,使在目标 FPGA 板上实现 24 FPS。
- 6-bit 激活达到 76.5% 的准确率,使在目标 FPGA 板上实现 30 FPS。
- VAQF 的编译步骤可迅速确定激活精度和加速器设置,耗时从几分钟到数小时,远少于典型量化训练时间。
- 该 FPGA 加速器使用基于 LUT 的二值权重计算,结合数据打包与切块以最大化吞吐量并减少 BRAM 使用。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。