@inproceedings{7f81cc898d3e43e1a3270b28058a7dad,
title = "Universal Prompt Optimizer for Safe Text-to-Image Generation WARNING: This paper contains offensive images generated by models",
abstract = "Text-to-Image (T2I) models have shown great performance in generating images based on textual prompts. However, these models are vulnerable to unsafe input to generate unsafe content like sexual, harassment and illegal-activity images. Existing studies based on image checker, model fine-tuning and embedding blocking are impractical in real-world applications. Hence, we propose the first universal prompt optimizer for safe T2I (POSI) generation in black-box scenario. We first construct a dataset consisting of toxic-clean prompt pairs by GPT-3.5 Turbo. To guide the optimizer to have the ability of converting toxic prompt to clean prompt while preserving semantic information, we design a novel reward function measuring toxicity and text alignment of generated images and train the optimizer through Proximal Policy Optimization. Experiments show that our approach can effectively reduce the likelihood of various T2I models in generating inappropriate images, with no significant impact on text alignment. It is also flexible to be combined with methods to achieve better performance. Our code is available at https://github.com/wzongyu/POSI.",
author = "Zongyu Wu and Hongcheng Gao and Yueze Wang and Xiang Zhang and Suhang Wang",
note = "Publisher Copyright: {\textcopyright} 2024 Association for Computational Linguistics.; 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL 2024 ; Conference date: 16-06-2024 Through 21-06-2024",
year = "2024",
language = "English (US)",
series = "Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL 2024",
publisher = "Association for Computational Linguistics (ACL)",
pages = "6340--6354",
editor = "Kevin Duh and Helena Gomez and Steven Bethard",
booktitle = "Long Papers",
}