Skip to main content
QUICK REVIEW

[Paper Review] CAS-ViT: Convolutional Additive Self-attention Vision Transformers for Efficient Mobile Applications

Tianfang Zhang, Lei Li|arXiv (Cornell University)|Aug 7, 2024
Advanced Neural Network ApplicationsComputer Science17 citations
TL;DR

CAS-ViT proposes a Convolutional Additive Token Mixer (CATM) to replace standard self-attention, achieving competitive accuracy with linear complexity suitable for mobile and edge devices. It evaluates on classification, detection, and segmentation across GPUs, ONNX, and iPhone deployments.

ABSTRACT

Vision Transformers (ViTs) mark a revolutionary advance in neural networks with their token mixer's powerful global context capability. However, the pairwise token affinity and complex matrix operations limit its deployment on resource-constrained scenarios and real-time applications, such as mobile devices, although considerable efforts have been made in previous works. In this paper, we introduce CAS-ViT: Convolutional Additive Self-attention Vision Transformers, to achieve a balance between efficiency and performance in mobile applications. Firstly, we argue that the capability of token mixers to obtain global contextual information hinges on multiple information interactions, such as spatial and channel domains. Subsequently, we propose Convolutional Additive Token Mixer (CATM) employing underlying spatial and channel attention as novel interaction forms. This module eliminates troublesome complex operations such as matrix multiplication and Softmax. We introduce Convolutional Additive Self-attention(CAS) block hybrid architecture and utilize CATM for each block. And further, we build a family of lightweight networks, which can be easily extended to various downstream tasks. Finally, we evaluate CAS-ViT across a variety of vision tasks, including image classification, object detection, instance segmentation, and semantic segmentation. Our M and T model achieves 83.0\%/84.1\% top-1 with only 12M/21M parameters on ImageNet-1K. Meanwhile, throughput evaluations on GPUs, ONNX, and iPhones also demonstrate superior results compared to other state-of-the-art backbones. Extensive experiments demonstrate that our approach achieves a better balance of performance, efficient inference and easy-to-deploy. Our code and model are available at: \url{https://github.com/Tianfang-Zhang/CAS-ViT}

Motivation & Objective

  • Motivate efficient token mixers for Vision Transformers (ViTs) in resource-constrained/mobile scenarios.
  • Propose a Convolutional Additive Token Mixer (CATM) that enables linear-complexity attention via convolutional operations.
  • Demonstrate CAS-ViT's competitive accuracy and deployment efficiency across classification, detection, instance segmentation, and semantic segmentation tasks.
  • Show practicality by evaluating throughput on GPUs, ONNX, and iPhone deployments.

Proposed method

  • Define a novel additive similarity function Sim(Q,K) = Phi(Q) + Phi(K) where Phi combines spatial and channel interactions.
  • Implement Convolutional Additive Token Mixer (CATM) using depthwise conv + Sigmoid spatial attention and simplified channel attention.
  • Build CAS-ViT as a lightweight ViT with four stages and CATM-based blocks across layers, plus an integration subnet and MLP with residuals.
  • Analyze computational complexity to achieve overall linear complexity with respect to input size (Omega(CATM) ~ (47+10b)HWC).
  • Provide training from scratch on ImageNet-1K, followed by downstream tasks and mobile deployment via CoreML and ONNX.
Figure 1: Flops v.s. Top-1 accuracy on ImageNet-1K (Deng et al. 2009 ) . The circle size indicates parameter number and best viewed in color.
Figure 1: Flops v.s. Top-1 accuracy on ImageNet-1K (Deng et al. 2009 ) . The circle size indicates parameter number and best viewed in color.

Experimental results

Research questions

  • RQ1Can a convolution-based additive attention mechanism achieve competitive ViT performance with linear-time complexity for mobile deployments?
  • RQ2How does integrating spatial and channel interactions in an additive similarity influence accuracy and efficiency across vision tasks?
  • RQ3What are the throughput and accuracy trade-offs of CAS-ViT on GPUs, ONNX, and iPhone hardware?
  • RQ4How does CAS-ViT perform on detection, instance segmentation, and semantic segmentation compared to state-of-the-art backbones?

Key findings

  • CAS-ViT variants achieve competitive Top-1 accuracy with comparatively low parameters and FLOPs on ImageNet-1K.
  • CATM maintains linear complexity and avoids Softmax-based heavy computations while incorporating spatial and channel interactions.
  • In object detection/instance segmentation, CAS-ViT backbones (e.g., CAS-ViT-S/M) show better AP metrics with similar or lower FLOPs than several baselines.
  • Semantic segmentation on ADE20K shows CAS-ViT-M achieving 43.6% mIoU with relatively low FLOPs.
  • Throughput analyses on GPU, ONNX, and Apple Neural Engine demonstrate practical mobile deployment potential.
Figure 2: Comparison of diverse self-attention mechanisms. (a) is the classical multi-head self-attention in ViT (Dosovitskiy et al. 2020 ) . (b) is the separable self-attention in MobileViTv2 (Mehta and Rastegari 2022 ) , which reduces the feature metric of a matrix to a vector. (c) is the swift se
Figure 2: Comparison of diverse self-attention mechanisms. (a) is the classical multi-head self-attention in ViT (Dosovitskiy et al. 2020 ) . (b) is the separable self-attention in MobileViTv2 (Mehta and Rastegari 2022 ) , which reduces the feature metric of a matrix to a vector. (c) is the swift se

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.