Papers › GuardT2I: Defending Text-to-Image Models from Adversarial Prompts

GuardT2I: Defending Text-to-Image Models from Adversarial Prompts

3 Mar 2024arXiv:2403.01446archive 2025-07-28

Yijun Yang, Ruiyuan Gao, Xiao Yang, Jianyuan Zhong, Qiang Xu

Recent advancements in Text-to-Image (T2I) models have raised significant safety concerns about their potential misuse for generating inappropriate or Not-Safe-For-Work (NSFW) contents, despite existing countermeasures such as NSFW classifiers or model fine-tuning for inappropriate concept removal. Addressing this challenge, our study unveils GuardT2I, a novel moderation framework that adopts a generative approach to enhance T2I models' robustness against adversarial prompts. Instead of making a binary classification, GuardT2I utilizes a Large Language Model (LLM) to conditionally transform text guidance embeddings within the T2I models into natural language for effective adversarial prompt detection, without compromising the models' inherent performance. Our extensive experiments reveal that GuardT2I outperforms leading commercial solutions like OpenAI-Moderation and Microsoft Azure Moderator by a significant margin across diverse adversarial scenarios. Our framework is available at https://github.com/cure-lab/GuardT2I.

PaperPDFCodeCode 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="2403.01446")

Code

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

By repository: official repository: 3 samples from 1 repository, 1 ran; community (archive-listed): 9 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cure-lab/guardt2i officialmentioned in papermentioned on GitHubpytorch report
cure-lab/mma-diffusion mentioned on GitHubpytorch report
yangyijune/mma-diffusion mentioned on GitHubpytorchNOASSERTION 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.

2ran · violated contract
2ran · our draft was wrong
1ran · fixture could not drive it
4ran
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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

check_words cure-lab/guardt2i/evaluation.py official repository ran · violated contract no licence file found · pointer only · e432fc8d1c6d470a · report
eval_decoder cure-lab/guardt2i/training_code/train_cllm.py official repository unverified no licence file found · pointer only · 42734f935fcb7396 · report
train_decoder cure-lab/guardt2i/training_code/train_cllm.py official repository unverified no licence file found · pointer only · 5fde6cab839cbeb2 · report
cosine_distance yangyijune/mma-diffusion/src/image_space_attack/image_editing_attack.py community (archive-listed) ran · violated contract fingerprinted no licence file found · pointer only · c8f23038de7bcdb7 · report
decode_latents yangyijune/mma-diffusion/src/image_space_attack/image_editing_attack.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · 13dc2cf88597bab9 · report
denoise_and_dilate yangyijune/mma-diffusion/src/image_space_attack/image_editing_attack.py community (archive-listed) ran licence not identified · pointer only · e72218600c06eb3d · report
logits yangyijune/mma-diffusion/src/textual_attack.py community (archive-listed) ran · fixture could not drive it no licence file found · pointer only · f1d34b6601986ffa · report
prepare_mask_and_masked_image yangyijune/mma-diffusion/src/image_space_attack/utils.py community (archive-listed) ran no licence file found · pointer only · 3e43cde496b041c3 · report
preprocess yangyijune/mma-diffusion/src/image_space_attack/utils.py community (archive-listed) ran licence not identified · pointer only · 84f6eb64e73f1bbb · report
recover_image yangyijune/mma-diffusion/src/image_space_attack/utils.py community (archive-listed) ran licence not identified · pointer only · 6cecfc267a0132f7 · report
token_gradient yangyijune/mma-diffusion/src/textual_attack.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · f99e03e03e6b2072 · report
sample_control yangyijune/mma-diffusion/src/textual_attack.py community (archive-listed) unverified no licence file found · pointer only · 64762d38e7f09b9a · report

Tasks

Binary ClassificationLanguage ModelingLanguage ModellingLarge Language Model

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