Skip to main content
QUICK REVIEW

[Paper Review] What Do Self-Supervised Vision Transformers Learn?

Namuk Park, Wonjae Kim|arXiv (Cornell University)|May 1, 2023
Domain Adaptation and Few-Shot LearningComputer Science16 citations
TL;DR

The paper compares contrastive learning (CL) and masked image modeling (MIM) for self-supervised Vision Transformers, showing CL captures global shapes while MIM captures local textures, and demonstrates that a simple CL+MIM hybrid can outperform each method alone.

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.

Motivation & Objective

  • Understand how self-supervised ViTs trained with CL and MIM differ in learned representations and downstream performance.
  • Investigate how self-attention, representation transformation, and layer roles differ between CL and MIM.
  • Analyze whether CL and MIM can complement each other to improve linear probing and fine-tuning results.

Proposed method

  • Compare ViT-B/16 models trained with MoCo (CL) and SimMIM (MIM) using ImageNet-1K as baseline.
  • Analyze self-attention behavior, effective receptive fields, and attention diversity across layers.
  • Use linear probing, fine-tuning, mutual information, cosine similarity, and singular value spectra to characterize representations.
  • Perform Fourier analysis to study frequency biases (low vs. high) in representations.
  • Evaluate robustness to texture via Stylized ImageNet and to high-frequency noise.
  • Explore a simple linear combination of CL and MIM objectives as a hybrid training approach.
Figure 1: Self-attentions of CL (MoCo) capture global information, but they collapse into homogeneous attention maps for all query tokens and heads. Self-attentions of MIM (SimMIM) mainly focus on local areas and similar tokens. We visualize the attention maps for two different query tokens in the b
Figure 1: Self-attentions of CL (MoCo) capture global information, but they collapse into homogeneous attention maps for all query tokens and heads. Self-attentions of MIM (SimMIM) mainly focus on local areas and similar tokens. We visualize the attention maps for two different query tokens in the b

Experimental results

Research questions

  • RQ1How do self-attentions differ between CL and MIM in terms of global vs. local relationships?
  • RQ2How are token and image representations transformed by CL and MIM across the ViT depth?
  • RQ3Which layers and components are most responsible for the learned representations in CL vs. MIM?
  • RQ4Can CL and MIM be effectively combined to leverage their complementary strengths?

Key findings

  • CL captures global relationships and object shapes but its self-attentions collapse into homogeneous maps in later layers.
  • MIM captures local relationships and textures, retaining token-level diversity and avoiding attention collapse.
  • CL relies on low-frequency information while MIM relies on high-frequency information, indicating shape bias for CL and texture bias for MIM.
  • Later layers are particularly important for CL, while early layers are more influential for MIM.
  • A simple linear combination of CL and MIM objectives yields better linear probing and fine-tuning performance than either method alone.
  • Hybrid models show that CL-like properties dominate in later layers and MIM-like properties dominate in early layers.
(a) Between heads
(a) Between heads

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.