$Δ\mathrm{Energy}$: Optimizing Energy Change During Vision-Language Alignment Improves both OOD Detection and OOD Generalization
Lin Zhu, Yifeng Yang, Xinbing Wang, Qinying Gu, Nanyang Ye
TL;DR
This work tackles the challenge of robustly fine-tuning vision-language models to perform well on both covariate-shifted closed-set OOD and open-set semantic OOD. It introduces $\Delta\mathrm{Energy}$, an energy-based OOD score that measures the energy change when re-aligning vision-language representations by cropping the top-c cosine similarities, and proves it provides better separation between ID and OOD than prior methods. To jointly improve detection and generalization, the authors propose an $\mathrm{EBM}$ bound-maximization loss that increases the lower bound of $\Delta\mathrm{Energy}$ and yields domain-consistent Hessians, enabling a unified prompt-tuning framework. Through extensive experiments on challenging OOD benchmarks (including ImageNet-1k, cross-dataset, and hard OOD splits), the approach achieves substantial gains (10–25% in AUROC) over strong baselines, demonstrating robust OOD handling for VLMs in practical deployment.
Abstract
Recent approaches for vision-language models (VLMs) have shown remarkable success in achieving fast downstream adaptation. When applied to real-world downstream tasks, VLMs inevitably encounter both the in-distribution (ID) data and out-of-distribution (OOD) data. The OOD datasets often include both covariate shifts (e.g., known classes with changes in image styles) and semantic shifts (e.g., test-time unseen classes). This highlights the importance of improving VLMs' generalization ability to covariate-shifted OOD data, while effectively detecting open-set semantic-shifted OOD classes. In this paper, inspired by the substantial energy change observed in closed-set data when re-aligning vision-language modalities (specifically by directly reducing the maximum cosine similarity to a low value), we introduce a novel OOD score, named ΔEnergy. ΔEnergy significantly outperforms the vanilla energy-based OOD score and provides a more reliable approach for OOD detection. Furthermore, ΔEnergy can simultaneously improve OOD generalization under covariate shifts, which is achieved by lower-bound maximization for ΔEnergy (termed EBM). EBM is theoretically proven to not only enhance OOD detection but also yields a domain-consistent Hessian, which serves as a strong indicator for OOD generalization. Based on this finding, we developed a unified fine-tuning framework that allows for improving VLMs' robustness in both OOD generalization and OOD detection. Extensive experiments on challenging OOD detection and generalization benchmarks demonstrate the superiority of our method, outperforming recent approaches by 10% to 25% in AUROC.
