An Experimental Study on Exploring Strong Lightweight Vision Transformers via Masked Image Modeling Pre-training

Jin Gao, Shubo Lin, Shaoru Wang, Yutong Kou, Zeming Li, Liang Li, Congxuan Zhang, Xiaoqin Zhang, Yizheng Wang, Weiming Hu

TL;DR

This paper investigates why Masked Image Modeling (MIM) pre-training, highly successful for large Vision Transformers (ViTs), underperforms on lightweight ViTs. They discover MIM struggles to learn high-level semantics in later layers for lightweight models, leading to poor transferability on data-scarce tasks. To address this, they propose a knowledge distillation strategy that leverages larger pre-trained ViTs to guide lightweight models, achieving state-of-the-art results on various downstream tasks.

What Problem Does This Paper Address?

Large-scale Vision Transformers (ViTs) have shown remarkable performance, largely due to self-supervised pre-training methods like Masked Image Modeling (MIM). However, the benefits of MIM pre-training for lightweight ViTs, crucial for deployment on resource-constrained devices, remain underexplored. While MIM excels for large models, this paper questions if the same holds true for their smaller counterparts. They observe a performance gap and investigate the underlying reasons, aiming to unlock the full potential of MIM for efficient ViT architectures.

Methods

The authors employ an "observation-analysis-solution" framework.

  1. Observation: They adapt and benchmark various popular MIM and contrastive learning (CL) pre-training methods on lightweight ViTs (specifically ViT-Tiny).
  2. Analysis: They delve into the learned representations and attention maps of these models. Key techniques include:
  3. Linear Probing: Evaluating frozen features to assess representational quality.
  4. Layer-wise Representation Analysis: Using Centered Kernel Alignment (CKA) to compare representations across layers and with a supervised baseline.
  5. Attention Map Analysis: Quantifying attention distance and entropy to understand local vs. global attention patterns.
  6. Solution: Based on their findings, they propose a decoupled distillation strategy. This involves using a larger, pre-trained ViT-Base model (teacher) to guide the MIM pre-training of a lightweight ViT-Tiny (student). The distillation focuses on transferring knowledge from higher layers, specifically through attention maps and intermediate layer representations, while decoupling it from the reconstruction task.

Datasets

  • Pre-training: ImageNet-1K (IN1K) and ImageNet-21K (IN21K) were used for self-supervised and supervised pre-training.
  • Downstream Tasks:
    • Classification: Flowers-102, Oxford-IIIT Pets, FGVC-Aircraft, Stanford Cars, CIFAR100, iNaturalist 2018.
  • Dense Prediction: COCO (object detection and segmentation), ADE20K (semantic segmentation), LaSOT (visual tracking).

Key Insights and Ideas

  • MIM's High-Layer Struggle: MIM pre-training, unlike CL, struggles to learn high-level semantic information in the later layers of lightweight ViTs. This leads to inferior performance on data-scarce downstream tasks where these higher-level features are crucial.
  • Locality Inductive Bias: MIM pre-training, particularly MAE, tends to instill a strong "locality inductive bias," making attention more focused on local image regions. This benefits data-rich tasks like ImageNet classification but can be detrimental for tasks requiring broader contextual understanding.
  • Lower Layers Matter for Data-Rich Tasks: For data-sufficient tasks like ImageNet, preserving the lower layers of MIM pre-trained models provides significant performance gains, even if higher layers are randomly initialized.
  • Higher Layers Matter for Data-Scarce Tasks: Conversely, for data-insufficient tasks, the quality of higher-layer representations becomes more critical.
  • Distillation as a Bridge: Knowledge distillation from larger, well-trained ViTs can effectively transfer the desired high-level semantic knowledge to lightweight ViTs, bridging the performance gap.
  • Attention Distillation Superiority: Distilling attention maps from higher layers of a teacher model proves more effective than distilling intermediate representations for improving lightweight ViT performance.
  • Decoupled Distillation: Separating the distillation task from the reconstruction task in MIM pre-training (D2-MAE) further refines the process, leading to improved attention patterns and overall performance.

Key Results

  • ImageNet-1K: The proposed D2-MAE pre-training on ViT-Tiny achieves 79.4% top-1 accuracy, comparable to SOTA lightweight models with sophisticated architectures.
  • ADE20K Segmentation: Achieves SOTA performance with 42.8% mIoU.
  • LaSOT Tracking: Achieves SOTA performance with 66.1% AUC, surpassing all current SOTA lightweight CPU-realtime trackers.
  • COCO Detection/Segmentation: D2-MAE pre-trained Hiera-Tiny outperforms other lightweight models.
  • Data Efficiency: The proposed methods show robustness to reduced pre-training data size and class distribution.

Limitations and Future Work

  • Model Size Bottleneck: The paper suggests that the limited capacity of lightweight ViTs inherently bottlenecks the representation quality achievable through MIM pre-training, even with large datasets.
  • Future Work: The authors' approach of using a larger teacher model for distillation opens avenues for exploring more advanced distillation techniques and applying this methodology to a wider range of lightweight architectures. The success of their observation-analysis-solution framework suggests its applicability to other self-supervised learning paradigms for efficient models.

Summary updated

BibTeX
@article{gao2025experimental,
  author = {Jin Gao and Shubo Lin and Shaoru Wang and Yutong Kou and Zeming Li and Liang Li and Congxuan Zhang and Xiaoqin Zhang and Yizheng Wang and Weiming Hu},
  title = {{An Experimental Study on Exploring Strong Lightweight Vision Transformers via Masked Image Modeling Pre-training}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  doi = {10.1007/s11263-024-02327-w},
}
Figure