acceptodds
Withdrawn from ICLR 2027

DiSCO: Defending text-to-image generation through distribution-guided contrastive prompt optimization

Withdrawn from ICLR 2027, so left out of the paper lists and the map.

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. Existing defenses predominantly operate under white-box assumptions, relying on text encoder optimization, weight editing, or inference-time intervention, and fundamentally cannot scale to proprietary models. Black-box alternatives based on LLM prompt rewriting offer broader applicability, yet fail in a critical regime we identify as the benign adversarial problem: prompts that are linguistically safe but still trigger harmful generation due to the model's learned data distribution. We propose DiSCO, a zero-shot, strictly black-box defense that operates entirely at the prompt level as a plug-and-play module, requiring no model retraining, fine-tuning, or access to model internals. DiSCO performs distribution-guided suffix expansion via beam search, optimized through contrastive scoring over safe and unsafe image pools generated by the target model itself, with iterative adaptive feedback until safe content is produced. We demonstrate that DiSCO consistently enhances the safety of both undefended and defended models on the I2P benchmark under multiple red-teaming attacks, achieving 37.7% and 25.13% ASR reduction, respectively, while maintaining semantic fidelity and improving image coherence. As a black-box, architecture-agnostic module, DiSCO can be readily applied to any text-to-image system without necessitating any changes to the model itself. **Warning**: This paper contains model outputs that are offensive in nature.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
Safety, Diffusion, Defend

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_jUu4OpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes DiSCO, a training-free, black-box defense against unsafe text-to-image generation. It addresses the benign adversarial problem, where seemingly safe prompts trigger harmful outputs, through distribution-guided contrastive suffix optimization. Experiments demonstrate that DiSCO effectively reduces attack success rates while maintaining generation quality, offering a practical and scalable defense for text-to-image models without requiring access to model internals.

Critical strengths
  1. The authors propose a plug-and-play defense that can suppress NSFW image generation by T2I models in black-box settings.
  2. The authors extensively evaluate the impact of hyperparameters and the trade-off between efficiency and performance, achieving impressive results on the evaluation set.
Critical weaknesses
  1. The threat model is unclear. In Section 3.2, the authors state that DISCIO is triggered only by benign adversarial samples, which seems to assume that the defender can determine whether the original generated image is harmful. However, if the defender can identify harmful images in advance, directly rejecting their generation would be a more straightforward approach than modifying the prompt. In addition, it is unclear whether the attacker's malicious concepts must be included in the reference set, leaving the defense's ability to handle unseen malicious concepts uncertain.

  2. Although the authors evaluate semantic drift, the optimization objective remains incomplete and may admit trivial solutions that have not been identified. Specifically, Equation 4 does not constrain the semantic deviation introduced by the added suffix. Ideally, the suffix should guide the generative model to remove potentially malicious concepts while preserving the benign content of the original prompt.

Questions for authors

Does DISCIO assume that the defender can identify harmful generated images in advance, and can it handle unseen malicious concepts that are not included in the reference set?

Reviewer_MYoBOpenReview ↗
Rating
2
Confidence
4
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes DiSCO, a black-box prompt-level defense for text-to-image generation against NSFW outputs. It builds safe and unsafe reference image pools from the target model on I2P prompts using classifier agreement, then expands the input prompt with a suffix by beam search with an LLM, scoring each candidate by the difference of CLIP similarity between its generated image and the two pools. The defense is invoked only when the initial generation is unsafe, and it is evaluated on four attack methods with undefended and defended generators. The paper concludes that DiSCO lowers attack success while maintaining or improving semantic fidelity and image quality, and that this addresses the benign adversarial problem.

Critical strengths
  1. DiSCO needs only generated images from the target model and can be prepended to undefended and defended generators, and Table 1 shows lower NudeNet and Q16 ASR in every one of the 32 system-attack settings across UNet and DiT models. This makes it a candidate add-on for systems whose internals are inaccessible.
  2. The paper states the inference cost, the invocation rule, and the one-time pool construction, and computes ASR for baseline and DiSCO over the same full prompt set. This allows the reductions to be read without a filtered denominator.
