NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

OpenCon: Open-world Contrastive Learning

Yiyou Sun, Yixuan Li

Abstract

Machine learning models deployed in the wild naturally encounter unlabeled samples from both known and novel classes. Challenges arise in learning from both the labeled and unlabeled data, in an open-world semi-supervised manner. In this paper, we introduce a new learning framework, open-world contrastive learning (OpenCon). OpenCon tackles the challenges of learning compact representations for both known and novel classes and facilitates novelty discovery along the way. We demonstrate the effectiveness of OpenCon on challenging benchmark datasets and establish competitive performance. On the ImageNet dataset, OpenCon significantly outperforms the current best method by 11.9% and 7.4% on novel and overall classification accuracy, respectively. Theoretically, OpenCon can be rigorously interpreted from an EM algorithm perspective—minimizing our contrastive loss partially maximizes the likelihood by clustering similar samples in the embedding space.

Introduction

Most machine learning models operate under a "closed-world" assumption: the classes seen during training are the only ones that will ever exist. However, in real-world deployments—such as autonomous driving or e-commerce—this assumption often fails. Models inevitably encounter "novel" classes (e.g., a new product type or an unusual vehicle) mixed with "known" classes.

This challenge is addressed by Open-world Semi-supervised Learning. In this setting, we have a small labeled dataset of known classes ($D_l$) and a large unlabeled dataset ($D_u$) containing a mix of those known classes and entirely new ones. The objective is to learn a representation space where both known and novel classes form distinct, compact clusters, allowing the model to "discover" new categories without human intervention.

Methodology: Open-world Contrastive Learning

OpenCon addresses these challenges through two primary components: Prototype-based Learning and a specialized Contrastive Loss.

Overview of the OpenCon framework, illustrating the interaction between prototype-based learning and open-world contrastive learning.

1. Prototype-based Learning

The model maintains "prototypes" (representative embedding vectors) for every class, both known and novel.

  • Novelty Detection: These prototypes are used for Out-of-Distribution (OOD) detection. If an unlabeled sample is distant from all "known" prototypes, it is flagged as belonging to a novel class.
  • Pseudo-labeling: Once identified as novel, a sample is assigned a pseudo-label based on its proximity to the "novel" prototypes.

2. The OpenCon Loss Function

The model is trained end-to-end using a tripartite loss:

  • Supervised Contrastive Loss ($\mathcal{L}_l$): Uses ground-truth labels to pull similar known samples together.
  • Self-Supervised Loss ($\mathcal{L}_u$): Standard contrastive learning (e.g., SimCLR) to learn general features from all unlabeled data.
  • Novel Contrastive Loss ($\mathcal{L}_n$): This component uses pseudo-labels to treat samples assigned to the same novel prototype as a "positive set," forcing the encoder to cluster novel categories tightly.

Theoretically, OpenCon can be viewed as an Expectation-Maximization (EM) algorithm, where the E-step assigns samples to prototypes and the M-step optimizes the network to maximize the likelihood of those assignments.

Experimental Evaluation

OpenCon was evaluated on several rigorous benchmarks, including CIFAR-10/100, ImageNet-100/1k, and fine-grained datasets like CUB-200, Stanford Cars, and Herbarium19. In these experiments, classes were typically split 50/50 between "seen" (labeled) and "novel" (unlabeled).

Key Results

OpenCon establishes a new state-of-the-art (SOTA) across multiple benchmarks. As shown in the results table, it significantly outperforms previous methods like ORCA and GCD.

Performance comparison of OpenCon against state-of-the-art methods on CIFAR-100 and ImageNet-100 benchmarks.
  • ImageNet-100: OpenCon outperformed the previous best method (ORCA) by 11.9% in novel class accuracy and 7.4% in overall accuracy.
  • Vision Transformers (ViT): Using a ViT backbone, OpenCon improved overall accuracy by 9.9% over the best baseline.
  • Robustness: The model remains robust even with scarce labels (e.g., 10% labeling) and does not require the exact number of novel classes to be known in advance. If the number of prototypes is over-estimated, the model naturally converges to the true number of clusters.

Conclusion and Future Work

OpenCon demonstrates that explicit novelty detection and contrastive learning with negative samples are critical for open-world discovery. While the model is robust to over-estimating the number of novel classes, it still requires a pre-specified prototype count. Future research could focus on mechanisms to automatically estimate and adjust the class count dynamically during training.

Summary updated

BibTeX
@article{sun2023opencon,
  author = {Yiyou Sun and Yixuan Li},
  title = {{OpenCon: Open-world Contrastive Learning}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=Gbon4_5LajV},
}
Figure