DiSCO Enhances Text-to-Image Safety Against Harmful Content Generation

Tong Zhang, Motasem Alfarra, Carlos Hinojosa, Christos Louizos, Bernard Ghanem· August 19, 2026 View original

Key takeaways

  • DiSCO is a black-box defense for text-to-image models against NSFW content.
  • It optimizes prompts through distribution-guided suffix expansion and contrastive scoring.
  • The method significantly reduces attack success rates without requiring model retraining.
  • It offers a scalable and architecture-agnostic solution for AI safety.

Who benefits

Media & EntertainmentAdvertisingE-commerceSocial MediaAI Development

Summary

Researchers introduce DiSCO, a black-box defense mechanism that optimizes prompts to prevent text-to-image models from generating Not-Safe-For-Work (NSFW) content, even against adversarial attacks. It works by expanding prompts with safe suffixes guided by contrastive scoring, without needing model retraining or internal access.

Text-to-image generative AI models face significant safety challenges, particularly in preventing the creation of harmful content like violence or nudity, which can be triggered by adversarial "red-teaming" attacks. Current defense strategies often require access to the model's internal workings, making them unsuitable for proprietary systems. A new approach, DiSCO, addresses this by offering a strictly black-box defense that operates solely at the prompt level. DiSCO tackles the "benign adversarial" problem, where seemingly safe prompts can still lead to harmful outputs due to the model's underlying data distribution. It employs a distribution-guided suffix expansion technique, using beam search and contrastive scoring against safe and unsafe image pools generated by the target model. This iterative feedback loop aims to produce safe content. The method has been shown to significantly improve the safety of both undefended and previously defended models on standard benchmarks, reducing attack success rates while maintaining the quality and relevance of the generated images. Its plug-and-play nature and independence from model architecture make it broadly applicable to any text-to-image system.

Why it matters

Professionals deploying or integrating text-to-image AI need robust, scalable solutions to mitigate the risks of generating harmful content and ensure responsible AI use.

How to implement this in your domain

  1. 1Evaluate existing text-to-image deployments for potential vulnerabilities to harmful content generation.
  2. 2Integrate black-box prompt optimization modules like DiSCO into your AI safety pipeline.
  3. 3Develop internal guidelines for prompt engineering that incorporate safety-enhancing techniques.
  4. 4Regularly test your generative AI systems against red-teaming attacks to assess defense effectiveness.

Original post by Tong Zhang, Motasem Alfarra, Carlos Hinojosa, Christos Louizos, Bernard Ghanem

"arXiv:2608.17067v1 Announce Type: new Abstract: As text-to-image generative models advance, they raise critical safety concerns, particularly the generation of Not-Safe-For-Work (NSFW) content such as violence and nudity, further exacerbated by red-teaming adversarial attacks. Ex…"

View on X

Originally posted by Tong Zhang, Motasem Alfarra, Carlos Hinojosa, Christos Louizos, Bernard Ghanem on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses

More in AI Engineering & DevTools