arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.15197cs.CV

Detect-and-Guide:通过准则Token优化实现扩散模型自调节的安全文本到图像生成

Detect-and-Guide: Self-regulation of Diffusion Models for Safe Text-to-Image Generation via Guideline Token Optimization

School of Computer Science, Fudan University(复旦大学计算机科学学院)

Feifei Li, Mi Zhang, Yiming Sun, Min Yang

AI总结:

针对文本到图像扩散模型易生成有害内容、现有干预方法可解释性差且影响生成效果的问题,提出无需微调的Detect-and-Guide框架,通过优化Token的交叉注意力检测有害概念并自适应引导,实现了安全生成性能与文本遵循性的平衡。

摘要:

文本到图像扩散模型已在合成任务中取得了当前最优(SOTA)结果,但人们日益担忧其可能被滥用于生成有害内容。为降低这类风险,学界已开发出概念遗忘、安全引导等事后模型干预技术。然而,微调模型权重或调整扩散模型隐状态的操作缺乏可解释性,无法明确中间变量的哪一部分导致了不安全生成;这类干预在从复杂的多概念提示中擦除有害概念时,会严重干扰采样轨迹,阻碍了其在真实场景中的实际应用。\n本研究提出安全生成框架Detect-and-Guide(DAG,检测-引导),利用扩散模型的内部知识,在采样过程中实现自诊断与细粒度自调节。DAG首先借助优化后Token的精细化交叉注意力图,从含噪隐变量中检测有害概念,随后施加具有自适应强度与编辑区域的安全引导,以抵消不安全生成。该优化仅需小型标注数据集,即可生成具备泛化性与概念特异性的精确检测图。此外,DAG无需微调扩散模型,因此不会造成生成多样性的损失。\n在擦除色情内容的实验中,DAG取得了当前最优的安全生成性能,在多概念真实场景提示的有害性抑制与文本遵循性能之间实现了平衡。

英文摘要:

Text-to-image diffusion models have achieved state-of-the-art results in synthesis tasks; however, there is a growing concern about their potential misuse in creating harmful content. To mitigate these risks, post-hoc model intervention techniques, such as concept unlearning and safety guidance, have been developed. However, fine-tuning model weights or adapting the hidden states of the diffusion model operates in an uninterpretable way, making it unclear which part of the intermediate variables is responsible for unsafe generation. These interventions severely affect the sampling trajectory when erasing harmful concepts from complex, multi-concept prompts, thus hindering their practical use in real-world settings. In this work, we propose the safe generation framework Detect-and-Guide (DAG), leveraging the internal knowledge of diffusion models to perform self-diagnosis and fine-grained self-regulation during the sampling process. DAG first detects harmful concepts from noisy latents using refined cross-attention maps of optimized tokens, then applies safety guidance with adaptive strength and editing regions to negate unsafe generation. The optimization only requires a small annotated dataset and can provide precise detection maps with generalizability and concept specificity. Moreover, DAG does not require fine-tuning of diffusion models, and therefore introduces no loss to their generation diversity. Experiments on erasing sexual content show that DAG achieves state-of-the-art safe generation performance, balancing harmfulness mitigation and text-following performance on multi-concept real-world prompts.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