Finetune Like You Pretrain: Boosting Zero-shot Adversarial Robustness in Vision-language Models

Songlong Xing, Weijie Wang, Zhengyu Zhao, Jindong Gu, Philip Torr +1 more
4/13/2026
cs.CV

Official code: Sxing2/AdvFLYP (27 stars, last commit 2026-04-22).

Abstract

Despite their impressive zero-shot abilities, vision-language models such as CLIP have been shown to be susceptible to adversarial attacks. To enhance its adversarial robustness, recent studies finetune the pretrained vision encoder of CLIP with adversarial examples on a proxy dataset such as ImageNet by aligning adversarial images with correct class labels. However, these methods overlook the important roles of training data distributions and learning objectives, resulting in reduced zero-shot capabilities and limited transferability of robustness across domains and datasets. In this work, we propose a simple yet effective paradigm AdvFLYP, which follows the training recipe of CLIP's pretraining process when performing adversarial finetuning to the model. Specifically, AdvFLYP finetunes CLIP with adversarial images created based on image-text pairs collected from the web, and match them with their corresponding texts via a contrastive loss. To alleviate distortion of adversarial image embeddings of noisy web images, we further propose to regularise AdvFLYP by penalising deviation of adversarial image features. We show that logit- and feature-level regularisation terms benefit robustness and clean accuracy, respectively. Extensive experiments on 14 downstream datasets spanning various domains show the superiority of our paradigm over mainstream practices. Our code and model weights are released at https://github.com/Sxing2/AdvFLYP.

View on arXivView PDF

Code Implementations(1)

Sxing2/AdvFLYPOfficial100%

[CVPR-26 finding 🎉] This is the official repository for our work "Finetune Like You Pretrain: Boosting Zero-shot Adversarial Robustness in Vision-language Models".

270Shell, Python6 months ago

Similar Papers

Cite this paper

@article{xing2026finetune,
  title  = {Finetune Like You Pretrain: Boosting Zero-shot Adversarial Robustness in Vision-language Models},
  author = {Songlong Xing and Weijie Wang and Zhengyu Zhao and Jindong Gu and Philip Torr and Nicu Sebe},
  year   = {2026},
  eprint = {2604.11576},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.11576v1}
}

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/2604.11576.svg)](https://codeofpaper.com/paper/2604.11576)

Discussion