Abstract
Numerous techniques have been meticulously designed to achieve optimal architectures for convolutional neural networks (CNNs), yet a comparable focus on vision transformers (ViTs) has been somewhat lacking. Despite the remarkable success of ViTs in various vision tasks, their heavyweight nature presents challenges of computational costs. In this paper, we leverage the Gaussian process to systematically explore the nonlinear and uncertain relationship between performance and global architecture factors of MobileViT, such as resolution, width, and depth including the depth of inverted residual blocks and the depth of ViT blocks, and joint factors including resolution-depth and resolution-width. We present design principles twisting magic 4D cube of the global architecture factors that minimize model sizes and computational costs with higher model accuracy. We introduce a formula for downsizing architectures by iteratively deriving smaller MobileViT V2, all while adhering to a specified constraint of multiply-accumulate operations (MACs). Experiment results show that our formula significantly outperforms CNNs and mobile ViTs across diversified datasets.
Introduction
Vision Transformers (ViTs) have revolutionized computer vision, but they are notoriously "heavyweight" compared to traditional Convolutional Neural Networks (CNNs). While models like MobileViT were designed specifically for edge devices, optimizing their "global architecture factors"—such as input resolution, network width, and the depth of different block types—remains a massive challenge.
The relationship between these factors and final model performance is non-linear and full of uncertainty. Traditionally, researchers rely on manual tuning or expensive Neural Architecture Search (NAS). This research addresses the need for a more systematic, efficient way to "downsize" these models without sacrificing the accuracy that makes Transformers attractive.
Methods: The Magic 4D Cube and GP Modeling
The authors propose a framework that leverages Gaussian Processes (GPs) to navigate the design space of MobileViT V2. The core of this approach is the identification of four key architecture factors, referred to as the "Magic 4D Cube":
- $r$ (Resolution): The size of the input image.
- $d_i$ (Depth of Inverted Residual blocks): The CNN-like portion of the model (MV2 blocks).
- $d_m$ (Depth of MobileViT blocks): The Transformer-based portion.
- $w$ (Width): The dimensionality of embeddings and channels.
Instead of training thousands of models (as in traditional NAS), the researchers train a smaller subset and use GP regression to "fit" the performance landscape. This allows them to predict how changing one factor (like width) affects the optimal setting for another (like resolution). The Transformer blocks themselves follow a standard encoder structure, but their placement and frequency within the global architecture are what the GP seeks to optimize.
Following the GP modeling, the researchers use the NSGA-III algorithm to find the "Pareto front"—the set of models that offer the best possible accuracy for a given computational budget, measured in MACs (Multiply-Accumulate operations). Based on these results, they derived a formula to recommend the ideal architecture configuration for any specific target MAC constraint.
Key Insights
- Resolution and Width Reign Supreme: One of the most significant findings is that for MobileViT, resolution and width are more critical than depth. While adding layers (depth) eventually hits diminishing returns, adjusting resolution and width provides a more reliable path to higher accuracy.
- The "Twisting" Effect: The factors are deeply coupled. For example, the joint impact of resolution and width is non-linear; the GP successfully captures these "twists" in the 4D cube that manual tuning often misses.
- Efficiency over Complexity: The study reveals that MobileViT doesn't actually require many layers to perform well. Shallower models with optimized resolution and width often outperform deeper, more complex ones.
Experimental Results
The optimized "shrunken" models consistently outperformed baselines across several benchmarks:
- ImageNet-100: The optimized MobileViT V2 achieved 83.21% Top-1 accuracy with only 13.69M parameters, compared to the baseline which scored 82.36% with 17.43M parameters.
- Superiority over CNNs: On CIFAR-10, the model reached 90.51% accuracy, outperforming MobileNetV1, V2, and V3.
- Real-world Latency: When tested on an iPhone 12, the optimized model reduced inference latency to 4.27ms (down from 4.58ms) while maintaining higher accuracy.
- Fine-grained Tasks: On the CUB_200_2011 dataset, the model achieved 64.43% Top-1 accuracy, outperforming specialized efficient models like EfficientFormer and EdgeViT.
Conclusion
By treating architecture optimization as a Gaussian Process problem, this research provides a clear roadmap for downsizing Vision Transformers. The resulting formula allows developers to create highly efficient models that maintain the performance benefits of attention mechanisms while fitting within the strict computational constraints of mobile and edge hardware.
Summary updated