让AI画画时自动识别并修复违规内容,不改模型也能用。
GuardPaint:SpeculativeSafetyDecodingforText-to-ImageGeneration
- 在生成过程中实时监控中间图像,定位违规区域
- 只对违规部分进行精准修复,保持画质和原意
- 适合需要安全可控图像生成的场景
文本到图像(T2I)扩散模型虽强大,但易被恶意提示诱导生成违规内容,如裸露或暴力画面。现有防护多在生成前过滤提示或生成后分类图像,无法保护扩散过程本身,常导致直接拒绝而非安全修复。我们提出GuardPaint,一种无需修改基础模型的推测性安全解码框架。轻量级审计器实时监测中间图像,定位不安全区域,并触发仅在必要区域进行的手术式修复。修复候选由符合政策的修补模型生成,通过受控淘汰赛筛选:仅当修复提升合规性、同时保持提示忠实度与感知质量时才接受。在五个越狱攻击家族(SneakPrompt、MMA、PGJ、DACA、RABell)及多个模型(SD 1.5、SDXL、SD 3.5、FLUX.1-dev)上测试,GuardPaint显著降低攻击成功率与有害生成率,且对图像质量、提示一致性与正常行为影响极小。内容警示:本文包含可能令人不适的裸露与暴力示例。
原文摘要 · Abstract (English)
Text-to-image (T2I) diffusion models offer powerful visual generation, but their controllability creates a critical safety challenge: adversarial prompts can steer the denoising trajectory toward policy-violating content such as explicit nudity or graphic violence. Existing safeguards mostly act before generation through prompt filtering or after generation through image classification, leaving the diffusion process itself unguarded and often yielding only refusal rather than safe visual repair. We introduce GuardPaint, a speculative decoding framework for safe T2I generation that intervenes inside the diffusion trajectory without modifying the base model. A lightweight auditor monitors intermediate images, localizes unsafe regions, and triggers surgical inpainting repair only where needed. Candidate repairs are generated by a policy-aligned inpainter and selected through a guarded tournament that accepts edits only when they improve policy compliance while preserving prompt fidelity and perceptual quality. Across five jailbreak families SneakPrompt, MMA, PGJ, DACA, and RABell and UNet/flow-matching models including SD~1.5, SDXL, SD~3.5, and FLUX.1-dev. GuardPaint reduces attack success and harmful generations with minimal degradation to image quality, prompt fidelity, and benign behavior. Content warning: This paper contains examples involving nudity and violence that some readers may find disturbing, distressing, or offensive.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。