Enhanced OoD Detection through Cross-Modal Alignment of Multi-Modal Representations

Jeonghyeon Kim, Sangheum Hwang

Introduction

In real-world machine learning deployments, Out-of-Distribution (OoD) detection—the ability to identify inputs that fall outside the model's training distribution—is critical for safety and reliability. Vision-Language Models (VLMs) like CLIP have emerged as powerful tools for this task due to their joint understanding of visual and textual concepts. However, a significant challenge remains: while zero-shot methods are efficient, they are often suboptimal, and standard fine-tuning methods that improve in-distribution (ID) accuracy frequently degrade OoD detection performance.

This paper identifies the modality gap as a primary bottleneck. Despite CLIP's contrastive training, image and text embeddings often reside in distinct regions of the hypersphere. Fine-tuning typically preserves or exacerbates this separation, hindering the model's ability to leverage textual knowledge for identifying unseen negative concepts.

Methodology: Cross-Modal Alignment (CMA)

The authors propose Cross-Modal Alignment (CMA), a novel Multi-Modal Fine-Tuning (MMFT) strategy designed to explicitly narrow the modality gap.

Illustration of the CMA mechanism aligning image and text embeddings on the hypersphere.

Unlike standard contrastive loss which focuses on matching pairs, CMA introduces a regularization term that pulls ID image embeddings toward the cluster of corresponding ID text embeddings. This global alignment ensures that the representation space is more uniform and better integrated across modalities.

From a theoretical standpoint, the authors demonstrate that minimizing the CMA objective is equivalent to maximizing the log-likelihood of an Energy-Based Model (EBM). By optimizing the marginal density (the "generative" component), CMA captures structural information about the data distribution that purely discriminative methods often overlook. For detection, the model employs the NegLabel approach, contrasting input images against both ID labels and a set of mined negative labels.

Experimental Setup

The proposed method was evaluated using ImageNet-1k as the In-Distribution (ID) dataset. OoD performance was assessed across two major benchmarks:

  • MOS Benchmark: Comprising iNaturalist, SUN, Places, and Textures datasets.
  • OpenOOD v1.5: A comprehensive suite covering both Near-OoD (e.g., SSB-hard, NINCO) and Far-OoD (e.g., OpenImage-O) scenarios.

Key Results and Discussion

CMA demonstrates a superior balance between classification accuracy and OoD detection capability compared to existing baselines.

MOS benchmark results showing CMA's superior trade-off between ImageNet accuracy and OoD detection (1-FPR95).

As shown in the benchmarks, CMA achieved a state-of-the-art FPR95 of 19.93% on the MOS benchmark (represented as ~80% in 1-FPR95), a significant reduction from the Zero-Shot baseline (27.97%) and the fine-tuning method FLYP (26.39%). Simultaneously, it reached an ID accuracy of 82.64% on ImageNet-1k, outperforming both standard CLIP and prompt-learning techniques like CoOp.

The analysis reveals that while high classification accuracy can be achieved despite a large modality gap, effective OoD detection requires tight alignment. Naive fine-tuning (e.g., FLYP) often widens the gap, whereas CMA creates a more aligned embedding space, sharpening the decision boundaries between known and unknown classes.

Limitations and Future Directions

Despite its strengths in Far-OoD detection, CMA shows moderate performance in Near-OoD tasks where the "unknown" is semantically very similar to the "known" (e.g., SSB-hard). Future research may focus on incorporating auxiliary negative labels directly into the fine-tuning objective to further refine these boundaries.

Conclusion

Cross-Modal Alignment (CMA) addresses the modality gap in VLMs, unlocking their full potential for OoD detection. By integrating a generative EBM perspective into fine-tuning, CMA achieves a new state-of-the-art in both robustness and accuracy, providing a more reliable foundation for deploying vision-language models in open-world environments.

Summary updated

BibTeX
@inproceedings{kim2025enhanced,
  author = {Jeonghyeon Kim and Sangheum Hwang},
  title = {{Enhanced OoD Detection through Cross-Modal Alignment of Multi-Modal Representations}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02790},
}
Figure