TL;DR
Current safety alignment methods for text-to-image (T2I) models force a frustrating trade-off, often destroying image quality and over-censoring benign artistic prompts. This paper introduces a unified framework—comprising a dual-annotated dataset (LibraAlign-100K), a composite preference optimization algorithm (T2I-SPO), and a balanced evaluation metric (UAScore)—to successfully eliminate this zero-sum trade-off and reconcile safety with high-fidelity generation.
What Problem Does This Paper Address?
When we try to make text-to-image models safe by preventing them from generating Not-Safe-For-Work (NSFW) content, we usually break their ability to make beautiful images. Existing guardrails—like concept erasure or standard safety fine-tuning—frequently cause the model to over-censor benign prompts or suffer from "catastrophic concept forgetting." For example, suppressing "nudity" might inadvertently ruin the model's ability to render harmless concepts like "skin texture" or "muscle definition."
The authors identify three systemic flaws in how T2I safety is currently handled:
- Flawed Data Paradigm: Existing safety datasets lack quality annotations, inadvertently training models that safety must come at the expense of aesthetics.
- Myopic Optimization: Current reinforcement learning and Direct Preference Optimization (DPO) frameworks focus exclusively on safety rewards. The authors call this the "Sleeping Venus Dilemma"—when asked to generate classical nude art, an aligned model typically censors it into a low-fidelity, instruction-violating image because its reward function cannot appreciate artistic value.
- One-Sided Evaluation: Standard benchmarks rely on binary classifiers (safe/unsafe) that completely ignore the generation quality of the output.
Methods
To fix these issues, the authors developed a holistic alignment framework consisting of three core components:
- Synergistic Preference Optimization (T2I-SPO): This new algorithm extends the standard Diffusion-DPO framework by introducing a composite reward function. Instead of optimizing purely for safety, the objective function explicitly balances generation quality (and prompt alignment) against a safety cost penalty.
- Safety Cost Model (SCM): To move away from rigid, binary safety labels, the authors trained an adapter on top of an Open-CLIP backbone to output a continuous safety risk score. It uses a Contrastive Ranking Loss to anchor scores (positive for harmful, negative for safe) and a Cost Anchoring Loss to ensure safe images don't suffer from high score variance.
- Dynamic Focusing Mechanism (DFM): During training, some image pairs experience optimization lag due to conflicting quality vs. safety update directions. DFM identifies these stagnant, "hard-to-learn" samples and applies targeted data augmentations (like image sharpening or color jittering) to amplify their training signals.
Datasets
The paper introduces LibraAlign-100K, the first large-scale T2I safety dataset featuring dual annotations for both safety and quality:
- LibraAlign-Coarse (90K pairs): Contains harmful images paired together, with relative harmfulness labels annotated by GPT-4o. This subset is primarily used to train the Safety Cost Model.
- LibraAlign-HF (10,760 pairs): A high-fidelity preference subset. To avoid the massive semantic shifts caused by simple prompt editing, the authors used a Safety-Aware Inpainting process. This modifies only the unsafe portions of an image while preserving the original background, composition, and artistic style. It also includes 2,495 safe-safe pairs from the Pick-a-Pic dataset to ensure the model maintains high quality in benign scenarios.
For evaluation, the authors benchmarked their method against standard datasets including I2P, I2P-Sexual, NSFW-56K, Pick-a-Pic, HPDv2, and DrawBench.
Key Insights and Ideas
- Isolating Safety via Inpainting: Traditional safety datasets alter prompts drastically (e.g., changing "nude woman" to "woman"), which introduces a bias that conflates safety with quality degradation. Using image-to-image inpainting isolates the safety variable, teaching the model exactly what to change without altering the stylistic context.
- Continuous Safety Costs: Treating safety as a spectrum rather than a binary switch prevents the optimization process from over-penalizing minor or imperceptible risks in benign images.
- The Unified Alignment Score (UAScore): The authors introduce a new metric that combines sigmoid-normalized quality scores (PickScore) and safety costs with equal weighting. This provides a much fairer, multi-dimensional metric for evaluating the true efficacy of safety guardrails.
Key Results
- Superior Safety Alignment: On the I2P-Sexual benchmark, T2I-SPO achieved the lowest Inappropriate Probability (4.40%), outperforming the unaligned SD-v1.5 baseline (31.90%) and the state-of-the-art baseline AlignGuard (10.53%).
- Resolving the Quality Trade-off: T2I-SPO achieved the highest UAScore across all three evaluated NSFW benchmarks (e.g., 0.784 on the full I2P dataset vs. AlignGuard's 0.690), demonstrating its unique ability to preserve aesthetic appeal.
- Preserving General Capabilities: When tested on entirely benign prompts (Pick-a-Pic, DrawBench), T2I-SPO matched or even slightly exceeded the original unaligned SD-v1.5 model's performance, proving that robust safety guardrails do not have to compromise general generative power.
Limitations and Future Work
The authors do not explicitly detail a dedicated limitations section within the main text. However, they note that while T2I-SPO successfully handles explicit NSFW concepts across major categories, defending against highly implicit or complex adversarial jailbreak prompts remains an ongoing challenge. Future work will likely involve scaling this synergistic alignment approach to even larger, more diverse diffusion architectures and refining the continuous safety cost model to capture subtler semantic harms.
Summary updated