Beyond masking: Demystifying token-based pre-training for vision transformers

Yunjie Tian, Lingxi Xie, Jiemin Fang, Jianbin Jiao, Qi Tian

Abstract

Masked Image Modeling (MIM) has emerged as a dominant paradigm for self-supervised pre-training of Vision Transformers (ViTs). However, the specific mechanisms that drive its success remain poorly understood. This study investigates whether masking is the optimal degradation strategy by exploring alternative tasks such as zooming, distortion, and blurring. We decompose these tasks into three core factors: Information Missing (IM), Spatial Transformation (ST), and Style Change (SC). Our findings reveal that while IM is crucial, incorporating Spatial Transformation—specifically through a "zoomed-in" task—significantly enhances representation learning. We propose an integrated pre-training objective (m+a) that combines masking with spatial misalignment, achieving superior performance on ImageNet-1K classification, COCO detection, and ADE20K segmentation while improving training efficiency.

Introduction

The advent of Masked Image Modeling (MIM), exemplified by architectures like MAE and BEiT, has revolutionized self-supervised learning for Vision Transformers. By reconstructing missing image patches, these models learn robust features that transfer well to various downstream tasks. Despite this success, it remains unclear if masking is uniquely effective or if other forms of image degradation could yield similar or better results. This research seeks to demystify the "learning by recovery" framework by systematically evaluating different degradation strategies and identifying the underlying principles that govern effective pre-training.

Methods

The authors propose a generalized "learning by recovery" framework where an input image undergoes a degradation process before being fed into an encoder-decoder architecture. The objective is to minimize the pixel-wise loss between the original input and the reconstructed output.

The learning by recovery framework and various image degradation tasks including masking, zooming, distortion, blurring, and de-colorization.

Five primary degradation tasks were investigated beyond simple masking:

  • Zoomed-in (a): The model sees a cropped, upscaled center region and must recover the full original image, including the "invisible" outer parts.
  • Zoomed-out (b): The image is downsampled and placed in a larger canvas; the model recovers the original scale.
  • Distorted (c): A fisheye effect is applied to alter spatial relationships.
  • Blurred (d): A randomized convolution blur is applied to remove high-frequency details.
  • De-colorized (e): The image is converted toward grayscale by reducing saturation.

These tasks are categorized by three factors: Information Missing (IM), Spatial Transformation (ST), and Style Change (SC). Based on initial findings, an Integrated Task (m+a) was developed, combining standard masking (m) with the zoomed-in (a) approach to maximize both IM and ST.

Results

The experimental results demonstrate that the proposed integrated task (m+a)—masking plus zooming—consistently outperforms standard masking baselines across multiple benchmarks.

Comparison of different pre-training tasks on ImageNet-1K classification accuracy, highlighting the impact of IM, ST, and SC factors.

Key findings include:

  • Superior Accuracy: The integrated (m+a) task achieved 83.2% accuracy on ImageNet-1K, surpassing the MAE baseline of 82.9%.
  • Enhanced Efficiency: The integrated approach reached 83.0% accuracy in only 100 epochs, matching the performance that standard MAE takes 300 epochs to achieve.
  • Downstream Performance: On the COCO dataset, the integrated method improved Box AP by 0.8% and Mask AP by 0.7%. Semantic segmentation on ADE20K saw a 0.6% mIoU increase.
  • Factor Analysis: Tasks involving Information Missing (IM) and Spatial Transformation (ST) were most effective. Conversely, Style Changes (SC) like blurring or de-colorization hindered performance, likely due to a domain gap between pre-training and fine-tuning data.

Discussion and Conclusion

This study demonstrates that masking is not the only effective pre-training strategy for ViTs. By introducing spatial misalignment through zooming, models can learn more robust spatial representations. However, a significant "semantic gap" remains; token-based recovery methods still underperform relative to contrastive methods (like DINO) in linear probing scenarios, suggesting they capture local features better than global semantics. Future work should explore hybrid approaches that integrate the global semantic richness of contrastive learning with the efficient, high-capacity reconstruction capabilities of token-based frameworks.

Summary updated

BibTeX
@article{tian2022beyond,
  author = {Yunjie Tian and Lingxi Xie and Jiemin Fang and Jianbin Jiao and Qi Tian},
  title = {{Beyond masking: Demystifying token-based pre-training for vision transformers}},
  journal = {Pattern Recognition},
  year = {2022},
  url = {https://openreview.net/forum?id=J21zonhmM8},
}
Figure