SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editing

Ruiyang Zhang, Jiahao Luo, Xiaoru Feng, Qiufan Pang, Yaodong Yang, Juntao Dai · Submission to ICLR 2026 · Withdrawn

TL;DR

Existing safety interventions for text-to-image (T2I) models either aggressively block benign prompts (over-refusal) or rewrite prompts before generation, leading to massive loss of intent and quality. SafeEditor flips this dynamic by introducing a plug-and-play, post-hoc editing paradigm: an interleaved multimodal LLM that analyzes generated images against safety policies, reasons about violations, and iteratively applies minimal, semantic-preserving visual edits to make them safe while keeping user utility intact.

What Problem Does This Paper Address?

Inference-time safety guards for T2I generation generally fall into two camps:

  1. Content Filtering: Classifiers placed at the prompt or image level that outright reject potentially unsafe inputs/outputs. These frequently suffer from severe over-refusal—blocking harmless prompts that merely touch on sensitive themes.
  2. Pre-hoc Prompt Modification: Rewriting prompts via language models before image synthesis. Because the rewriter operates blind to the actual visual outcome, it often strips essential user intent, causing severe drops in text-image alignment.

The fundamental disconnect is that humans evaluate safety post hoc (after viewing an image) and can distinguish benign contexts or suggest targeted fixes. The authors tackle how to enforce safety after generation without rejecting prompts or butchering image fidelity.

Methods

SafeEditor addresses this with a model-agnostic, multi-round post-hoc safety editing pipeline:

  • The Post-Hoc Editing Paradigm: Instead of terminating a generation upon detecting unsafe concepts, the system uses an interleaved Multimodal Large Language Model (MLLM) to inspect the image, provide an explicit natural language critique against safety rules, and generate an edited visual version.
  • MR-SafeEdit Dataset Construction: The authors synthesize a dataset of multi-round editing traces using GPT-4o and Stable Diffusion 3.5. For each round, GPT-4o generates a structured response consisting of:
  • Text Thought: An image-focused chain-of-thought detailing safety violations against specific content policies and suggesting image-level adjustments (e.g., using abstraction or stylization instead of explicit blood).
  • Decision: Either Accept or Refine.
  • Refined Prompt: Used internally to synthesize the next candidate image.
  • SafeEditor Architecture & Training: SafeEditor is instantiated on Nexus-Gen, a unified MLLM combining an autoregressive vision-language backbone with a diffusion decoder. The LLM backbone is fine-tuned end-to-end on single-round input/output pairs derived from MR-SafeEdit (frozen image decoder, full LLM tuning). At inference, it accepts (prompt, image) and iteratively outputs reasoning text and edited images until it issues an Accept decision.
[Prompt + Initial Image] 
         │
         ▼
   SafeEditor (MLLM) ──► Generates "Text Thought" & Safety Critique
         │
    Decision: Refine?
   ┌─────┴─────┐
   ▼           ▼
[Yes]        [No] ──► Output Safe Image
   │
   ▼
Generates Edited Image ──► Loops into Round n+1

Datasets

  • MR-SafeEdit (New): 27,253 multi-round editing traces spanning up to 4 rounds. Formed by collecting 21,753 unsafe prompts across 6 risk categories (sexual, violence, harassment, shocking, hate, illegal activity) from T2ISafety, P4D, and CoPro, plus 5,500 safe prompts from HPD-v2.
  • Evaluation Benchmarks:
  • I2P: ~4,700 real-world malicious prompts.
  • SneakyPrompt: 200 adversarial sexual prompts designed to bypass safety filters.
  • COCO-2017: 1,000 benign prompts evaluated for image preservation.
  • OVERT: 4,600 benign-yet-sensitive prompts and 1,785 genuinely harmful prompts specifically designed to benchmark over-refusal.

Key Insights and Ideas

  • Textual Reasoning as a Necessary Bridge: An ablation removing the textual reasoning step (SafeEditor-Image) caused a dramatic collapse in utility. Formulating an explicit textual explanation of how an image violates policy and what visual adjustments to make is crucial for guiding high-quality, minimal edits.
  • Aesthetic Compensation Over Semantic Stripping: When SafeEditor softens unsafe elements (e.g., rendering gore as abstract color splashes or stylistic textures), text alignment (CLIP score) slightly drops, but aesthetic scores increase. The model achieves safety by reinterpreting requests artistically rather than gutting the image.
  • Plug-and-Play Model Agnosticism: Because SafeEditor only requires an input prompt and an initial generated image, it operates independently of how the base image was generated (diffusion, autoregressive, or hybrid).

Key Results

  • Elimination of Over-Refusal: On benign/borderline prompts, filter-based baselines like ImageGuard and LatentGuard produced false positive rates (FPR) between 16.75% and 37.67%. SafeEditor slashed over-refusal to 0.35% on I2P, 0.00% on SneakyPrompt, and 0.13% on OVERT.
  • Superior Safety–Utility Trade-off: Compared against prompt-rewriting guards on Stable Diffusion-1.4:
  • PromptGuard heavily compromised utility: its CLIP score dropped from 33.57 to 25.056.
  • SafeEditor maintained a 32.55 CLIP score, achieved the lowest perceptual distortion (0.5073 LPIPS vs. 0.5074 base self-similarity), and earned the highest Unsafe Intent Alignment score (1.878 UIA), while simultaneously elevating the safety ratio from 85.26% to 94.35%.
  • Cross-Model Generalization: Applied downstream to Stable Diffusion 3.5, JanusPro, and Show-o, SafeEditor consistently reduced unsafe ratios with negligible degradation to text-image alignment scores.

Limitations and Future Work

  • Policy Coverage: The taxonomy currently covers six primary physical and social safety categories, excluding context-dependent dimensions such as political sensitivity, misinformation, or fairness/bias.
  • "Over-Caution" in Deep Rounds: Analysis revealed that extending editing across too many rounds can occasionally lead to conservative drift and reduced overall visual quality.
  • Lack of Preference Post-Training: SafeEditor is currently trained via supervised fine-tuning; the authors note that incorporating reinforcement learning from human/AI feedback (RLHF/DPO) represents an open opportunity for performance improvement.

Summary updated

Abstract

With the rapid advancement of text-to-image (T2I) models, ensuring their safety has become increasingly critical. Existing safety approaches can be categorized into training-time and inference-time methods. While inference-time methods are widely adopted due to their cost-effectiveness, they often suffer from limitations such as over-refusal and imbalance between safety and utility. To address these challenges, we propose a multi-round safety editing framework that functions as a model-agnostic, plug-and-play module, enabling efficient safety alignment for any text-to-image model. Central to this framework is MR-SafeEdit, a multi-round image–text interleaved dataset specifically constructed for safety editing in text-to-image generation. We introduce a post-hoc safety editing paradigm that mirrors the human cognitive process of identifying and refining unsafe content. To instantiate this paradigm, we develop SafeEditor, a unified MLLM capable of multi-round safety editing on generated images. Experimental results show that SafeEditor surpasses prior safety approaches by reducing over-refusal while achieving a more favorable safety–utility balance.
BibTeX
@misc{zhang2025safeeditor,
  author = {Ruiyang Zhang and Jiahao Luo and Xiaoru Feng and Qiufan Pang and Yaodong Yang and Juntao Dai},
  title = {{SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editing}},
  year = {2025},
  eprint = {2510.24820},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.24820},
}
Figure