Confidence-aware Contrastive Learning for Selective Classification

Yu-Chang Wu, Shen-Huan Lyu, Haopu Shang, Xiangyu Wang, Chao Qian

TL;DR

Researchers have developed CCL-SC, a new training method that improves "selective classification"—the ability of a model to abstain from making a prediction when it's unsure. By using a novel confidence-weighted contrastive loss to refine the model's internal feature representations, they achieved significantly lower error rates across standard benchmarks like ImageNet and CIFAR-100.

What Problem Does This Paper Address?

In high-stakes fields like medical diagnosis or autonomous driving, a "wrong" prediction is far worse than "no" prediction. Selective classification (SC) allows a model to make a prediction only when its confidence exceeds a certain threshold, otherwise handing the task to a human expert.

The challenge lies in how to accurately estimate that confidence. Most existing research focuses on the "tail end" of the model—modifying the final classification layer or adding extra "abstention" heads. However, these methods often ignore the quality of the underlying features. If the model's internal representation of a "cat" looks too much like its representation of a "dog," no amount of output-layer tweaking will reliably separate correct predictions from mistakes.

Methods

The authors propose Confidence-aware Contrastive Learning for Selective Classification (CCL-SC). This approach moves the focus from the output layer to the feature level.

Architecture of CCL-SC
  1. Theoretical Foundation: The authors derive a new generalization bound for SC, proving mathematically that reducing the variance of features within the same category (intra-class variance) directly improves selective performance.
  2. Redefining Positives and Negatives: Unlike standard supervised contrastive learning, CCL-SC defines samples based on the model's current behavior:
  3. Positive samples: Instances the model predicts correctly as the target class.
  4. Negative samples: Instances the model incorrectly predicts as the target class (even if their true label is different).
  5. Confidence Weighting: The contrastive loss is weighted by the model’s Softmax Response (SR). If the model is highly confident about a sample but its features are poorly positioned (too close to "negatives"), the loss is amplified. This forces the model to prioritize fixing high-confidence errors.
  6. Implementation: To handle large-scale data, they use a momentum encoder and two independent queues (one for positives, one for negatives) to store feature embeddings across training batches, similar to the MoCo architecture.

Datasets

The method was evaluated on four widely used image classification benchmarks:

  • CIFAR-10 & CIFAR-100: Standard small-image datasets with 10 and 100 classes.
  • CelebA: A large-scale face attributes dataset (using the 'attractive' label for binary classification).
  • ImageNet: The gold standard for large-scale visual recognition (1,000 classes).

Key Insights and Ideas

  • Feature Space Matters: The "aha moment" is that selective risk isn't just an output-layer problem. By "pulling" correctly classified features together and "pushing" misclassified features away, the model creates a more robust embedding space where confidence scores actually align with accuracy.
  • The "Pulling Strength" Dynamic: By using the model's own confidence as a multiplier for the loss, the training process becomes self-correcting. It focuses specifically on "hard" samples that the model thinks it knows but is actually getting wrong.
  • Compatibility: Because CCL-SC optimizes the feature layers, it can be combined with existing output-layer methods (like SelectiveNet or Self-Adaptive Training) to achieve even better results.

Key Results

CCL-SC consistently outperformed state-of-the-art (SOTA) methods like Deep Gamblers (DG) and Self-Adaptive Training (SAT):

Performance comparison on CelebA and CIFAR-100
  • Lower Selective Risk: On CIFAR-100, CCL-SC achieved lower risk across almost all coverage levels (the percentage of samples the model chooses to classify). For example, at 100% coverage, it reduced error from ~27% (SOTA) to ~26.5%, and the gap widened as coverage decreased.
  • ImageNet Performance: On the massive ImageNet dataset, CCL-SC maintained the lowest selective risk across nearly all coverage degrees, outperforming the previous best methods (SAT+EM) by a noticeable margin.
  • Better Visualization: t-SNE plots of the feature space showed that CCL-SC creates much tighter, more distinct clusters for each class compared to standard training, which directly translates to more reliable confidence estimation.

Limitations and Future Work

  • Training Complexity: The use of momentum encoders and dual queues adds computational overhead and memory requirements compared to simple cross-entropy training.
  • Initial Warm-up: The method requires an initial "warm-up" phase (training with standard loss) before the contrastive loss is introduced, as the definition of positive/negative samples depends on the model having a baseline level of accuracy.
  • Future Directions: The authors suggest exploring how this feature-level optimization could be applied to other domains beyond image classification, such as Natural Language Processing (NLP) or medical signal analysis.

Summary updated

BibTeX
@inproceedings{wu2024confidence,
  author = {Yu-Chang Wu and Shen-Huan Lyu and Haopu Shang and Xiangyu Wang and Chao Qian},
  title = {{Confidence-aware Contrastive Learning for Selective Classification}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=SDCx6rQV2l},
}
Figure