SafeGuider Drops Harmful Image Generation Attacks From 97% to 5%
Researchers from USTC, NTU and A*STAR unveil SafeGuider at ACM CCS 2025, a two-step defense that replaces Stable Diffusion's brittle safety checker with an embedding-level guard.
Takeaways
- SafeGuider, accepted at ACM CCS 2025, replaces Stable Diffusion's leaky image-level safety checker.
- Discovery: CLIP's [EOS] token separates benign and adversarial prompts with MMD up to 0.993.
- Two-step design: lightweight MLP recognizer plus SAFE beam search to sanitize prompts.
- Max attack success rate of 5.48% versus 64-99% for existing filters like OpenAI Moderation.
- Keeps 100% benign generation rate; CLIP score 27.50 versus 27.52 for original Stable Diffusion.
- Transfers to SD 2.1 and Flux.1; open-source code available.
A team from the University of Science and Technology of China, Nanyang Technological University, and A*STAR has published SafeGuider, a content-safety framework for text-to-image models accepted at ACM CCS 2025. The work targets a known weakness in the widely used CompVis stable-diffusion-safety-checker and similar filters, which leak harmful content under adversarial prompts and degrade user experience by returning black images.
Why current safety checkers keep failing
Text-to-image models are highly vulnerable to adversarial prompts, and despite various defensive strategies, achieving robustness while maintaining practical utility remains difficult. The paper groups attacks into two families: vocabulary substitution, where explicit words are swapped for euphemisms, and symbol injection, where seemingly meaningless tokens like athleticbare tless guiding nsfw align with harmful concepts in the embedding space.
The authors benchmark ten existing defenses on Stable Diffusion V1.4. Commercial moderation APIs and the built-in image-level Safety Checker all show large gaps, especially on out-of-distribution attacks. Two failure modes dominate:
- Internal defenses like ESD, SLD, and SafeGen distort benign generations because they modify model weights.