TL;DR
This paper introduces LowFormer, a novel backbone architecture for computer vision that efficiently combines convolutional and transformer components. By analyzing hardware efficiency beyond just MACs, LowFormer achieves significant speedups in throughput and latency on various devices while maintaining or improving accuracy, making it suitable for real-world applications.
What Problem Does This Paper Address?
The field of efficient vision backbones is increasingly focused on hybrid architectures that blend the strengths of convolutional neural networks (CNNs) and transformers. While these models aim to strike a balance between accuracy and computational cost, existing research often relies on Multiply-Accumulate operations (MACs) as the primary metric for efficiency. However, MACs don't fully capture real-world performance, as factors like memory access cost and parallelism significantly impact actual execution speed. This disconnect leads to architectures that might look efficient on paper but perform poorly in practice, especially on resource-constrained devices like mobile GPUs and CPUs. The paper addresses this by investigating hardware efficiency through actual throughput and latency measurements, leading to a more practical design philosophy.
Methods
The core of LowFormer's innovation lies in its hardware-aware design principles derived from extensive execution time analysis.
- Hardware-Efficient Macro Design: The authors analyzed how different architectural choices, such as resolution and channel scaling, affect hardware performance. They found that higher resolutions disproportionately slow down computations, and depthwise convolutions, while having fewer MACs, are not as hardware-efficient as standard convolutions. Based on these insights, they propose a macro design that reduces the number of layers in the early stages of the network and fuses depthwise and pointwise convolutions in MBConv blocks (up to a certain channel dimension) to improve efficiency.
- Lightweight Attention Module: To further enhance efficiency, they introduce a "LowFormer Attention" module. This module is a simplified version of the traditional Multi-Head Self-Attention (MHSA). It achieves its lightweight nature by:
- Channel Compression: Halving the channel dimension of queries, keys, and values during input projection and restoring it afterward.
- Lower Resolution Operation: Downsampling the feature maps before the attention operation, allowing the SDA (Scaled Dot-Product Attention) to run on a lower resolution. This is inspired by the finding that lower resolutions are more hardware-efficient.
Datasets
The paper evaluates LowFormer on the following datasets:
- ImageNet-1K: Used for image classification experiments.
- COCO 2017: Used for object detection tasks.
- ADE20K: Used for semantic segmentation tasks.
Key Insights and Ideas
- MACs are Misleading: The paper strongly emphasizes that MACs alone are a poor indicator of actual hardware efficiency. Factors like memory access patterns and parallelism play a crucial role, and models with more MACs can sometimes be faster if designed with hardware efficiency in mind.
- Resolution Matters More Than You Think: Higher input resolutions significantly degrade hardware efficiency, often more than an increase in channel count or MACs would suggest. This insight is critical for designing efficient models.
- Depthwise Convolutions Aren't Always Faster: Despite their lower MAC count, depthwise convolutions don't always translate to speedups on hardware due to memory access costs. Fusing them with pointwise convolutions (as in MBConv) can be more efficient.
- Attention on Lower Resolution is Viable: The LowFormer Attention module demonstrates that performing attention operations on downsampled feature maps can maintain accuracy while drastically improving speed, especially at higher input resolutions.
Key Results
LowFormer achieves impressive results across various tasks and hardware platforms:
- ImageNet-1K Classification:
- LowFormer-B0 achieves 78.4% top-1 accuracy with 2x the GPU throughput and 15% less latency compared to MobileOne-S2.
- LowFormer-B3 achieves 83.6% top-1 accuracy, offering nearly 3x the GPU throughput and 55% of the GPU latency of FAT-B3.
- LowFormer-B1r256 (tested on 256 resolution) shows a 0.8% higher top-1 accuracy than EfficientViT-B1 and a 23% higher throughput.
- Object Detection (COCO 2017):
- LowFormer-B2 outperforms FAT-B0 by +1.0 AP, with 93% higher backbone throughput on 512x512 resolution.
- Semantic Segmentation (ADE20K):
- LowFormer-B1 achieves 1.7% better mIoU than FastViT-SA12, with 3x the throughput and 30% less latency on GPU.
- Cross-Platform Efficiency: LowFormer demonstrates consistent speedups on GPU, mobile GPU, and ARM CPU, highlighting its generalizability. For instance, LowFormer-B1 shows comparable accuracy to MobileOne-S4 but with significantly lower mobile GPU and ARM CPU latency.
Limitations and Future Work
- MBConv Fusion Limit: The paper notes that fusing MBConv blocks becomes less beneficial with very high channel counts. This suggests that for extremely wide networks, the benefits of fusion might diminish.
- Attention Module Simplification: While the LowFormer Attention is efficient, the paper acknowledges that it's a simplified adaptation. Further research could explore more sophisticated lightweight attention mechanisms.
- Future Work: The authors suggest that their hardware-efficient design principles can be applied to other network architectures. They also imply that further exploration of attention mechanisms and macro-level design choices could lead to even greater efficiency gains. The generalizability of their approach to other downstream tasks is also a promising avenue.
Summary updated