Introduction
The rapid evolution of text-to-image (T2I) models has revolutionized digital creativity, yet it has simultaneously introduced significant safety risks. While commercial platforms like DALL·E 3 implement proprietary, multi-layered safety filters, the open-source ecosystem—led by models like Stable Diffusion—often lacks comparable safeguards. This discrepancy creates a "safety gap," where open-source models can be easily manipulated to generate toxic content, including explicit imagery, violence, and harmful social biases.
Ethical-Lens addresses this challenge by introducing a "plug-and-play" safety framework designed specifically for open-source environments. Unlike traditional methods that require expensive model retraining or weight modification, Ethical-Lens acts as an external scrutiny layer, regulating both user inputs and model outputs without degrading image quality.
The Ethical-Lens Architecture
Ethical-Lens operates through a two-stage pipeline that scrutinizes content at the prompt level and the pixel level.
1. Ethical Text Scrutiny
When a user submits a prompt, a lightweight Large Language Model (LLM)—distilled for high-speed performance—analyzes the text for toxicity and bias. Rather than simply blocking problematic prompts, the system attempts to revise them. For instance, if a prompt lacks demographic specificity, the LLM may inject diverse attributes (age, race, gender) to prevent the model from defaulting to stereotypical representations.
2. Ethical Image Scrutiny
After the T2I model generates an image, it undergoes a secondary check using a multi-headed classifier based on CLIP. This stage detects violations such as nudity, NSFW content, or the presence of public figures. Depending on the detected violation, the system employs specific editing strategies:
- Local Editing (CLIPFluzz): This technique uses segmentation to identify and blur only the problematic regions of an image, such as the faces of public figures or sensitive anatomical areas, while preserving the rest of the composition.
- Global Editing: If an image is deemed systemically offensive, the system triggers a complete regeneration based on a revised prompt.
- Face Editing (AdaTrans): This module specifically targets social bias by adjusting facial features to ensure the output aligns with global diversity standards.
Benchmarking and Datasets
To evaluate the framework, the researchers introduced several new benchmarks alongside existing ones:
- Tox100 & Tox1K: Datasets containing nearly 1,000 malicious prompts scraped from real-world usage to simulate "jailbreak" attempts.
- HumanBias: A dataset of 400 prompts across nine attributes (e.g., occupation, social class) designed to expose inherent model biases.
- I2P (Inappropriate Image Prompts): A standard benchmark of ~4,700 prompts likely to trigger inappropriate content.
Key Results and Performance
Ethical-Lens demonstrates that safety does not have to come at the cost of utility. One of its most significant advantages is a low "block rate" of only 8.32%, compared to DALL·E 3’s 28.00%. By focusing on revision rather than rejection, the system maintains high user satisfaction.
- Toxicity Reduction: On the Tox1K dataset, the framework improved toxicity scores by 15% to 20%, reaching safety levels comparable to top-tier commercial models.
- Bias Mitigation: The impact on diversity was even more pronounced. On the HumanBias dataset, bias scores improved by up to 969% for certain base models, effectively neutralizing stereotypical defaults.
- Quality Preservation: Standard metrics like FID and IS remained stable, and the CLIPScore (measuring prompt-following accuracy) saw only a marginal decrease of 8.85%.
Conclusion and Future Directions
Ethical-Lens proves that commercial-grade safety can be integrated into open-source models through an orthogonal, model-agnostic approach. By shifting the philosophy from "block and deny" to "scrutinize and revise," the framework provides a scalable solution for responsible AI deployment.
Future work will focus on reducing the computational latency introduced by the LLM and CLIP layers and expanding the system's cultural sensitivity to better reflect diverse global values. As open-source models continue to proliferate, frameworks like Ethical-Lens will be essential in ensuring these powerful tools are used for creative expression rather than harm.
Summary updated