Text-Guided Attention is All You Need for Zero-Shot Robustness in Vision-Language Models

Lu Yu, Haiyang Zhang, Changsheng Xu
2/3/2026

No official code found. Best implementation: zhyblue424/TGA-ZSR (24 stars, last commit 2026-03-23).

Abstract

Due to the impressive zero-shot capabilities, pre-trained vision-language models (e.g. CLIP), have attracted widespread attention and adoption across various domains. Nonetheless, CLIP has been observed to be susceptible to adversarial examples. Through experimental analysis, we have observed a phenomenon wherein adversarial perturbations induce shifts in text-guided attention. Building upon this observation, we propose a simple yet effective strategy: Text-Guided Attention for Zero-Shot Robustness (TGA-ZSR). This framework incorporates two components: the Attention Refinement module and the Attention-based Model Constraint module. Our goal is to maintain the generalization of the CLIP model and enhance its adversarial robustness: The Attention Refinement module aligns the text-guided attention obtained from the target model via adversarial examples with the text-guided attention acquired from the original model via clean examples. This alignment enhances the model's robustness. Additionally, the Attention-based Model Constraint module acquires text-guided attention from both the target and original models using clean examples. Its objective is to maintain model performance on clean samples while enhancing overall robustness. The experiments validate that our method yields a 9.58% enhancement in zero-shot robust accuracy over the current state-of-the-art techniques across 16 datasets. Our code is available at https://github.com/zhyblue424/TGA-ZSR.

View on arXivView PDF

Code Implementations(1)

zhyblue424/TGA-ZSRCommunity100%

(TPAMI 2026) Complementary Text-Guided Attention for Zero-Shot Adversarial Robustness & & (NeurIPS 2024) Text-Guided Attention is All You Need for Zero-Shot Robustness in Vision-Language Models

243Shell, PythonMay 21, 20247 months ago
adversarial-robustnesszero-shot-adversarial-robustness

Similar Papers

Cite this paper

@article{yu2026textguided,
  title  = {Text-Guided Attention is All You Need for Zero-Shot Robustness in Vision-Language Models},
  author = {Lu Yu and Haiyang Zhang and Changsheng Xu},
  year   = {2026},
  eprint = {2410.21802},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2410.21802},
  url    = {https://arxiv.org/abs/2410.21802},
  journal = {NEURIPS 2024 2024}
}

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

Discussion