Skip to main content
QUICK REVIEW

[Paper Review] Rethinking Vision Transformers for MobileNet Size and Speed

Yanyu Li, Hu Ju|arXiv (Cornell University)|Dec 15, 2022
Advanced Neural Network ApplicationsComputer Science20 citations
TL;DR

EfficientFormerV2 demonstrates that vision transformers can match MobileNet-scale size and speed on mobile devices while achieving higher accuracy, by jointly optimizing model size and latency through a fine-grained, latency-aware architecture search.

ABSTRACT

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.

Motivation & Objective

  • Motivate and address the practicality gap where ViTs are accurate but too large or slow for mobile deployment.
  • Design mobile-friendly ViT backbones with low parameters and latency comparable to MobileNet families.
  • Propose a fine-grained joint search strategy that optimizes both model size and inference speed.
  • Demonstrate the Pareto-optimal architectures on ImageNet-1K and validate on downstream tasks like detection and segmentation.

Proposed method

  • Introduce EfficientFormerV2 with a 4-stage hierarchical backbone architecture.
  • Replace residual local token mixers with a unified FFN that includes depth-wise convolutions for locality.
  • Explore MHSA improvements including local V information in V and Talking Head connections.
  • Enable higher-resolution attention with Stride Attention and Dual-Path Attention Downsampling to balance accuracy and latency.
  • Propose a Mobile Efficiency Score (MES) combining accuracy, model size, and latency to drive joint search.
  • Construct a searchable supernet with elastic depth, width, and FFN expansion ratios, and perform evaluation-based NAS using a front of actions that optimize MES and accuracy.
Figure 1: Comparison of model size, speed, and performance (top-1 accuracy on ImageNet-1K). Latency is profiled by iPhone 12 (iOS 16). The area of each circle is proportional to the number of parameters (model size). EfficientFormerV2 achieves high performance with small model sizes and fast inferen
Figure 1: Comparison of model size, speed, and performance (top-1 accuracy on ImageNet-1K). Latency is profiled by iPhone 12 (iOS 16). The area of each circle is proportional to the number of parameters (model size). EfficientFormerV2 achieves high performance with small model sizes and fast inferen

Experimental results

Research questions

  • RQ1Can vision transformers be designed to match MobileNet-level size and speed without sacrificing accuracy?
  • RQ2What architectural changes enable mobile-friendly ViTs with competitive latency on real devices?
  • RQ3How can NAS jointly optimize model size and latency for ViTs to achieve Pareto-optimal trade-offs?
  • RQ4Do EfficientFormerV2 variants translate to improvements in downstream tasks such as detection and segmentation?

Key findings

  • EfficientFormerV2-S0 achieves higher top-1 accuracy than MobileNetV2 at similar latency and parameter counts on ImageNet-1K.
  • EfficientFormerV2-S1 is roughly 2x smaller and 1.3x faster than EfficientFormer-L1 while maintaining similar performance.
  • EfficientFormerV2-S2 outperforms several mobile-friendly baselines in accuracy with comparable latency.
  • Downstream tasks show improvements in Mask R-CNN on COCO and semantic segmentation on ADE20K when using EfficientFormerV2 backbones.
  • The joint MES-based search yields Pareto-optimal models that balance size, latency, and accuracy better than single-metric optimizations.
  • The proposed Stride Attention and Dual-Path Attention Downsampling significantly reduce latency while preserving accuracy gains.
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
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

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.