Abstract
Training multimodal generative models on large, uncurated datasets can result in users being exposed to harmful, unsafe and controversial or culturally-inappropriate outputs. While model editing has been proposed to remove or filter undesirable concepts in embedding and latent spaces, it can inadvertently damage learned manifolds, distorting concepts in close semantic proximity. We identify limitations in current model editing techniques, showing that even benign, proximal concepts may become misaligned. To address the need for safe content generation, we leverage safe embeddings and a modified diffusion process with tunable weighted summation in the latent space to generate safer images. Our method preserves global context without compromising the structural integrity of the learned manifolds. We achieve state-of-the-art results on safe image generation benchmarks and offer intuitive control over the level of model safety. We identify trade-offs between safety and censorship, which presents a necessary perspective in the development of ethical AI models. We will release our code.
Introduction: The Problem of Semantic Disruption
Current efforts to ensure safety in text-to-image models often rely on "model editing" to erase undesirable concepts such as nudity or violence from the model's internal latent manifold. However, these concepts are not isolated; they exist within a complex web of semantic relationships.
The authors identify a phenomenon termed Semantic Disruption. Because unsafe concepts are often semantically proximal to benign ones (e.g., "blood" is close to "red"), erasing harmful content often inadvertently warps benign representations. For instance, a model edited to remove violence might fail to render a "red floor" correctly, replacing it with unrelated objects because the manifold has been damaged. This "collateral damage" compromises the artistic integrity and global context of generated scenes.
Methodology: Context-preserving Dual Latent Reconstruction
To address these issues, this work introduces an editing-free approach called Context-preserving Dual Latent Reconstruction. This method avoids altering model weights entirely, thereby maintaining the structural integrity of the original learned manifold.
The pipeline consists of several key stages:
- Safety Spectrum & Detection: An input detector (using a Nearest-Neighbor classifier or an LLM) identifies "irresponsible" prompts. If flagged, the system generates a "safe alternative" embedding (e.g., substituting "peaceful interaction" for "bloody severed head").
- Dual Latent Reconstruction: The model performs two parallel denoising processes in the latent space. One follows the original (unsafe) prompt to capture "global context" (composition, lighting, background), while the other follows the safe alternative.
- Piecewise Denoising: These two paths are merged via weighted summation. A tunable threshold ($\tau_{gc}$) controls the balance between context preservation and safety. Typically, the original prompt's layout is prioritized in early generation stages to establish the scene, followed by safe guidance in later stages to refine specific objects.
Evaluation and Results
The authors introduce the Safety Disruption (SaDi) Index to quantify the deformation of benign concepts proximal to removed ones. Evaluation was conducted using the I2P (Inappropriate Image Prompts) benchmark and the ViSU (Visual Safe-Unsafe) dataset.
Key Findings:
- Superior Safety Performance: On the I2P benchmark, the proposed method achieved a safety score of 11.9 (lower is better), outperforming the base Stable Diffusion v2.1 (36.9) and specialized models like SLD-Strong (12.4).
- Zero Manifold Damage: By avoiding weight editing, the method maintains a 0.0 score on the Semantic Disruption ($\Delta_P$) scale, whereas traditional editing techniques showed significant manifold warping.
- Context Preservation: Qualitative results demonstrate the ability to replace harmful features (e.g., "bloody" elements) with benign alternatives (e.g., red fabric) while keeping the rest of the image's composition identical.
- Tunable Safety: The "Safety Spectrum" allows users to adjust hyperparameters to find the optimal balance between strict censorship and preservation of artistic intent.
Conclusion
This research highlights that model editing is often a destructive process that "lobotomizes" parts of a generative model. By shifting to an editing-free, dual-latent reconstruction approach, it is possible to achieve high safety standards without sacrificing the semantic richness or global context of the model. Future work will focus on reducing the inference overhead associated with dual-path generation and further refining the blending of latents to minimize visual artifacts.
Keywords: Text-to-Image Models, Generative AI, Safety, Reliability, Model Editing
Summary updated