Skip to main content
QUICK REVIEW

[Paper Review] FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization

Pavan Kumar Anasosalu Vasu, James Gabriel|arXiv (Cornell University)|Mar 24, 2023
Advanced Neural Network ApplicationsComputer Science45 citations
TL;DR

FastViT introduces RepMixer, a reparameterizable token mixer for a fast hybrid vision transformer, achieving superior latency-accuracy trade-offs across mobile and GPU platforms while supporting multiple vision tasks.

ABSTRACT

The recent amalgamation of transformer and convolutional designs has led to steady improvements in accuracy and efficiency of the models. In this work, we introduce FastViT, a hybrid vision transformer architecture that obtains the state-of-the-art latency-accuracy trade-off. To this end, we introduce a novel token mixing operator, RepMixer, a building block of FastViT, that uses structural reparameterization to lower the memory access cost by removing skip-connections in the network. We further apply train-time overparametrization and large kernel convolutions to boost accuracy and empirically show that these choices have minimal effect on latency. We show that - our model is 3.5x faster than CMT, a recent state-of-the-art hybrid transformer architecture, 4.9x faster than EfficientNet, and 1.9x faster than ConvNeXt on a mobile device for the same accuracy on the ImageNet dataset. At similar latency, our model obtains 4.2% better Top-1 accuracy on ImageNet than MobileOne. Our model consistently outperforms competing architectures across several tasks -- image classification, detection, segmentation and 3D mesh regression with significant improvement in latency on both a mobile device and a desktop GPU. Furthermore, our model is highly robust to out-of-distribution samples and corruptions, improving over competing robust models. Code and models are available at https://github.com/apple/ml-fastvit.

Motivation & Objective

  • Motivate efficient vision models that balance accuracy and latency on mobile devices and desktops.
  • Develop a hybrid architecture that leverages convolutional and transformer strengths.
  • Reduce memory access costs via structural reparameterization of skip connections.
  • Increase model capacity without latency penalties using train-time overparameterization and large kernels.
  • Demonstrate robustness and generalization across tasks like classification, detection, segmentation, and 3D hand mesh estimation.

Proposed method

  • Introduce RepMixer, a token mixer that removes skip-connections and is reparameterizable at inference.
  • Replace dense k×k convolutions with factorized depthwise followed by pointwise convolutions, aided by linear train-time overparameterization.
  • Incorporate large kernel convolutions in FFN and patch embedding layers to substitute early self-attention.
  • Use conditional positional encodings generated by depthwise convolutions.
  • Train with overparameterization in stem, patch embedding, and projection layers to boost capacity.

Experimental results

Research questions

  • RQ1Can a reparameterizable token mixer reduce memory access cost and latency without sacrificing accuracy?
  • RQ2Does linear train-time overparameterization improve accuracy under factorized convolutional designs?
  • RQ3Do large kernel convolutions in early stages provide a latency-friendly accuracy boost compared to self-attention in hybrid architectures?
  • RQ4How does FastViT perform across image classification, detection, segmentation, and 3D hand mesh estimation under real-world latency constraints?
  • RQ5Is the model robust to corruption and out-of-distribution inputs relative to competing architectures?

Key findings

  • FastViT achieves superior latency-accuracy trade-offs on mobile (iPhone 12 Pro) and desktop GPU (RTX-2080Ti) while maintaining competitive accuracy.
  • FastViT-S12 at 83.9% top-1 on ImageNet-1k is 4.9× faster than EfficientNet-B5 and 1.9× faster than ConvNeXt-B at similar FLOPs on mobile, and 1.6× faster than EfficientNetV2-S on GPU.
  • FastViT-S12 is 26.3% faster than MobileOne-S4 on iPhone and 26.9% faster on GPU at comparable accuracy; FastViT-MA36 matches or surpasses several state-of-the-art models with reduced parameters and FLOPs.
  • RepMixer reduces memory access cost by removing skip connections, delivering lower latency especially at higher input resolutions (e.g., 384×384 and 1024×1024).
  • Train-time overparameterization in stem, patch embedding, and projection layers yields accuracy gains (e.g., up to 0.9% Top-1 on ImageNet) with modest training time overhead.
  • Large kernel convolutions in FFN and patch embedding layers provide robustness and accuracy gains with modest latency impact.

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.