SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.21802 · NeurIPS · 2024

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

Lu Yu, Haiyang Zhang, Changsheng Xu

arXiv · PDF · Open in the Atlas

Code that ran

6 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 6 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.21802.json · badge: /api/ran/2410.21802.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
zhyblue424/TGA-ZSR canonical (classifier label)
classifier basis: census
6 ran · 5 no recorded run
zhyblue424/tga-zsr canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
FunctionStatusWhere it lives
clip_img_preprocessing Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/model.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("405bd24ae83558d9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_logits Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/model.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("cad29a7a417c68d3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

fixed_patch Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/prompters.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("162f47c0241fc73c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/model.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("638942a0de2d2288")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

padding Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/prompters.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("f5a7aedde2544358")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

random_patch Ran
ran; our contract draft was wrong, not the code
zhyblue424/TGA-ZSR/models/prompters.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("cd3ffbc5192b9ccf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

attack_pgd Not yet run
unverified (harvested, no recorded run)
zhyblue424/TGA-ZSR/attacks.py
pointer only (licence: NONE) · get_code("19cc15407084e347")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

attention_map_comp Not yet run
unverified (harvested, no recorded run)
zhyblue424/TGA-ZSR/attention_map.py
pointer only (licence: NONE) · get_code("6b76c00856e7466e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

build_model Not yet run
unverified (harvested, no recorded run)
zhyblue424/TGA-ZSR/replace/model.py
pointer only (licence: NONE); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("a25e1e252d00d120")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

clamp Not yet run
unverified (harvested, no recorded run)
zhyblue424/TGA-ZSR/attacks.py
pointer only (licence: NONE) · get_code("8a93e041134b597a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

criterion Not yet run
unverified (harvested, no recorded run)
zhyblue424/tga-zsr/TGA-ZSR.py
pointer only (licence: NONE) · get_code("daa67f82354dea06")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/tga-zsr when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

criterion Not yet run
unverified (harvested, no recorded run)
zhyblue424/TGA-ZSR/Comp-TGA.py
pointer only (licence: NONE) · get_code("c70416fb0d5422ce")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zhyblue424/TGA-ZSR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 8 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 8 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
clamp 33 other papers
31 dated earlier, 2 later · 1 only as an assembly brick
1706.06083 (2017-06)
Towards Deep Learning Models Resistant to Adversarial Attacks
2001.03994 (2020-01)
Fast is better than free: Revisiting adversarial training
2002.11569 (2020-02)
Overfitting in adversarially robust deep learning
and 30 more not named here
fixed_patch 7 other papers
5 dated earlier, 2 later
2203.17274 (2022-03)
Exploring Visual Prompts for Adapting Large-Scale Models
2303.08138 (2023-03)
Diversity-Aware Meta Visual Prompting
2312.08010 (2023-12)
EZ-CLIP: Efficient Zeroshot Video Action Recognition
and 4 more not named here
padding 7 other papers
5 dated earlier, 2 later
2203.17274 (2022-03)
Exploring Visual Prompts for Adapting Large-Scale Models
2303.08138 (2023-03)
Diversity-Aware Meta Visual Prompting
2312.08010 (2023-12)
EZ-CLIP: Efficient Zeroshot Video Action Recognition
and 4 more not named here
create_logits 6 other papers
4 dated earlier, 2 later
2208.05318 (2022-08)
Generative Action Description Prompts for Skeleton-based Action Recognition
2312.03288 (2023-12)
STEP CATFormer: Spatial-Temporal Effective Body-Part Cross Attention Transformer for Skeleton-based Action Recognition
2401.04350 (2024-01)
Pre-trained Model Guided Fine-Tuning for Zero-Shot Adversarial Robustness
and 3 more not named here
random_patch 6 other papers
5 dated earlier, 1 later
2203.17274 (2022-03)
Exploring Visual Prompts for Adapting Large-Scale Models
2303.08138 (2023-03)
Diversity-Aware Meta Visual Prompting
2312.08010 (2023-12)
EZ-CLIP: Efficient Zeroshot Video Action Recognition
and 3 more not named here
build_model 2 other papers
1 dated earlier, 1 later
2401.04350 (2024-01)
Pre-trained Model Guided Fine-Tuning for Zero-Shot Adversarial Robustness
2512.12997 (2025-12)
Calibrating Uncertainty for Zero-Shot Adversarial CLIP
clip_img_preprocessing 1 other paper
1 later
2512.12997 (2025-12)
Calibrating Uncertainty for Zero-Shot Adversarial CLIP
normalize 1 other paper
1 later
2512.12997 (2025-12)
Calibrating Uncertainty for Zero-Shot Adversarial CLIP

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.21802")
get_code_for_paper("2410.21802")
have("2410.21802")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2410.21802.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2410.21802.svg)](https://syntology.ai/paper/2410.21802)

Connect an agent — have() is free.