Longer-range Contextualized Masked Autoencoder

Taekyung Kim, Sanghyuk Chun, Byeongho Heo, Dongyoon Han

Abstract

Masked image modeling (MIM) has become a leading self-supervised learning strategy. MIMs such as Masked Autoencoder (MAE) learn strong representations by randomly masking input tokens for the encoder to process, with the decoder reconstructing the masked tokens to the input. However, MIM pre-trained encoders often exhibit a limited attention span, attributed to MIM's sole focus on regressing masked tokens only, which may impede the encoder's broader context learning. To tackle the limitation, we improve MIM by explicitly incorporating unmasked tokens into the training process. Specifically, our method enables the encoder to learn from broader context supervision, allowing unmasked tokens to experience broader contexts while the decoder reconstructs masked tokens. Thus, the encoded unmasked tokens are equipped with extensive contextual information, empowering masked tokens to leverage the enhanced unmasked tokens for MIM. As a result, our simple remedy trains more discriminative representations revealed by achieving 84.2% top-1 accuracy with ViT-B on ImageNet-1K with 0.6%p gain. We attribute the success to the enhanced pre-training method, as evidenced by the singular value spectrum and attention analyses. Finally, our models achieve significant performance gains at the downstream semantic segmentation and fine-grained visual classification tasks; and on diverse robust evaluation metrics.

Introduction: The Local Attention Trap

Masked Image Modeling (MIM), exemplified by frameworks like Masked Autoencoder (MAE), has established itself as a premier self-supervised learning paradigm in computer vision. By masking a significant portion (typically 75%) of an image and tasking the model with reconstructing the missing pixels, these models learn robust features.

However, a critical limitation has emerged: local dependency. Because the standard MIM objective focuses exclusively on reconstructing missing pixels from their immediate neighbors, the resulting encoders often develop a narrow attention span. They excel at local texture and color estimation but struggle to grasp the global structure or broader context of an image. This "local attention trap" can hinder performance on complex downstream tasks like semantic segmentation or fine-grained classification where global context is paramount.

Methodology: Learning with Unmasked Tokens (LUT)

To address this, we propose Learning with Unmasked Tokens (LUT). While standard MAE focuses on the masked tokens, LUT argues that the unmasked tokens (the visible 25%) should be explicitly supervised to capture global context.

The LUT architecture utilizes a dual-encoder setup to align sparse local views with global contextual representations.

As shown in the architecture above, LUT employs a dual-encoder strategy:

  1. Dual-Encoder Architecture: An "online" encoder processes the typical sparse, masked image ($U_r$). Simultaneously, a "context" encoder (a momentum-updated version of the online encoder) receives a complete, augmented global view ($V$) of the same image.
  2. Broader Contextualization Loss ($\mathcal{L}_{BC}$): Beyond the standard reconstruction loss ($L_{MIM}$), LUT introduces a second objective. It matches the aggregated representation of the sparse tokens from the online encoder to the global representation produced by the context encoder using a cosine distance loss.
  3. Simple Resized Crop (SRC): We found that standard Random Resized Cropping (RRC) can disrupt the spatial alignment between sparse and global views. Switching to a simpler cropping method ensures the context remains consistent across both views.

Key Results and Analysis

LUT demonstrates significant improvements across various benchmarks and provides deeper insights into how Vision Transformers (ViTs) process information.

  • ImageNet-1K Performance: A ViT-B trained with LUT achieved 84.2% top-1 accuracy, a +0.6%p improvement over the MAE baseline. In linear probing, LUT showed a massive +2.0%p gain, indicating that the learned features are inherently more discriminative.
  • Efficiency: LUT is highly sample-efficient. A model trained for 400 epochs matches the accuracy of an MAE model trained for 1600 epochs, effectively halving the required total GPU time despite a slightly slower per-iteration speed.
  • Attention Span Visualization: Saliency map analysis confirms that LUT successfully breaks the local attention trap. While MAE often focuses on small, localized patches, LUT spreads its attention across the entire object and its relationship to the environment.
Comparison of attention maps between MAE and LUT. LUT (c) demonstrates a significantly broader and more holistic attention span compared to the localized focus of MAE (b).
  • Spectral Health: Singular value analysis reveals that LUT produces a "higher rank" feature space. This suggests the model utilizes its internal capacity more effectively, avoiding the dimensional collapse often seen in self-supervised models where many neurons become redundant.

Conclusion

Learning with Unmasked Tokens (LUT) provides a simple yet effective remedy for the limited attention span inherent in standard Masked Image Modeling. By providing explicit, global supervision for visible tokens, LUT enables ViTs to build a more holistic understanding of image structure. While future work remains to scale this approach to "Giant" architectures (ViT-G/H), the current results on ViT-L and downstream tasks like ADE20K (48.6% mIoU) demonstrate that supervising the "visible" is just as important as predicting the "hidden."

Summary updated

BibTeX
@inproceedings{kim2024longer,
  author = {Taekyung Kim and Sanghyuk Chun and Byeongho Heo and Dongyoon Han},
  title = {{Longer-range Contextualized Masked Autoencoder}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72754-2\_20},
}
Figure