Abstract
Contrastive learning with the nearest neighbor has proved to be one of the most efficient self-supervised learning (SSL) techniques by utilizing the similarity of multiple instances within the same class. However, its efficacy is constrained as the nearest neighbor algorithm primarily identifies "easy" positive pairs, where the representations are already closely located in the embedding space. In this paper, we introduce a novel approach called Contrastive Learning with Synthetic Positives (CLSP) that utilizes synthetic images, generated by an unconditional diffusion model, as the additional positives to help the model learn from diverse positives. Through feature interpolation in the diffusion model sampling process, we generate images with distinct backgrounds yet similar semantic content to the anchor image. These images are considered "hard" positives for the anchor image, and when included as supplementary positives in the contrastive loss, they contribute to a performance improvement of over 2% and 1% in linear evaluation compared to the previous NNCLR and All4One methods across multiple benchmark datasets such as CIFAR10, achieving state-of-the-art methods. On transfer learning benchmarks, CLSP outperforms existing SSL frameworks on 6 out of 8 downstream datasets. We believe CLSP establishes a valuable baseline for future SSL studies incorporating synthetic data in the training process.
Introduction
Self-supervised learning (SSL) frameworks like SimCLR or MoCo rely on contrastive learning, where a model learns representations by pulling "positive pairs" (different views of the same image) together and pushing "negative pairs" (different images) apart. Traditionally, positive pairs are created via simple data augmentations like cropping or color jittering. These "easy" positives often fail to challenge the model, as it quickly learns to ignore these superficial changes. While some methods use "nearest neighbors" to find more diverse positives, these often select samples already close in the embedding space. The core challenge lies in generating "hard" positives: images that share semantic meaning but differ significantly in visual context (e.g., different backgrounds or lighting) without relying on human labels.
Methods
The proposed Contrastive Learning with Synthetic Positives (CLSP) framework addresses this by leveraging the internal semantic knowledge of pre-trained unconditional diffusion models.
The method hinges on the observation that diffusion models decouple semantic ("what") and background ("where") information across their internal layers. CLSP generates synthetic positives by taking the semantic features of an anchor image from intermediate diffusion layers and interpolating them with features from a random noise sampling process. This produces a "hard" positive: an image containing the anchor's object but in a completely novel, synthetic context. To maintain training efficiency, a candidate set of synthetic images is pre-generated for the entire dataset. During training, the model minimizes a contrastive loss that includes these synthetic counterparts, forcing the encoder to focus on core semantic features rather than background textures.
Results
CLSP was evaluated across several benchmarks, including CIFAR10, CIFAR100, STL10, and ImageNet100. The method consistently outperformed existing SSL frameworks in linear evaluation and kNN accuracy.
As shown in the results table, CLSP-SimCLR achieved a state-of-the-art linear evaluation accuracy of 94.41% on CIFAR10, significantly outperforming the standard SimCLR baseline (91.47%). On ImageNet100, the method improved the baseline by nearly 4%, reaching 79.62%. Beyond standard benchmarks, CLSP demonstrated superior transferability, outperforming existing SSL frameworks on 6 out of 8 downstream datasets, including specialized tasks like Stanford Cars and Oxford-Flowers. Ablation studies revealed that a subtle interpolation weight ($w=0.1$) provides the optimal balance between semantic consistency and contextual diversity.
Conclusion
CLSP demonstrates that synthetic data from diffusion models can serve as a powerful supervision signal for self-supervised learning. By generating "hard" positives that decouple objects from their backgrounds, the model learns more robust and transferable representations. While the method introduces some computational overhead due to the diffusion generation phase, its performance gains across diverse benchmarks establish it as a strong baseline for future research in synthetic-data-driven SSL. Future work will focus on scaling to ImageNet-1k and exploring applications in object detection and segmentation.
Summary updated