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

面向动态推理的 Vision Transformer 计算与弹性

Vision Transformer Computation and Resilience for Dynamic Inference

Stanford University(斯坦福大学);NVIDIA(英伟达公司)

Kavya Sreedhar, Jason Clemons, Rangharajan Venkatesan, Stephen W. Keckler, Mark Horowitz

AI总结:

该研究分析 vision transformer 对剪枝和多缩放路径的弹性,结合 CNN 加速器实现动态推理,并在 SegFormer 与 ResNet-50 上显著降低能耗。

摘要:

用于计算机视觉任务的最先进深度学习模型基于 transformer 架构,并且常部署于实时应用。在这种场景下,每次推理可用的资源可能变化,因此能够动态调整执行,以精度换取效率是很有用的。为创建动态模型,我们利用 vision transformer 对剪枝的弹性,并在模型的不同缩放版本之间切换。令人惊讶的是,我们发现大多数 FLOPs 由卷积而非注意力产生。这些相对 FLOP 数量并不能很好地预测 GPU 性能,因为 GPU 对卷积有专门优化。一些模型具有相当强的弹性,其模型执行无需重新训练即可调整;而所有模型在重新训练替代执行路径后都能获得更好的精度。这些洞察意味着,我们可以利用 CNN 加速器和这些替代执行路径来实现高效、动态的 vision transformer 推理。分析表明,利用这类动态执行,对于 SegFormer(63 GFLOPs),无需额外训练即可节省 28% 的能耗,精度下降 1.4%;对于 ResNet-50(4 GFLOPs),通过在预训练的 Once-For-All 模型之间切换,可节省 53% 的能耗,精度下降 3.3%。

英文摘要:

State-of-the-art deep learning models for computer vision tasks are based on the transformer architecture and often deployed in real-time applications. In this scenario, the resources available for every inference can vary, so it is useful to be able to dynamically adapt execution to trade accuracy for efficiency. To create dynamic models, we leverage the resilience of vision transformers to pruning and switch between different scaled versions of a model. Surprisingly, we find that most FLOPs are generated by convolutions, not attention. These relative FLOP counts are not a good predictor of GPU performance since GPUs have special optimizations for convolutions. Some models are fairly resilient and their model execution can be adapted without retraining, while all models achieve better accuracy with retraining alternative execution paths. These insights mean that we can leverage CNN accelerators and these alternative execution paths to enable efficient and dynamic vision transformer inference. Our analysis shows that leveraging this type of dynamic execution can lead to saving 28\% of energy with a 1.4\% accuracy drop for SegFormer (63 GFLOPs), with no additional training, and 53\% of energy for ResNet-50 (4 GFLOPs) with a 3.3\% accuracy drop by switching between pretrained Once-For-All models.

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

↑