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

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, where the inference-time classes are identical to those seen during training. However, real-world deployments—such as autonomous vehicles or e-commerce platforms—frequently encounter objects from previously unseen categories. This necessitates Open-world Semi-Supervised Learning (Open-world SSL). In this setting, we possess a small labeled dataset of "known" classes and a large unlabeled dataset containing a mixture of these known classes and entirely novel ones. The primary challenge lies in accurately separating known from unknown data to prevent "noisy" learning, where the model conflates old and new categories.

Methodology: Open-world Contrastive Learning (OpenCon)

OpenCon addresses these challenges through two primary mechanisms: Prototype-based OOD Detection and a Novel Contrastive Loss.

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

1. Prototype-based OOD Detection

The model maintains "prototypes" (representative embedding vectors) for every class. To process unlabeled data, OpenCon first evaluates the proximity of a sample to known prototypes. Samples falling outside a certain threshold are flagged as "novel." This explicit filtering prevents known-class noise from corrupting the discovery and representation of new categories.

2. Novel Contrastive Loss ($L_n$)

For samples identified as novel, the model generates "pseudo-positive" pairs. If two unlabeled samples are closest to the same novel prototype, they are treated as belonging to the same class. The model then pushes their embeddings together while repelling them from other prototypes.

The total objective function is tripartite:

  • Supervised Contrastive Loss: Optimizes representations for labeled "known" data.
  • Self-Supervised Loss: Facilitates general feature learning across all unlabeled data.
  • Open-world Contrastive Loss: Specifically clusters the discovered novel classes.

Theoretically, this process aligns with the Expectation-Maximization (EM) algorithm, where the E-step assigns samples to prototypes and the M-step updates the neural network to make those clusters more compact.

Experimental Evaluation

OpenCon was evaluated on several rigorous benchmarks, including CIFAR-100, ImageNet-100, and fine-grained datasets like CUB-200 (birds), Stanford Cars, and Herbarium19 (plants).

Key Results

OpenCon sets a new state-of-the-art for Generalized Category Discovery. On ImageNet-100, it outperformed the previous best method (ORCA) by 11.9% on novel class accuracy and 7.4% on overall accuracy.

Performance comparison of OpenCon against state-of-the-art methods on CIFAR-100 and ImageNet-100.

Furthermore, OpenCon demonstrated significant gains in fine-grained classification. On the Stanford Cars dataset, it surpassed baselines by 10.1%, proving its ability to distinguish between subtle differences in novel categories (e.g., different car models). The framework is also compatible with modern architectures; using a Vision Transformer (ViT) backbone, OpenCon achieved 84.0% overall accuracy on ImageNet-100, a nearly 10-point lead over the next best competitor.

Conclusion

OpenCon provides a robust framework for open-world learning by leveraging prototypes to stabilize the discovery of new categories. While the current implementation requires a pre-specified number of prototypes, the model is robust to overestimation—unused prototypes simply remain unassigned. Future research will focus on dynamically estimating the number of classes during training to allow for truly autonomous category discovery.

Summary updated

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