TL;DR
This paper introduces EdgeViTs, a new family of lightweight Vision Transformers (ViTs) designed to compete with efficient Convolutional Neural Networks (CNNs) on mobile devices. By proposing a novel Local-Global-Local (LGL) bottleneck that efficiently integrates self-attention and convolutions, EdgeViTs achieve a superior accuracy-efficiency tradeoff, outperforming existing ViTs and rivaling the best CNNs in terms of on-device latency and energy consumption.
What Problem Does This Paper Address?
Vision Transformers (ViTs) have shown remarkable success in computer vision tasks, often surpassing traditional Convolutional Neural Networks (CNNs). However, the inherent quadratic complexity of the self-attention mechanism makes standard ViTs computationally expensive and memory-intensive, rendering them unsuitable for resource-constrained mobile and edge devices. While some efforts have been made to create lighter ViTs by incorporating CNN-like hierarchical structures, these have not yet closed the performance gap with state-of-the-art efficient CNNs like MobileNets and EfficientNets. This paper addresses the critical need for ViTs that can achieve competitive accuracy while maintaining low latency and energy consumption on mobile hardware.
Methods
The core innovation of this work is the Local-Global-Local (LGL) bottleneck, a novel module designed to decompose and optimize the self-attention mechanism for efficiency. The LGL bottleneck consists of three key operations:
- Local Aggregation: Efficient depth-wise convolutions are used to aggregate information from neighboring image patches, leveraging the spatial redundancy in visual data.
- Global Sparse Attention: Instead of applying self-attention to all tokens, a sparse set of "delegate" tokens is selected and used for long-range information exchange via self-attention. This significantly reduces computational cost.
- Local Propagation: Transposed convolutions are employed to diffuse the global contextual information learned by the delegate tokens back to their local neighbors.
This LGL bottleneck is integrated into a hierarchical pyramid network structure, similar to recent ViT designs, to progressively reduce spatial resolution and increase channel dimensions across stages. The authors also emphasize the importance of direct on-device evaluation (latency and energy) over proxies like FLOPs or parameter counts.
Datasets
- ImageNet-1K: Used for pre-training and evaluating image classification performance.
- COCO: Used for evaluating object detection and instance segmentation.
- ADE20K: Used for evaluating semantic segmentation.
The paper does not introduce new benchmarks but focuses on evaluating existing models on these standard datasets with a strong emphasis on on-device metrics.
Key Insights and Ideas
- Decomposing Self-Attention is Key: The paper demonstrates that by breaking down the self-attention mechanism into local aggregation, sparse global attention, and local propagation, significant computational savings can be achieved without sacrificing performance.
- Sparse Attention for Efficiency: Applying self-attention only to a subset of "delegate" tokens is a highly effective strategy for reducing the computational burden of ViTs, especially on mobile devices.
- On-Device Metrics Matter Most: The authors strongly advocate for using direct on-device latency and energy consumption measurements, arguing that FLOPs and parameter counts are insufficient proxies for real-world efficiency.
- ViTs Can Compete with CNNs on Mobile: EdgeViTs show that ViTs can indeed achieve a competitive accuracy-efficiency tradeoff with the best lightweight CNNs, marking a significant step towards deploying advanced attention-based models on edge devices.
- Pareto Optimality is the Goal: The research highlights the importance of identifying Pareto-optimal models, where no improvement in one metric (accuracy, latency, energy) can be made without degrading another. EdgeViTs consistently achieve this.
Key Results
- ImageNet Classification: EdgeViTs achieve state-of-the-art accuracy-efficiency tradeoffs, outperforming existing lightweight ViTs and competing with efficient CNNs like MobileNetV3 and EfficientNet-B0. For instance, EdgeViT-XXS achieves a 2.4% gain over MobileNetV2 with comparable or slightly faster latency.
- On-Device Performance: EdgeViTs are shown to be Pareto-optimal in both accuracy-latency and accuracy-energy trade-offs on ImageNet-1K, significantly outperforming other ViTs and rivaling efficient CNNs.
- Detection and Segmentation: EdgeViTs, when used as backbones for object detection (RetinaNet, Mask R-CNN) and semantic segmentation (Semantic FPN), demonstrate superior efficiency compared to baselines, achieving higher AP and mIoU scores at similar or lower computational costs. For example, EdgeViT-XXS achieves 1.5 higher AP than PVTv2-B0 on RetinaNet.
Limitations and Future Work
- Comparison with Auto-Searched Models: The authors note that their models could potentially benefit from automatic architecture search techniques, similar to those used in EfficientNet, to further optimize performance.
- Further Exploration of LGL Bottleneck: While the LGL bottleneck is shown to be effective, further research could explore variations in delegate token sampling strategies and kernel sizes for even greater optimization.
- Broader Task and Hardware Evaluation: While the paper covers key tasks and mobile hardware, future work could involve evaluating EdgeViTs on a wider range of downstream tasks and diverse hardware platforms to assess their generalizability.
Summary updated