Papers › Patch-Fool: Are Vision Transformers Always Robust Against Adversarial Perturbations?

Patch-Fool: Are Vision Transformers Always Robust Against Adversarial Perturbations?

16 Mar 2022ICLR 2022 4arXiv:2203.08392archive 2025-07-28

Yonggan Fu, Shunyao Zhang, Shang Wu, Cheng Wan, Yingyan Celine Lin

Vision transformers (ViTs) have recently set off a new wave in neural architecture design thanks to their record-breaking performance in various vision tasks. In parallel, to fulfill the goal of deploying ViTs into real-world vision applications, their robustness against potential malicious attacks has gained increasing attention. In particular, recent works show that ViTs are more robust against adversarial attacks as compared with convolutional neural networks (CNNs), and conjecture that this is because ViTs focus more on capturing global interactions among different input/feature patches, leading to their improved robustness to local perturbations imposed by adversarial attacks. In this work, we ask an intriguing question: "Under what kinds of perturbations do ViTs become more vulnerable learners compared to CNNs?" Driven by this question, we first conduct a comprehensive experiment regarding the robustness of both ViTs and CNNs under various existing adversarial attacks to understand the underlying reason favoring their robustness. Based on the drawn insights, we then propose a dedicated attack framework, dubbed Patch-Fool, that fools the self-attention mechanism by attacking its basic component (i.e., a single patch) with a series of attention-aware optimization techniques. Interestingly, our Patch-Fool framework shows for the first time that ViTs are not necessarily more robust than CNNs against adversarial perturbations. In particular, we find that ViTs are more vulnerable learners compared with CNNs against our Patch-Fool attack which is consistent across extensive experiments, and the observations from Sparse/Mild Patch-Fool, two variants of Patch-Fool, indicate an intriguing insight that the perturbation density and strength on each patch seem to be the key factors that influence the robustness ranking between ViTs and CNNs.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2203.08392")

Code

Syntology Ran 11 of 15 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · honoured contract; 5 ran · our draft was wrong; 3 ran · fixture could not drive it; 2 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 11 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

rice-eic/patch-fool officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 11 ran; 1 honoured the contract we drafted; 4 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
5ran · our draft was wrong
3ran · fixture could not drive it
2ran
4unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from RICE-EIC/Patch-Fool. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

np2th RICE-EIC/Patch-Fool/models/modeling.py official repository ran · fixture could not drive it MIT (permissive) · 7d8eaf5537f699e4 · report
swish RICE-EIC/Patch-Fool/models/modeling.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 0f786c407fb1ee4c · report
conv1x1 RICE-EIC/Patch-Fool/models/resnet.py official repository ran · our draft was wrong MIT (permissive) · 2a80220dabcb742a · report
conv1x1 RICE-EIC/Patch-Fool/models/modeling_resnet.py official repository ran · our draft was wrong MIT (permissive) · b0f916df39e78ae5 · report
conv3x3 RICE-EIC/Patch-Fool/models/resnet.py official repository ran · our draft was wrong MIT (permissive) · 600ff2c45e0de056 · report
conv3x3 RICE-EIC/Patch-Fool/models/modeling_resnet.py official repository ran · our draft was wrong MIT (permissive) · 4e5bf13dbdc4f008 · report
drop_block_2d RICE-EIC/Patch-Fool/models/drop.py official repository ran MIT (permissive) · 33efc9f1ccc7933c · report
drop_block_fast_2d RICE-EIC/Patch-Fool/models/drop.py official repository ran MIT (permissive) · 30d63ccefb97a166 · report
drop_path RICE-EIC/Patch-Fool/models/drop.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 3ac6b7d76e8e3584 · report
make_divisible RICE-EIC/Patch-Fool/models/patch_embed.py official repository ran · honoured contract fingerprinted MIT (permissive) · 24400bc088ed228d · report
trunc_normal_ RICE-EIC/Patch-Fool/models/vision_transformer.py official repository ran · fixture could not drive it MIT (permissive) · 02566da69866c48c · report
PCGrad RICE-EIC/Patch-Fool/utils.py official repository unverified MIT (permissive) · 832b608dd0de04f2 · report
ResNet50 RICE-EIC/Patch-Fool/models/resnet.py official repository unverified MIT (permissive) · 09aedb7b277ec32d · report
clamp RICE-EIC/Patch-Fool/utils.py official repository unverified MIT (permissive) · 8a93e041134b597a · report
get_loaders RICE-EIC/Patch-Fool/utils.py official repository unverified MIT (permissive) · 94ca6bbcc2bbe97e · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections