Modular Energy Steering for Safe Text-to-Image Generation with Foundation Models
Organizations: University of California Riverside · University of Maryland
Abstract
Controlling the behavior of text-to-image generative models is critical for safe and practical deployment. Existing safety approaches typically rely on model fine-tuning or curated datasets, which can degrade generation quality or limit scalability. We propose an inference-time steering framework that leverages gradient feedback from frozen pretrained foundation models to guide the generation process without modifying the underlying generator. Our key observation is that vision-language foundation models encode rich semantic representations that can be repurposed as off-the-shelf supervisory signals during generation. By injecting such feedback through clean latent estimates at each sampling step, our method formulates safety steering as an energy-based sampling problem. This design enables modular, training-free safety control that is compatible with both diffusion and flow-matching models and can generalize across diverse visual concepts. Experiments demonstrate state-of-the-art robustness against NSFW red-teaming benchmarks and effective multi-target steering, while preserving high generation quality on benign non-targeted prompts. Our framework provides a principled approach for utilizing foundation models as semantic energy estimators, enabling reliable and scalable safety control for text-to-image generation.
Figures & tables
| Safety Methods | Method Properties | Attack Success Rate ( ) | COCO-30K | |||||
| Weight modified | External dataset | P4D | Ring- A-Bell | MMA- Diffusion | Unlearn- DiffAtk | FID ( ) | CLIP ( ) | |
| Original SD ( Rombach et al., 2022 ) | – | – | 0.934 | 0.747 | 0.952 | 0.676 | 20.50 | 31.48 2.96 |
| SAFREE ( Yoon et al., 2025 ) | ✗ | ✗ | 0.404 | 0.088 | 0.590 | 0.254 | 23.51 | 31.09 3.09 |
| CURE ⋆ ( Biswas et al., 2025 ) | ✓ | ✗ | 0.107 | 0.013 | 0.169 | 0.281 | – | 31.18 |
| SafeDenoiser ⋆ ( Kim et al., 2025 ) | ✗ | ✓ | – | 0.127 | 0.469 | 0.207 | 22.55 | 30.66 |
| SGF ⋆ ( Kim et al., 2026 ) | ✗ | ✓ | – | 0.051 | 0.297 | 0.164 | 23.73 | 30.36 |
| Safety Method | Attack Success Rate ( ) | COCO-30K | ||||
| P4D | Ring-A-Bell | MMA-Diffusion | Unlearn-DiffAtk | FID ( ) | CLIP ( ) | |
| Original SD ( Esser et al., 2024 ) | 0.701 | 0.620 | 0.639 | 0.570 | 29.04 | 32.01 |
| SAFREE ⋆ ( Yoon et al., 2025 ) | 0.271 | 0.430 | 0.165 | 0.302 | – | 31.55 |
| Ours (CLIP) | 0.224 | 0.215 | 0.137 | 0.176 | 56.26 | 31.26 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Model Variant | Attack Success Rate ( ) | COCO-1K | ||||
| P4D | Ring-A-Bell | MMA-Diffusion | Unlearn-DiffAtk | FID ( ) | CLIP ( ) | |
| ViT-B-32 | 0.054 | 0.013 | 0.078 | 0.070 | 75.13 | 31.00 |
| ViT-L-14 | 0.068 | 0.025 | 0.063 | 0.077 | 74.91 | 31.00 |
| ViT-H-14 | 0.061 | 0.051 | 0.109 | 0.141 | 87.53 | 30.78 |
| ViT-bigG-14 | 0.088 | 0.025 | 0.074 | 0.063 | 81.77 | 30.82 |
| InternVL2-1B | 0.041 | 0.051 | 0.086 | 0.014 | 143.31 | 29.98 |
| Safety Method | Attack Success Rate ( ) | COCO-30K | ||||
| P4D | Ring-A-Bell | MMA-Diffusion | Unlearn-DiffAtk | FID ( ) | CLIP ( ) | |
| Original SD | 0.585 | 0.684 | 0.719 | 0.458 | 25.60 | 32.15 |
| Ours (CLIP) | 0.082 | 0.127 | 0.042 | 0.099 | 35.28 | 31.53 |
Safe T2I Generation
Safe text-to-image generation develops methods to prevent harmful images while preserving useful, faithful outputs.
See all 52 papers