Papers › Robustness in Both Domains: CLIP Needs a Robust Text Encoder

Robustness in Both Domains: CLIP Needs a Robust Text Encoder

3 Jun 2025arXiv:2506.03355archive 2025-07-28

Elias Abad Rocamora, Christian Schlarmann, Naman Deep Singh, Yongtao Wu, Matthias Hein, Volkan Cevher

Adversarial input attacks can cause a significant shift of CLIP embeddings. This can affect the downstream robustness of models incorporating CLIP in the pipeline, such as text-to-image generative models or large vision language models. While some efforts have been done towards making the CLIP image encoders robust, the robustness of text encoders remains unexplored. In this work, we cover this gap in the literature. We propose LEAF: an efficient adversarial finetuning method for the text domain, with the ability to scale to large CLIP models. Our models significantly improve the zero-shot adversarial accuracy in the text domain, while maintaining the vision performance provided by robust image encoders. When combined with text-to-image diffusion models, we can improve the generation quality under adversarial noise. When employing our robust CLIP encoders in multimodal retrieval tasks, we improve the recall under adversarial noise over standard CLIP models. Finally, we show that robust text encoders facilitate better reconstruction of input text from its embedding via direct optimization.

PaperPDFCode 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="2506.03355")

Code

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

By repository: found in paper text by Syntology: 11 samples from 1 repository, 8 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

LIONS-EPFL/LEAF found in paper text by Syntology 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

12 samples harvested; 9 ran; 0 honoured the contract we drafted; 3 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.

4ran · our draft was wrong
4ran · fixture could not drive it
1ran
3unverified

Licence: 12 of the 12 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 LIONS-EPFL/LEAF. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “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.

ComputeLossWrapper LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran no licence file found · pointer only · 04f1b42c2632778c · report
ce LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · fixture could not drive it no licence file found · pointer only · f06d36585e5d6dec · report
compute_loss LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · fixture could not drive it no licence file found · pointer only · 3bdfc4201b35c55b · report
l1 LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · 2a8adc0b6b7fe4f7 · report
l2 LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · caea55e9eda399d6 · report
normalize_grad LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · fixture could not drive it fingerprinted no licence file found · pointer only · 6fffb629c7f9b304 · report
pgd LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · f9a6cd97c45d4f91 · report
project_perturbation LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology ran · fixture could not drive it no licence file found · pointer only · 74d23c944bf73c1e · report
evaluate LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology unverified no licence file found · pointer only · c5a17635441cc52d · report
train_one_epoch LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology unverified no licence file found · pointer only · bca77f125ea3f056 · report
unwrap_model LIONS-EPFL/LEAF/src/robust_vlm/train/adversarial_training_clip.py found in paper text by Syntology unverified no licence file found · pointer only · a72cc58ae0995b23 · report
compute_acc identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · 1f2be2216dc3f7cd · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

CLIPDiffusion

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