[论文解读] Rethinking Vision Transformers for MobileNet Size and Speed
EfficientFormerV2 证明了在移动设备上,视觉 Transformer 可以在与 MobileNet 相当的规模和速度下工作,同时通过对模型大小与延迟进行细粒度、延迟感知的架构搜索实现更高的准确性。
With the success of Vision Transformers (ViTs) in computer vision tasks, recent arts try to optimize the performance and complexity of ViTs to enable efficient deployment on mobile devices. Multiple approaches are proposed to accelerate attention mechanism, improve inefficient designs, or incorporate mobile-friendly lightweight convolutions to form hybrid architectures. However, ViT and its variants still have higher latency or considerably more parameters than lightweight CNNs, even true for the years-old MobileNet. In practice, latency and size are both crucial for efficient deployment on resource-constraint hardware. In this work, we investigate a central question, can transformer models run as fast as MobileNet and maintain a similar size? We revisit the design choices of ViTs and propose a novel supernet with low latency and high parameter efficiency. We further introduce a novel fine-grained joint search strategy for transformer models that can find efficient architectures by optimizing latency and number of parameters simultaneously. The proposed models, EfficientFormerV2, achieve 3.5% higher top-1 accuracy than MobileNetV2 on ImageNet-1K with similar latency and parameters. This work demonstrate that properly designed and optimized vision transformers can achieve high performance even with MobileNet-level size and speed.
研究动机与目标
- 激发并解决 ViT 在移动部署中过于庞大或过慢而难以落地的现实性差距。
- 设计参数量和延迟与 MobileNet 系列相当、适用于移动端的 ViT 骨干网络。
- 提出一种粒度更细的联合搜索策略,优化模型大小与推理速度。
- 在 ImageNet-1K 上展示帕累托最优架构,并在检测和分割等下游任务上进行验证。
提出的方法
- 引入具备四阶段分层骨干结构的 EfficientFormerV2。
- 用包含深度卷积以实现局部性的新型统一 FFN 替换残差局部 token 混合器。
- 探索 MHSA 的改进,包括在 V 中引入本地信息和 Talking Head 连接。
- 通过 Stride Attention 和 Dual-Path Attention Downsampling 实现更高分辨率的注意力,以在准确性和延迟之间取得平衡。
- 提出移动效率分数(MES),将准确性、模型大小和延迟结合起来驱动联合搜索。
- 构建一个可搜索的超网络,具有弹性深度、宽度和 FFN 展开比,并使用一组可优化 MES 与准确性的动作来进行基于评估的 NAS。

实验结果
研究问题
- RQ1是否可以设计出在不牺牲准确性的前提下,达到 MobileNet 级别的尺寸和速度的视觉 Transformer?
- RQ2哪些架构变更能够使移动端友好的 ViT 在真实设备上实现具有竞争力的延迟?
- RQ3NAS 如何在 ViT 的模型大小与延迟之间实现联合优化,以获得帕累托最优的权衡?
- RQ4EfficientFormerV2 的变体是否在下游任务(如检测和分割)上带来改进?
主要发现
- EfficientFormerV2-S0 在 ImageNet-1K 上实现与 MobileNetV2 相近的延迟和参数量下更高的 top-1 准确率。
- EfficientFormerV2-S1 大约比 EfficientFormer-L1 小 2 倍,速度快 1.3 倍,同时保持类似性能。
- EfficientFormerV2-S2 在准确性上超过多个人友好基线,且延迟相当。
- 使用 EfficientFormerV2 骨干时,COCO 的 Mask R-CNN 和 ADE20K 的语义分割等下游任务显示出改进。
- 基于 MES 的联合搜索得到的帕累托最优模型在尺寸、延迟与准确性之间的平衡优于单一指标优化。
- 提出的 Stride Attention 与 Dual-Path Attention Downsampling 在显著降低延迟的同时保留了准确性提升。
![Figure 2: Network architectures. We consider three metrics, i.e. , model performance, size, and inference speed, and study the models that improve any metric without hurting others. (a) Network of EfficientFormer [ 47 ] that serves as a baseline model. (b) Unified FFN (Sec. 3.1 ). (c) MHSA improveme](https://ar5iv.labs.arxiv.org/html/2212.08059/assets/x2.png)
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。