让AI画画时自动识别并局部清除不当内容,不全拦也不放任。
Disciplined Diffusion: Text-to-Image Diffusion Model against NSFW Generation

- 通过分析提示词的语义分布,发现隐含恶意意图。
- 生成时只修改有害区域,保留其他部分清晰度。
- 适合需要安全可控图像生成的开发者和平台使用。
文本到图像扩散模型能根据文字描述生成高质量图像,但可能因恶意输入生成不当内容。现有安全过滤器多依赖文本或图像分类器,一旦检测即完全阻止输出,采用明确的允许/拒绝反馈。这种二元策略易被恶意关键词绕过,且误报率高,影响正常用户体验。为此,我们提出受控扩散(DDiffusion),通过语义检索机制评估提示词与概念分布的匹配度,而非依赖脆弱的相似性判断。同时,在扩散过程中引入定位方法,仅对生成图像中的有害区域进行局部修正。相比整体阻断,该方法在抑制恶意内容的同时保持良性提示的生成质量,避免了传统系统依赖的二元反馈信号,有效抵御探测攻击。
原文摘要 · Abstract (English)
Text-to-image (T2I) diffusion models have the ability to build high-quality pictures from text prompts, but they pose safety concerns because they can generate offensive or disturbing imagery when provided with harmful inputs. Existing safety filters typically rely on text-based classifiers or image-based checkers that completely block the output upon detecting a threat, issuing an explicit allow/block feedback signal to the user. This binary strategy leaves models vulnerable to adversarial attacks that alter keywords to bypass detection, and it causes high false-alarm rates that degrade the experience for benign users. To address such vulnerabilities, we propose Disciplined Diffusion (DDiffusion), a novel robust text-to-image diffusion that counters Not Safe For Work (NSFW) generation by uncovering implicit malicious semantics in prompt embeddings. DDiffusion leverages a semantic retrieval mechanism to evaluate prompts against concept distributions rather than relying on brittle pairwise similarity. Furthermore, it employs a localization method during the diffusion process to selectively edit only the harmful regions of the generated image. By returning locally sanitized images instead of applying uniform blocking, DDiffusion suppresses malicious content while preserving generation fidelity for benign prompts and avoiding the binary allow-deny signal on which existing probing attacks rely.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。