CLIPTTA: Robust Contrastive Vision-Language Test-Time Adaptation

Marc Lafon, Gustavo Adolfo Vargas Hakim, Clément Rambour, Christian Desrosier, Nicolas Thome
7/18/2025
cs.CV

No official code found. Best implementation: MarcLafon/cliptta (11 stars, last commit 2025-12-05).

Abstract

Vision-language models (VLMs) like CLIP exhibit strong zero-shot capabilities but often fail to generalize under distribution shifts. Test-time adaptation (TTA) allows models to update at inference time without labeled data, typically via entropy minimization. However, this objective is fundamentally misaligned with the contrastive image-text training of VLMs, limiting adaptation performance and introducing failure modes such as pseudo-label drift and class collapse. We propose CLIPTTA, a new gradient-based TTA method for vision-language models that leverages a soft contrastive loss aligned with CLIP's pre-training objective. We provide a theoretical analysis of CLIPTTA's gradients, showing how its batch-aware design mitigates the risk of collapse. We further extend CLIPTTA to the open-set setting, where both in-distribution (ID) and out-of-distribution (OOD) samples are encountered, using an Outlier Contrastive Exposure (OCE) loss to improve OOD detection. Evaluated on 75 datasets spanning diverse distribution shifts, CLIPTTA consistently outperforms entropy-based objectives and is highly competitive with state-of-the-art TTA methods, outperforming them on a large number of datasets and exhibiting more stable performance across diverse shifts.

View on arXivView PDF

Code Implementations(1)

MarcLafon/clipttaCommunity66%

Official implementation of the NeurIPS 2025 paper: CLIPTTA: Robust Contrastive Vision-Language Test-Time Adaptation

111Shell, PythonOct 21, 202510 months ago

Similar Papers

Cite this paper

@article{lafon2025cliptta,
  title  = {CLIPTTA: Robust Contrastive Vision-Language Test-Time Adaptation},
  author = {Marc Lafon and Gustavo Adolfo Vargas Hakim and Clément Rambour and Christian Desrosier and Nicolas Thome},
  year   = {2025},
  eprint = {2507.14312},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.14312v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.14312.svg)](https://codeofpaper.com/paper/2507.14312)

Discussion