What Do Self-Supervised Vision Transformers Learn?
Namuk Park, Wonjae Kim, Byeongho Heo, Taekyung Kim, Sangdoo Yun
TL;DR
<3-5 sentence high-level summary> This study provides a rigorous comparison between contrastive learning (CL) and masked image modeling (MIM) for Vision Transformers, showing that CL emphasizes global shape information and tends to collapse attention in later layers, while MIM preserves token-level diversity and focuses on local texture information. Through analyses of self-attention, representation transforms, and layer roles (including Fourier and information-theoretic measures), the authors demonstrate fundamental biases: CL is shape-biased and suited for linear probing, whereas MIM is texture-biased and excels in dense prediction with larger models. The work demonstrates that CL and MIM are complementary, and that simple hybrids can outperform either method alone across downstream tasks. It also highlights practical design insights, such as leveraging explicit decoders for MIM and exploring layer-wise, non-uniform integration of CL and MIM objectives for future SSL methods.
Abstract
We present a comparative study on how and why contrastive learning (CL) and masked image modeling (MIM) differ in their representations and in their performance of downstream tasks. In particular, we demonstrate that self-supervised Vision Transformers (ViTs) have the following properties: (1) CL trains self-attentions to capture longer-range global patterns than MIM, such as the shape of an object, especially in the later layers of the ViT architecture. This CL property helps ViTs linearly separate images in their representation spaces. However, it also makes the self-attentions collapse into homogeneity for all query tokens and heads. Such homogeneity of self-attention reduces the diversity of representations, worsening scalability and dense prediction performance. (2) CL utilizes the low-frequency signals of the representations, but MIM utilizes high-frequencies. Since low- and high-frequency information respectively represent shapes and textures, CL is more shape-oriented and MIM more texture-oriented. (3) CL plays a crucial role in the later layers, while MIM mainly focuses on the early layers. Upon these analyses, we find that CL and MIM can complement each other and observe that even the simplest harmonization can help leverage the advantages of both methods. The code is available at https://github.com/naver-ai/cl-vs-mim.
