ConstraintMatch for Semi-constrained Clustering

Jann Goschenhofer, Bernd Bischl, Zsolt Kira

Introduction

Clustering is a fundamental task in data science, yet it often operates in an unsupervised vacuum, lacking the guidance necessary to align with specific human intent. Semi-constrained clustering attempts to bridge this gap by incorporating pairwise constraints—Must-Link (ML) and Cannot-Link (CL) hints—to guide the grouping process. While these constraints are less burdensome to produce than full categorical labels, deep learning models still require a substantial volume of them to achieve high accuracy. In the "semi-constrained" setting, where a small set of constraints is paired with a large corpus of unconstrained data, models frequently succumb to confirmation bias. This occurs when a model generates incorrect "pseudo-labels" for unlabeled data and subsequently treats those errors as ground truth, leading to a degradation in performance.

To address these challenges, we present ConstraintMatch, a framework that adapts the principles of semi-supervised classification (specifically the FixMatch paradigm) to the domain of pairwise clustering. By transforming uncertain class predictions into robust pairwise pseudo-constraints, ConstraintMatch achieves state-of-the-art results while utilizing only a fraction of the annotated data typically required.

Methodology

ConstraintMatch introduces a pipeline designed to maximize the utility of unlabeled data while minimizing the impact of incorrect model predictions. The framework consists of three primary components:

1. Pseudo-Constraining via Jensen-Shannon Distance

The core innovation of ConstraintMatch is the shift from pseudo-labeling to pseudo-constraining. Rather than forcing the model to assign a specific, potentially incorrect class label to an unlabeled image, the framework evaluates pairs of unlabeled images. By calculating the Jensen-Shannon (JS) Distance between the predicted probability distributions of two samples, the model generates a "soft" pseudo-constraint. This approach is inherently more robust; even if the model misidentifies the specific classes of two objects, it can still correctly identify that they belong to different categories.

2. Informativeness over Confidence

Traditional semi-supervised methods often rely on a confidence threshold, only learning from unlabeled samples where the model's maximum probability exceeds a certain limit. ConstraintMatch argues that this approach ignores highly informative data. Instead, it employs an entropy-based criterion to select samples. This allows the model to utilize images where it may be uncertain between two similar classes, provided it remains certain that the sample is distinct from other clusters. This focus on informativeness ensures a more comprehensive use of the available unlabeled data.

3. Unified Pairwise Loss

To maintain consistency across supervised and unsupervised signals, ConstraintMatch utilizes the Meta-classification-likelihood (MCL) loss. This mathematical framework allows the model to treat both the ground-truth constraints provided by humans and the generated pseudo-constraints through a single, unified objective function. This ensures that the learned representations are consistent across the entire dataset.

Experimental Evaluation

The effectiveness of ConstraintMatch was evaluated across five diverse image benchmarks: CIFAR-10, CIFAR-100-20 (using superclasses), STL-10, ImageNet-10, and ImageNet-Dogs. The latter represents a particularly challenging fine-grained clustering task.

Key Results

ConstraintMatch consistently outperformed existing baselines, such as SCAN and standard MCL. Notable results include:

  • Significant Performance Gains: On CIFAR-100-20, the model achieved a 16.75% improvement in Normalized Mutual Information (NMI) over the constrained baseline.
  • Data Efficiency: The framework reached performance levels comparable to fully supervised models while using significantly fewer annotations.
  • Robustness to Noise: In controlled simulations, ConstraintMatch remained stable even when 50% of the pseudo-labels were intentionally corrupted. In contrast, traditional pseudo-labeling methods failed almost immediately under similar conditions.

Discussion: The Robustness of Pairwise Relationships

A key insight from this research is the "Wrong + Wrong = Right" phenomenon. In categorical pseudo-labeling, if a model misidentifies a "Sports Car" as an "Airliner," the error is propagated. However, in a pairwise setting, if the model misidentifies a "Sports Car" as an "Airliner" and a "Maltese Dog" as a "Soccer Ball," it can still correctly conclude that the two images are different (a Cannot-Link constraint). This property makes pseudo-constraints significantly more resilient to the early-stage errors that typically plague semi-supervised learning.

Furthermore, ConstraintMatch demonstrates resilience in "overclustering" scenarios—situations where the true number of clusters is unknown. This is a critical advantage for real-world applications where the underlying data structure is often ambiguous.

Conclusion and Future Work

ConstraintMatch represents a significant step forward in making semi-constrained clustering practical for large-scale applications. By prioritizing pairwise relationships and informative sample selection, it overcomes the primary hurdle of confirmation bias.

Future research will focus on scaling the framework to high-cardinality datasets containing thousands of categories. Additionally, the authors intend to explore more complex constraint structures, such as triplets (e.g., "Sample A is more similar to B than to C"), and investigate methods to handle potential noise in human-provided constraints.

Summary updated

BibTeX
@inproceedings{goschenhofer2023constraintmatch,
  author = {Jann Goschenhofer and Bernd Bischl and Zsolt Kira},
  title = {{ConstraintMatch for Semi-constrained Clustering}},
  booktitle = {IJCNN},
  year = {2023},
  doi = {10.1109/ijcnn54540.2023.10191186},
}
Figure