A General-Purpose Multi-Modal OOD Detection Framework

Viet Quoc Duong, Qiong Wu, Zhengyi Zhou, Eric Zavesky, WenLing Hsu, Han Zhao, Huajie ShaoTMLR 2024

Abstract: Out-of-distribution (OOD) detection seeks to identify test samples that deviate from the training data, which is critical to ensuring the safety and reliability of machine learning (ML) systems. While a plethora of methods have been developed to detect uni-modal OOD samples, only a few have focused on multi-modal OOD detection. Current contrastive learning-based methods primarily address multi-modal OOD detection in a scenario where an image is not related to the class labels in training data. However, ML systems in the real-world applications may encounter a broader spectrum of anomalies caused by different factors like systematic errors in labeling, environmental changes, and sensor malfunctions. Hence, we propose a new method to be able to simultaneously detect anomalies from multiple different OOD scenarios, arising from fine-grained image features and textual descriptions, instead of large categorical information. To achieve this goal, we propose a general-purpose weakly-supervised OOD detection framework, called WOOD, that combines a binary classifier and a contrastive learning module to reap the benefits of both. In order to better distinguish in-distribution (ID) samples from OOD ones, we employ the Hinge loss to constrain the similarity of their latent representations. Moreover, we devise a new scoring metric that fuses predictions from both the binary classifier and contrastive learning to enhance OOD detection. Extensive experimental results on multiple benchmarks demonstrate that the proposed WOOD significantly outperforms the state-of-the-art methods for multi-modal OOD detection. Importantly, our approach can achieve superior detection performance in a variety of OOD scenarios.

Introduction

Most machine learning models operate under a "closed-world" assumption, expecting test data to mirror the distribution of their training sets. Out-of-distribution (OOD) detection serves as a critical safety mechanism, identifying when a model encounters unfamiliar or anomalous inputs. While OOD detection for single modalities (e.g., images or text alone) is well-established, multi-modal OOD detection presents unique challenges, particularly when identifying subtle mismatches between different data types.

The Challenge of Multi-Modal Anomalies

Current state-of-the-art multi-modal models, often built on CLIP, typically focus on "new-domain" anomalies—detecting entirely different categories of objects. However, real-world systems frequently encounter more nuanced failures:

  1. Misalignment: The image and text are both valid individually but do not describe each other (e.g., a picture of a seagull paired with text describing a yellow bird).
  2. Noisy Data: Inputs partially corrupted by environmental factors or sensor malfunctions, such as motion blur or sensor noise.
  3. Fine-grained Differences: Subtle feature mismatches that do not constitute a full categorical shift.
An example of a correctly aligned in-distribution (ID) sample where the text accurately describes the visual features of the bird.
An example of a misaligned out-of-distribution (OOD) sample. The text describes a yellow bird with a black head, which contradicts the visual evidence of a white seagull.

The WOOD Framework

To address these diverse OOD scenarios, we introduce WOOD (Weakly-supervised OOD Detection). WOOD utilizes a dual-architecture approach to cover the blind spots of traditional methods:

Contrastive Learning with Hinge Loss

Unlike standard contrastive losses, WOOD employs a Hinge loss to maximize the similarity of In-Distribution (ID) pairs while enforcing a strict margin that pushes OOD pairs away in the latent space. This specific constraint makes the model significantly more sensitive to misalignment anomalies.

Binary Classifier with Feature Sparsity Regularizer (FSR)

WOOD incorporates a binary classifier to distinguish ID from OOD samples. To prevent the model from focusing on irrelevant background noise, a Feature Sparsity Regularizer (FSR) is used. This module employs a gating mechanism to prioritize core features essential for defining the distribution.

Weak Supervision and Fusion Scoring

WOOD leverages "weak supervision" by training on a minimal amount (1%) of labeled OOD data. During inference, it uses a novel fusion scoring metric: $P_{ood} = 1 - P_{bc}P_{cl}$. A sample is only classified as In-Distribution if both the contrastive module ($P_{cl}$) and the binary classifier ($P_{bc}$) agree on its validity.

Experimental Results

WOOD was evaluated across three benchmarks: CUB-200 (fine-grained birds), MIMIC-CXR (medical imaging), and COCO (general objects). The framework demonstrated substantial improvements over existing baselines like MCM and CoOp:

  • Superior Accuracy: On CUB-200, WOOD achieved an AUROC of 95.18%, vastly outperforming the next best baseline (78.08%).
  • Reduced Error Rates: WOOD significantly lowered the False Positive Rate (FPR95) to 13.98% on CUB-200, whereas most baselines remained above 90%.
  • Domain Robustness: In the specialized medical domain (MIMIC-CXR), WOOD maintained a high AUROC of 94.48%, while zero-shot CLIP-based methods struggled near 50% due to a lack of domain-specific alignment.

Conclusion

WOOD provides a robust, general-purpose solution for multi-modal OOD detection. By fusing contrastive learning with binary classification and utilizing a small fraction of OOD data, it effectively identifies misalignments, noise, and new-domain anomalies that traditional models miss. Future work will focus on expanding the framework to handle an even broader array of real-world environmental shifts.

Summary updated

BibTeX
@article{duong2024general,
  author = {Viet Quoc Duong and Qiong Wu and Zhengyi Zhou and Eric Zavesky and WenLing Hsu and Han Zhao and Huajie Shao},
  title = {{A General-Purpose Multi-Modal OOD Detection Framework}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=nYzws7sSzo},
}
Figure