arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2408.08437cs.CVcs.AI
收藏

PQV-Mobile:面向移动应用优化视觉Transformer的剪枝与量化组合工具包

PQV-Mobile: A Combined Pruning and Quantization Toolkit to Optimize Vision Transformers for Mobile Applications

Lawrence Livermore National Lab(劳伦斯利弗莫尔国家实验室)

Kshitij Bhardwaj

AI总结:

针对视觉Transformer内存占用高、难以在移动端部署的问题,本文提出开源工具PQV-Mobile,结合多种结构化剪枝与多精度量化方法优化模型,在DeiT模型上实现7.18倍延迟降低与仅2.24%的精度损失。

摘要:

尽管视觉Transformer(ViTs)在计算机视觉任务中表现极为出色,正取代卷积神经网络成为新的最优模型,但它们结构复杂且内存占用高。为了在资源受限的移动/边缘系统上有效运行这些模型,不仅需要对模型进行压缩,还需对其优化并转换为便于部署的格式。为此,本文提出了一款名为PQV-Mobile的剪枝与量化组合工具,用于面向移动应用优化视觉Transformer。该工具支持基于幅值重要性、泰勒重要性和黑塞(Hessian)重要性的不同类型结构化剪枝,还支持从FP32到FP16及int8的量化,可适配不同的移动硬件后端。我们使用Facebook Data Efficient Image Transformer(DeiT,数据高效图像Transformer)模型验证了工具的性能,展示了不同剪枝比例和int8量化下延迟-内存-精度的重要权衡关系。结果表明,即使将DeiT模型剪枝9.375%并从FP32量化为int8,再针对移动应用进行优化后,延迟可降低7.18倍,而精度损失仅为2.24%。该工具为开源项目。

英文摘要:

While Vision Transformers (ViTs) are extremely effective at computer vision tasks and are replacing convolutional neural networks as the new state-of-the-art, they are complex and memory-intensive models. In order to effectively run these models on resource-constrained mobile/edge systems, there is a need to not only compress these models but also to optimize them and convert them into deployment-friendly formats. To this end, this paper presents a combined pruning and quantization tool, called PQV-Mobile, to optimize vision transformers for mobile applications. The tool is able to support different types of structured pruning based on magnitude importance, Taylor importance, and Hessian importance. It also supports quantization from FP32 to FP16 and int8, targeting different mobile hardware backends. We demonstrate the capabilities of our tool and show important latency-memory-accuracy trade-offs for different amounts of pruning and int8 quantization with Facebook Data Efficient Image Transformer (DeiT) models. Our results show that even pruning a DeiT model by 9.375% and quantizing it to int8 from FP32 followed by optimizing for mobile applications, we find a latency reduction by 7.18X with a small accuracy loss of 2.24%. The tool is open source.

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

↑