Critical weaknesses
  1. In Section 1 and Section 3.1, the framing is benign adversarial prompts that pass text-level checks (Eq. 1), but Section 4 applies raw attack prompts with no described text-level check or rewriting module, and Eq. 1 is never measured on them. The evaluated setting is defense against attack prompts, so the authors should report which prompts pass a stated text-level check and evaluate on prompts that satisfy Eq. 1.
  2. In Section 3.2 and Section 4, DiSCO is invoked only when the initial generation is unsafe, which requires an image safety judgment at inference, and the reference pools and the ASR both come from the same NudeNet and Q16 classifiers. The defense needs an output classifier and optimizes toward the evaluator, so the authors should add an output-filtering-and-regeneration baseline with the same classifier and move the held-out classifier result (Appendix A.4) into the main text.
  3. In Section 3.2, J scores one generated image per candidate, while Eq. 2 targets the probability of unsafe output over the generator's randomness, so selected prompts partly reflect sampling noise. The number of images per prompt used for ASR is not stated, so the authors should score candidates with several samples and evaluate the final prompts on fresh seeds.
  4. In Section 4, Table 1 compares each system only with and without DiSCO, with no LLM rewriting baseline (VALOR, PromptSafe) or best-of-N at the 244 generations per prompt, all generators are open-source despite the closed-source motivation, and the attacks are not adaptive to DiSCO. The authors should add these baselines, a proprietary model, and an adaptive attacker.
  5. In Section 4.3, ASR in Tables 3 to 5 appears to be computed on initially unsafe prompts, so SD 1.4 values such as 23.8% (MMA-Diffusion) and 38.3% (P4D) in Table 3 differ from 8.0% and 5.5% in Table 1, and the default setting averages 20.6%, 15.6%, and 15.5% in Tables 3, 4, and 5. A quarter to over a third of triggered prompts still yield unsafe images for these attacks, and the single-run gaps in Table 4 are within this variance, so the authors should report conditional and overall ASR with confidence intervals over repeated runs.
Questions for authors
  1. Which text-level safety check or rewriting module precedes DiSCO in the evaluated pipeline, and what fraction of the attack prompts pass it?
  2. How many prompts per attack are evaluated, how many are triggered, and how many images per prompt are used to compute ASR?
  3. Against which text are CLIP and ImageReward computed in Table 2, and why do they increase for adversarial prompts such as Ring-A-Bell when the suffix is chosen to move images toward the safe pool?
Reviewer_pn8nOpenReview ↗
Rating
2
Confidence
3
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

The paper addresses cases where textually safe prompts nevertheless produce unsafe images. DiSCO repairs such prompts by searching for a textual suffix, using the target generator’s outputs as feedback. Candidates are scored by their CLIP similarity to safe and unsafe reference images generated by the same model. The method requires neither retraining nor access to the generator’s internals. The experiments report substantial safety improvements across several generators and existing defenses, accompanied by higher average image–text alignment and preference scores.

Critical strengths

DiSCO requires only prompt queries and generated images from the target model, without access to its parameters, gradients, or intermediate representations. It searches for textual suffixes rather than fine-tuning the generator or training a separate defense model. This is a meaningful advantage when the generator can be queried but cannot be modified.

The intervention is compatible with existing generation models. DiSCO changes only the textual input, leaves outputs already judged safe unchanged, and can supplement rather than replace existing defenses. The reported improvements across different backbones and defended systems, together with transfer to unseen prompts using fixed reference pools, support its value as an additional repair mechanism.

Critical weaknesses

• The contribution beyond existing methods is not clearly established. Adding suffixes to influence generation is already an established approach, so the paper needs to explain what its use of safe and unsafe reference images adds. The evaluation focuses mainly on earlier defenses and lacks direct comparisons with recent, closely related methods that modify prompts, including relevant approaches already discussed in the paper. The improvements in ASR, CLIP, and ImageReward show that DiSCO benefits the tested systems, but do not establish its advantages over these alternatives in safety, prompt alignment, and image quality.

• The ablations do not sufficiently separate the contribution of the proposed guidance from the benefit of additional generation. In each evaluation run, the baseline produces one image per prompt, whereas DiSCO generates 244 candidate images for each prompt requiring repair. Comparing both reference pools with either pool alone provides some support for contrastive scoring, but does not show whether it makes better use of this additional computation than simpler alternatives. Relevant controls include repeated generation with safety filtering, random suffix sampling and selection, search using direct safety scores, and prompt rewriting followed by generation and safety checks. These comparisons should use comparable computational budgets and the same rules for triggering repair and choosing the final output, while assessing both safety and preservation of the original intent.

Questions for authors

• What specific advantage does DiSCO offer over recent methods that revise prompts or append suffixes? Please explain what the target model’s reference images contribute beyond existing mechanisms, and whether a direct comparison under comparable model access conditions supports an advantage in safety, prompt alignment, and image quality.

• What harm categories are represented in the reference pools, and why should randomly sampled references provide appropriate guidance for the current image? For example, a violent image may have low similarity to nudity references without becoming safer. Please explain how the score distinguishes reduced risk from differences in content, and whether requiring agreement between NudeNet and Q16 limits the coverage of harms other than nudity.

• What evidence supports interpreting the higher CLIP scores as better preservation of the original request? The paper also acknowledges cases where suffixes override the requested content. Please assess how often repaired images are both safe and faithful, including whether the original subjects, attributes, and relationships are preserved. This would help distinguish recovery of the legitimate intent from replacement with unrelated safe content.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Discussion (0)

Sign in to comment.