Contrastive Tuning: A Little Help to Make Masked Autoencoders Forget

Johannes Lehner, Benedikt Alkin, Andreas Fürst, Elisabeth Rumetshofer, Lukas Miklautz, Sepp Hochreiter · DOI

Introduction

In self-supervised learning for computer vision, two dominant paradigms have emerged: Masked Image Modeling (MIM) and Instance Discrimination (ID). MIM models, such as Masked Autoencoders (MAE), are highly efficient and scalable but tend to be "pixel-perfect," learning irrelevant background details alongside semantic features. This makes them "label-hungry" for downstream tasks. Conversely, ID models (e.g., SimCLR, MoCo) excel at object-centric abstraction but are computationally expensive and rely heavily on hand-crafted data augmentations.

The authors of this paper introduce MAE-CT (Masked Autoencoder Contrastive Tuning), a sequential framework designed to combine the scalability of MIM with the abstraction capabilities of ID without the prohibitive compute costs or complex augmentation requirements.

The MAE-CT Framework

MAE-CT follows a three-step sequential process:

  1. MAE Pre-training: A standard Vision Transformer (ViT) is trained to reconstruct masked images, building a rich feature representation.
  2. NNCLR Head Initialization: A Nearest Neighbor Contrastive Learning (NNCLR) head is attached. Initially, the encoder is frozen while only this head is trained to map coarse features into semantic clusters.
  3. Contrastive Tuning (CT): The "top-half" layers of the ViT encoder are unfrozen and tuned alongside the NNCLR head for a short duration.
The MAE-CT framework and the Contrastive Tuning mechanism.

Key technical innovations include:

  • Topk-NN Lookup: Instead of a single nearest neighbor, the model samples from the top-k neighbors in a feature queue. This acts as a data-driven augmentation, reducing reliance on manual transforms.
  • Layer-wise Learning Rate Decay: Higher learning rates are applied to top layers, while lower rates preserve foundational features in the middle layers.

Key Insights: Forgetting to Learn

A central theme of the paper is that "an autoencoder wants to remember everything; a classifier wants to forget." MAE-CT teaches the model to "forget" background noise and focus on semantic objects.

The authors argue that a sequential approach is superior to end-to-end combinations of MIM and ID. Because these objectives often conflict (e.g., regarding masking ratios), a sequential pipeline allows the model to first build a "world map" via MAE and then "find the landmarks" through contrastive tuning. By using natural variations within the dataset (via nearest neighbors), the model learns invariance more robustly than through artificial color distortions.

Experimental Results

MAE-CT demonstrates significant improvements across multiple benchmarks using ImageNet-1K and various robustness datasets (ImageNet-V2, -R, -Sketch, -A).

MAE-CT achieves state-of-the-art linear probing accuracy with minimal additional compute.
  • State-of-the-Art Accuracy: MAE-CT achieves 82.2% linear probing accuracy on ImageNet with a ViT-H/16 model, outperforming previous self-supervised methods.
  • Clustering Performance: K-means clustering accuracy on ImageNet improved from 11.1% (vanilla MAE) to 58.0% (MAE-CT) without any labels.
  • Efficiency: The tuning phase adds only about 10% overhead to the initial MAE training time, offering a much more efficient path to high performance than training ID models from scratch.
  • Label Efficiency: In low-shot scenarios (1 or 5 labels per class), MAE-CT significantly outperforms standard MAE and rivals heavy-duty models like iBOT.

Limitations and Future Work

While highly effective, MAE-CT remains a two-stage process requiring a pre-trained MAE. Although it reduces reliance on "expert" augmentations, it still utilizes basic "crop & flip" transforms. Future research may explore removing these entirely or extending the "tuning for abstraction" concept to other modalities like audio and video.

Summary updated

BibTeX
@inproceedings{lehner2024contrastive,
  author = {Johannes Lehner and Benedikt Alkin and Andreas Fürst and Elisabeth Rumetshofer and Lukas Miklautz and Sepp Hochreiter},
  title = {{Contrastive Tuning: A Little Help to Make Masked Autoencoders Forget}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i4.28078},
}
Figure