Saved in:
Bibliographic Details
Main Authors: Pan, Jiadong, Li, Liang, Gao, Hongcheng, Zha, Zheng-Jun, Huang, Qingming, Luo, Jiebo
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2412.16039
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912401612341248
author Pan, Jiadong
Li, Liang
Gao, Hongcheng
Zha, Zheng-Jun
Huang, Qingming
Luo, Jiebo
author_facet Pan, Jiadong
Li, Liang
Gao, Hongcheng
Zha, Zheng-Jun
Huang, Qingming
Luo, Jiebo
contents Diffusion models (DMs) have demonstrated exceptional performance in text-to-image tasks, leading to their widespread use. With the introduction of classifier-free guidance (CFG), the quality of images generated by DMs is significantly improved. However, one can use DMs to generate more harmful images by maliciously guiding the image generation process through CFG. Existing safe alignment methods aim to mitigate the risk of generating harmful images but often reduce the quality of clean image generation. To address this issue, we propose SafeCFG to adaptively control harmful features with dynamic safe guidance by modulating the CFG generation process. It dynamically guides the CFG generation process based on the harmfulness of the prompts, inducing significant deviations only in harmful CFG generations, achieving high quality and safety generation. SafeCFG can simultaneously modulate different harmful CFG generation processes, so it could eliminate harmful elements while preserving high-quality generation. Additionally, SafeCFG provides the ability to detect image harmfulness, allowing unsupervised safe alignment on DMs without pre-defined clean or harmful labels. Experimental results show that images generated by SafeCFG achieve both high quality and safety, and safe DMs trained in our unsupervised manner also exhibit good safety performance.
format Preprint
id arxiv_https___arxiv_org_abs_2412_16039
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle SafeCFG: Controlling Harmful Features with Dynamic Safe Guidance for Safe Generation
Pan, Jiadong
Li, Liang
Gao, Hongcheng
Zha, Zheng-Jun
Huang, Qingming
Luo, Jiebo
Computer Vision and Pattern Recognition
Diffusion models (DMs) have demonstrated exceptional performance in text-to-image tasks, leading to their widespread use. With the introduction of classifier-free guidance (CFG), the quality of images generated by DMs is significantly improved. However, one can use DMs to generate more harmful images by maliciously guiding the image generation process through CFG. Existing safe alignment methods aim to mitigate the risk of generating harmful images but often reduce the quality of clean image generation. To address this issue, we propose SafeCFG to adaptively control harmful features with dynamic safe guidance by modulating the CFG generation process. It dynamically guides the CFG generation process based on the harmfulness of the prompts, inducing significant deviations only in harmful CFG generations, achieving high quality and safety generation. SafeCFG can simultaneously modulate different harmful CFG generation processes, so it could eliminate harmful elements while preserving high-quality generation. Additionally, SafeCFG provides the ability to detect image harmfulness, allowing unsupervised safe alignment on DMs without pre-defined clean or harmful labels. Experimental results show that images generated by SafeCFG achieve both high quality and safety, and safe DMs trained in our unsupervised manner also exhibit good safety performance.
title SafeCFG: Controlling Harmful Features with Dynamic Safe Guidance for Safe Generation
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2412.16039