Exploring and Improving Mobile Level Vision Transformers

Pengguang Chen, Yixin Chen, Shu Liu, Ming-Chang Yang, Jiaya JiaarXiv 2021

Abstract

Vision Transformers (ViTs) have set new benchmarks in computer vision, yet they suffer from a dramatic performance collapse when scaled down to mobile-level computational budgets. This study identifies two critical bottlenecks in small-scale ViTs: the loss of low-level information during crude patch embedding and the inefficiency of the [CLS] token in shallow architectures. We introduce two lightweight components—Irregular Patch Embedding (IPE) and Adaptive Patch Merging (APM)—which revitalize standard ViT blocks for low-resource settings. Our proposed model achieves 78.6% Top-1 accuracy on ImageNet at 900M FLOPs, outperforming the DeiT baseline by 9.2%.

Introduction

While large-scale Vision Transformers achieve state-of-the-art results, their efficiency drops precipitously at low FLOP counts. For instance, reducing the FLOPs of a DeiT-Base model by 75% to create DeiT-Small results in only a 2% accuracy loss, whereas a similar reduction from DeiT-Small to DeiT-Tiny leads to a massive 7% drop. This "performance cliff" suggests that standard ViT architectures are inherently optimized for large-scale regimes. This paper investigates the underlying causes and proposes structural improvements to make ViTs competitive on mobile devices.

Proposed Methodology

The authors identify that standard ViTs struggle with "crude" linear patch embeddings that discard vital low-level spatial information in narrow-channel models. Furthermore, the [CLS] token, which aggregates global information through successive attention layers, fails in shallow networks where there are insufficient layers to "collect" necessary data.

Overview of the proposed architecture featuring Irregular Patch Embedding (IPE) and Adaptive Patch Merging (APM).

Irregular Patch Embedding (IPE)

Instead of a single linear projection, IPE utilizes a series of lightweight depth-wise and point-wise convolutions. It generates patches with varying receptive fields ($7 \times 7$, $4 \times 4$, and $1 \times 1$) which are then concatenated. This "pre-digests" raw pixels into high-quality tokens containing multi-scale information, better suited for the high-level processing capabilities of Transformer blocks. By producing fewer but higher-quality patches (66 vs the standard 196), the model maintains efficiency without sacrificing representational power.

Adaptive Patch Merging (APM)

To bypass the [CLS] token bottleneck, APM replaces it with a weighted merging module. It computes a final feature vector as a weighted sum of all patches. These weights are derived from two sources: a learned Global Weight and an Adaptive Weight generated dynamically by an MLP based on the specific input image. This ensures the model focuses on salient regions regardless of network depth, solving the aggregation problem inherent in shallow mobile models.

Experimental Results

The proposed modifications were evaluated on ImageNet-1K, CIFAR, and iNaturalist datasets. The results demonstrate a significant shift in the accuracy-FLOPs trade-off curve compared to existing architectures.

Accuracy vs. FLOPs comparison showing our method significantly outperforming DeiT, Swin, and CoaT across mobile-level budgets.

In the 900M FLOPs range, the model achieved 78.6% Top-1 accuracy, surpassing the DeiT baseline by 9.2% and beating other architectures like Swin and CoaT. The gains were even more pronounced at the 300M FLOPs level, where the model outperformed DeiT by 16.5% (71.3% vs 54.8%). Visualization of the APM module confirms that the model successfully learns to ignore background noise and focus attention weights on the primary objects in the image.

Conclusion

By addressing the information loss in early layers and the aggregation bottleneck in final layers, this work demonstrates that Vision Transformers can be highly competitive at mobile scales. The IPE and APM modules provide a "back-to-basics" enhancement that allows standard Transformer blocks to excel without requiring complex specialized architectures. Future work will explore hardware-specific optimizations and neural architecture search to further refine these mobile-level transformers.

Summary updated

BibTeX
@misc{chen2021exploring,
  author = {Pengguang Chen and Yixin Chen and Shu Liu and Ming-Chang Yang and Jiaya Jia},
  title = {{Exploring and Improving Mobile Level Vision Transformers}},
  year = {2021},
  eprint = {2108.13015},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.13015},
}
Figure