Improving Fine-tuning of Self-supervised Models with Contrastive Initialization

Haolin Pan, Yong Guo, Qinyi Deng, Haomin Yang, Yiqun Chen, Jian Chen

Introduction

Self-supervised learning (SSL) has transformed deep learning by enabling models to learn from vast amounts of unlabeled data. However, a significant "semantic gap" often persists when these models are applied to downstream classification tasks. This paper introduces COIN (Contrastive Initialization), a two-stage fine-tuning strategy designed to bridge this gap by explicitly organizing the feature space before training a final classifier.

The Semantic Gap in SSL

Standard SSL methods like MoCo or SimCLR learn representations by comparing different views of the same image. Because these methods are "class-blind," they treat every other image in a batch as a negative sample—even if two images belong to the same semantic category (e.g., two different dog breeds). This results in a fragmented feature space where instances of the same class are scattered, making it difficult for a linear classifier to establish clean decision boundaries during fine-tuning.

The COIN Framework

The authors propose a simple yet effective modification to the standard fine-tuning pipeline. Instead of training the feature extractor and classifier simultaneously from the start, COIN breaks the process into two distinct phases:

  1. Contrastive Initialization (COIN) Stage: For a portion of the training budget (defined by a split ratio $\alpha$), the model is trained on the target dataset using a Supervised Contrastive Loss. This stage focuses purely on representation learning, pulling same-class images together and pushing different classes apart without training a classification head.
  2. Fine-tuning Stage: The model then undergoes standard fine-tuning using Cross-Entropy loss, often maintaining the contrastive loss to preserve the organized structure.
The COIN training pipeline: Self-supervised pre-training is followed by a Contrastive Initialization stage before final fine-tuning.

Crucially, COIN does not increase the total number of training epochs. By reallocating the existing budget, it achieves superior performance with zero additional computational cost.

Experimental Evaluation

The researchers validated COIN across nine diverse datasets, including general categories (CIFAR-10/100, ImageNet-20), fine-grained tasks (Oxford Pets, Flowers), and textures (DTD). They tested the method using both ResNet-50 (pre-trained with MoCo-v2) and Vision Transformer (ViT) architectures.

Results and Feature Analysis

COIN consistently outperformed standard fine-tuning (CE-Tuning) and Supervised Contrastive Learning (SCL). Notable gains include a +5.00% accuracy improvement on ImageNet-20 and a +2.57% boost on CIFAR-100 compared to SCL.

To understand why COIN works, the authors analyzed the "messiness" of the feature space using the $S\_Dbw$ score, which measures cluster density and separation. As shown in the t-SNE visualizations below, COIN significantly improves class clustering compared to other methods, reducing the $S\_Dbw$ score from 0.48 (CE-Tuning) to 0.28 on CIFAR-10.

t-SNE visualizations and S_Dbw scores comparing different fine-tuning methods. COIN produces the most distinct and well-separated class clusters.

Conclusion

COIN demonstrates that a better initialization of the feature space is more valuable than additional iterations of standard fine-tuning. By explicitly bridging the semantic gap through supervised contrastive initialization, COIN sets a new standard for fine-tuning self-supervised models across a wide range of architectures and tasks with no extra training time.

Summary updated

Abstract

Self-supervised learning (SSL) has achieved remarkable performance in pretraining the models that can be further used in downstream tasks via fine-tuning. However, these self-supervised models may not capture meaningful semantic information since the images belonging to the same class are always regarded as negative pairs in the contrastive loss. Consequently, the images of the same class are often located far away from each other in learned feature space, which would inevitably hamper the fine-tuning process. To address this issue, we seek to provide a better initialization for the self-supervised models by enhancing the semantic information. To this end, we propose a Contrastive Initialization (COIN) method that breaks the standard fine-tuning pipeline by introducing an extra initialization stage before fine-tuning. Extensive experiments show that, with the enriched semantics, our COIN significantly outperforms existing methods without introducing extra training cost and sets new state-of-the-arts on multiple downstream tasks.
BibTeX
@article{pan2023improving,
  author = {Haolin Pan and Yong Guo and Qinyi Deng and Haomin Yang and Yiqun Chen and Jian Chen},
  title = {{Improving Fine-tuning of Self-supervised Models with Contrastive Initialization}},
  journal = {Neural Networks},
  year = {2023},
  doi = {10.1016/j.neunet.2022.12.012},
}
Figure