TL;DR
Vision-Language Models (VLMs) like CLIP are powerful but vulnerable to adversarial attacks. This paper introduces RITA, a novel test-time adaptation method that leverages optimal transport to align distributions of augmented visual features with textual prototypes, significantly improving robustness without sacrificing performance on clean data.
What Problem Does This Paper Address?
Pre-trained Vision-Language Models (VLMs) have shown remarkable zero-shot generalization capabilities across various tasks. However, their performance drastically degrades when faced with adversarial perturbations – subtle, often imperceptible changes to input images designed to fool the model. Existing methods to combat this often rely on simple heuristics applied to individual augmented views of an image, failing to capture the underlying structure of how adversarial attacks distort data. This can lead to misclassifications even when the model appears confident, as it can't distinguish true semantic consistency from confident adversarial errors. The core problem is how to make these powerful VLMs robust to adversarial attacks at inference time without costly retraining or access to labeled data.
Methods
RITA (Robust test-time prompt Adaptation) tackles this by shifting from sample-level analysis to distribution-level alignment. The key ideas are:
- Augmented Views as Distributions: Instead of treating each augmented view of an image independently, RITA models the collection of augmented visual features as a discrete probability distribution. Similarly, textual prompts for each class are also represented as distributions.
- Optimal Transport for Alignment: The core of RITA is using Optimal Transport (OT) to measure and minimize the discrepancy between the visual feature distribution and the textual prototype distribution for each class. OT is a principled way to compare distributions by considering the "cost" of moving mass from one to another, effectively capturing geometric relationships. This allows RITA to mitigate adversarial outliers that might skew single-sample predictions.
- Dynamic Cache for Refinement: To further enhance robustness, RITA employs a dynamic cache. This cache stores reliable visual features from past test samples. As new samples arrive, RITA uses this cache to refine the alignment process online, progressively accumulating semantic cues and improving its understanding of the test stream.
- Test-Time Adaptation: Crucially, RITA operates entirely at test time. It doesn't require any model retraining or access to labeled data, making it a practical solution for deploying VLMs in real-world, potentially adversarial, environments.
Datasets
The paper evaluates RITA on a wide range of datasets:
- Fine-grained Classification: Caltech101, Pets, Cars, Flower102, Aircraft, DTD, EuroSAT, UCF101.
- Out-of-Distribution (OOD) Generalization: ImageNet, ImageNetV2, ImageNet-A, ImageNet-R, ImageNet-S.
These datasets cover diverse visual domains, allowing for a comprehensive assessment of RITA's robustness and generalization capabilities.
Key Insights and Ideas
- Adversarial Distortion is Structurally Brittle: The paper's central observation is that while adversarial attacks can corrupt an image's holistic representation, the semantic integrity is often preserved across multiple augmented views. This insight is key to moving beyond sample-level heuristics.
- Distributional Alignment is More Robust: By treating visual and textual features as distributions and aligning them with Optimal Transport, RITA can effectively "smooth out" the effects of adversarial noise, which tends to create brittle, outlier-prone representations.
- Dynamic Caching for Temporal Consistency: Leveraging information from previous test samples via a dynamic cache allows RITA to build a more stable and reliable understanding of the test data, further enhancing its robustness.
- Test-Time Adaptation is Sufficient: The success of RITA demonstrates that significant adversarial robustness improvements can be achieved at inference time, without the need for expensive retraining or access to labeled data.
Key Results
RITA demonstrates significant improvements in adversarial robustness across various benchmarks and model architectures (CLIP with ViT-B/32, ViT-B/16, and RN50 backbones).
- Robustness Gains: RITA consistently outperforms existing test-time adaptation methods, achieving substantial gains in robust accuracy. For example, on fine-grained datasets, RITA improves average robust accuracy by 45.0% (ViT-B/32) and 50.9% (ViT-B/16) compared to vanilla CLIP.
- State-of-the-Art Performance: RITA achieves state-of-the-art robust accuracy on many benchmarks, even under stringent adversarial attacks (e.g., $\epsilon=4.0$).
- Clean Accuracy Preservation: Importantly, RITA achieves these robustness gains without compromising performance on clean (non-adversarial) data. In fact, it often achieves the highest average accuracy on clean samples.
- Efficiency: RITA maintains competitive inference efficiency, with a slight overhead compared to simpler methods but offering a superior trade-off between robustness and speed.
Limitations and Future Work
- Generative Tasks: While RITA shows strong performance in image classification, its extension to generative tasks like image captioning is left for future exploration. The authors believe their distribution-level alignment approach could form a foundation for such extensions.
- Evolving Attacks: The paper acknowledges that adversarial attacks are constantly evolving, and while RITA offers robust inference-time defense, it doesn't eliminate all security risks. Future work could investigate more advanced robust inference-time defenses.
- Hyperparameter Tuning: Like most methods, RITA's performance can be influenced by hyperparameters (e.g., cache size, alignment coefficient $\alpha$). The paper provides ablation studies showing sensitivity to these, suggesting careful tuning might be beneficial.
Summary updated