TL;DR
While current safety alignment methods for text-to-image models successfully suppress harmful content without appearing to harm image quality, they actually severely degrade the model's ability to follow fine-grained prompt instructions (like object counts and attributes). The authors show this "illusion of high utility" is caused by a geometric distortion called semantic collapse in the text encoder's embedding space. To fix this, they introduce Structure-Aware Geometric Regularization (SAGE), which preserves the original embedding distribution and relational structure, recovering fine-grained prompt adherence while maintaining robust safety.
What Problem Does This Paper Address?
When we align text-to-image (T2I) diffusion models to prevent them from generating Not-Safe-For-Work (NSFW) content, we want to ensure they don't lose their core capability to generate high-quality images from benign prompts. Standard evaluations typically rely on global metrics like Fréchet Inception Distance (FID) and CLIPScore to prove that utility is preserved.
However, this paper uncovers an illusion of high utility. While global metrics look great, safety-aligned models frequently fail at fine-grained compositional tasks—such as rendering the correct number of objects, matching attributes (e.g., color), or maintaining spatial relationships.
The authors trace this issue back to the text encoder. Fine-tuning the text encoder for safety causes semantic collapse, a phenomenon where the prompt embedding space shrinks (embedding contraction) and the relative positioning of benign concepts becomes scrambled (neighborhood distortion).
Methods
To counteract semantic collapse, the authors propose Structure-Aware Geometric Regularization (SAGE), a framework that introduces two novel geometric regularization terms to the safety alignment objective:
- Embedding Spread Preservation (ESP) Loss: This directional penalty prevents the overall volume of the prompt embedding space from shrinking. It ensures that the variance (spread) of the adapted embeddings does not drop below that of the original frozen base model, preserving the model's discriminative capacity.
- Local Structure Alignment (LSA) Loss: Instead of forcing independent point-wise alignment, LSA ensures that prompts that were close neighbors in the base model's embedding space remain close neighbors after safety tuning.
Crucially, the authors discover that applying standard LSA can inadvertently weaken safety by recovering geometric patterns correlated with unsafe concepts. To solve this, they introduce a concept-perturbed variant of LSA. This variant enforces local neighborhood consistency even after the embeddings are artificially shifted along an unsafe concept direction (e.g., "nudity"), preventing adversarial bypasses.
Datasets
The authors evaluated their approach using several prominent datasets and benchmarks:
- Training: 6,911 safe-unsafe prompt pairs from the sexual category of the CoPro dataset. For generalization tests, they added 8,931 prompt pairs from violence and illegal categories.
- Fine-Grained Utility Evaluation: TIFA (Text-to-Image Faithfulness evaluation with Question Answering, containing ~4,000 prompts and >25,000 QA pairs) and GenEval (553 prompts focusing on object presence, counting, and color attribution).
- Coarse Utility Evaluation: COCO 30k dataset (used to compute standard FID and CLIPScore).
- Safety Robustness Evaluation: Evaluated against multiple jailbreak attacks (MMA-Diffusion, Sneaky Prompt, P4D, Ring-A-Bell, and the adaptive white-box U3-Attack) using the I2P benchmark and the NudeNet classifier.
Key Insights and Ideas
- Coarse Metrics are Blind to Compositionality: Global metrics like CLIPScore inherit CLIP's fundamental limitations in understanding object counts and attribute binding. As a result, they fail to register severe semantic degradation during safety tuning.
- Geometric Roots of Semantic Collapse: Safety tuning acts like a gravitational pull, collapsing distinct benign concepts into a tight, distorted region.
- Category-Specific Vulnerability: Semantic collapse does not affect all prompt categories equally. Under prior safety methods, categories like "Food" and "Material" suffer massive embedding contraction and local structure distortion, which directly correlates with a steep drop in generation accuracy for those specific topics.
Key Results
- Restored Compositional Utility: On the TIFA benchmark, SAGE achieves a score of 75.4%, coming remarkably close to the base model (76.3%) and marking a +5.0% improvement over the prior state-of-the-art text-filtering method (DES).
- Stronger Instruction Following: On GenEval, SAGE limits the performance drop to just 1.6% relative to the base model, whereas alternative methods like DES and RECE suffer drops of 6.8% and 7.6%, respectively.
- Uncompromised Safety: SAGE maintains an exceptionally low average Attack Success Rate (ASR) of 1.2% across multiple jailbreak attacks, matching or outperforming the strongest safety baselines.
Limitations and Future Work
- Text-Encoder Dependency: SAGE explicitly operates on the text encoder's embedding space. Therefore, it cannot be directly applied to safety methods that solely modify the UNet denoising backbone or rely entirely on inference-time guidance.
- Explicit Concept Specification: The framework requires developers to explicitly define the target unsafe concept (e.g., "nudity" or "violence") during training to construct the concept-perturbed regularization. The authors note that automatically discovering, localizing, and mitigating a broader, unmapped set of unsafe concepts is an important open direction for future research.
Summary updated