CAE v2: Context Autoencoder with CLIP Latent Alignment

Xinyu Zhang, Jiahui Chen, Junkun Yuan, Qiang Chen, Jian Wang, Xiaodi Wang, Shumin Han, Xiaokang Chen, Jimin Pi, Kun Yao, Junyu Han, Errui Ding, Jingdong Wang

Abstract

Masked image modeling (MIM) has traditionally relied on low-level pixel reconstruction. CAE v2 advances this paradigm by utilizing semantically rich CLIP latents as pre-training targets. By introducing a novel "visible latent alignment" task, CAE v2 directly supervises the encoder, leading to faster convergence and superior performance. Evaluated on ImageNet-1K, ADE20K, and COCO, CAE v2 consistently outperforms previous MIM methods and even the original CLIP vision encoder in several downstream tasks.

Introduction

Self-supervised learning via Masked Image Modeling (MIM) typically involves masking image patches and tasking a model with reconstructing the missing content. While effective, pixel-level reconstruction often focuses on low-level redundancies rather than high-level semantics. Recent efforts have explored using high-level features, such as those from CLIP, as targets. However, these methods often overlook the potential of directly supervising the encoder on visible patches. CAE v2 addresses this by explicitly aligning the encoder’s representations with the CLIP latent space for both visible and masked regions.

Methods

CAE v2 builds upon the Context Autoencoder (CAE) framework with several key enhancements designed to leverage CLIP latent targets effectively.

The CAE v2 architecture featuring visible and masked latent alignment with CLIP targets.

Architecture and Alignment Tasks

The model consists of a high-capacity Encoder and a lightweight Regressor. Unlike standard autoencoders that use heavy decoders for pixel reconstruction, the Regressor in CAE v2 operates in the latent space.

  1. Visible Latent Alignment (VLA): This is the primary innovation. The encoder is trained to align its representations of visible patches directly with the corresponding latents from a frozen CLIP vision encoder. This provides immediate, high-level semantic supervision.
  2. Masked Latent Alignment (MLA): Following the standard MIM approach, the regressor predicts the CLIP latents for masked patches based on the encoder's output for visible patches.
  3. Loss Function: Both VLA and MLA utilize a cosine distance loss to minimize the discrepancy between the model's predicted latents and the CLIP "ground truth" targets.

Key Results

Pre-trained on ImageNet-1K, CAE v2 demonstrates significant improvements in both training efficiency and representation quality.

Training loss comparison (left) and linear probing accuracy across different models (right).

Efficiency and Convergence

As shown in the training loss curves, CAE v2 converges significantly faster than the original CAE. By supervising the encoder on visible patches from the start, the model bypasses the need for the regressor to first master global context before the encoder can learn useful features.

Downstream Performance

  • Linear Probing: On ImageNet-1K, a ViT-Base model achieves 80.7% accuracy, a substantial leap over pixel-based MAE (68.0%) and previous CLIP-targeted methods like MVP (75.4%).
  • Semantic Segmentation: On ADE20K, CAE v2 reaches 53.4 mIoU, surpassing the original CLIP vision encoder (51.1 mIoU).
  • Object Detection: The model achieves 52.4 AP on COCO using Mask R-CNN, demonstrating robust spatial feature learning.

Discussion and Insights

The success of CAE v2 highlights the importance of target quality and supervision strategy in MIM. Decoupling representation learning (via VLA) from contextual prediction (via MLA) allows the encoder to focus on extracting semantically rich features. Furthermore, the optimal mask ratio was found to scale with model size; larger models benefit from higher masking ratios (up to 60%), which prevents overfitting on local patterns and encourages the learning of more global, robust features.

Conclusion

CAE v2 presents a refined approach to MIM by aligning latent representations with the semantically dense space of CLIP. By introducing visible latent alignment, the framework achieves state-of-the-art performance across various vision tasks while improving training efficiency. Future work will explore scaling these benefits to even larger Vision Transformer architectures and investigating alternative pre-training targets.

Summary updated

BibTeX
@article{zhang2023cae,
  author = {Xinyu Zhang and Jiahui Chen and Junkun Yuan and Qiang Chen and Jian Wang and Xiaodi Wang and Shumin Han and Xiaokang Chen and Jimin Pi and Kun Yao and Junyu Han and Errui Ding and Jingdong Wang},
  title = {{CAE v2: Context Autoencoder with CLIP Latent Alignment}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=f36LaK7M0F},
}
Figure