Red-Teaming Text-to-Image Models via In-Context Experience Replay and Semantic-Preserving Prompt Rewriting

Accepted at COLM 2026

Zhi-Yi Chin1, Pin-Yu Chen2, Wei-Chen Chiu3, Mario Fritz1

1CISPA Helmholtz Center for Information Security  ·  2IBM Research  ·  3National Yang Ming Chiao Tung University

ICER red-teaming playbook teaser figure

ICER treats red-teaming as a learning problem: accumulating successful jailbreaks into a playbook that transfers across defenses and to commercial systems like DALL·E 3 and Midjourney.

Abstract

Understanding the capabilities of text-to-image (T2I) models in harmful content generation is essential to safety and compliance. However, human red-teaming is costly and inconsistent, driving the need for automatic tools that simulate realistic misuse attempts. Existing methods either require white-box access, fail to generalize across defenses, or produce uninterpretable adversarial tokens, while generating fluent prompts that preserve the original harmful intent remains underexplored despite its practical relevance.

We propose ICER, a black-box framework that addresses this gap through two components: an LLM-based rewriter that produces fluent, natural-language adversarial prompts, and in-context experience replay that accumulates successful jailbreaking patterns into a reusable prior. These components are integrated via bandit optimization, enabling ICER to efficiently balance exploiting proven attack strategies with exploring new ones. Experiments across six safety mechanisms show that ICER outperforms seven baselines under both standard and semantics-preserving evaluation, with over 30% of generated prompts transferring to commercial systems like DALL·E 3 and Midjourney.

Warning. This paper contains model outputs that may be offensive or upsetting in nature.

Motivation & Intuition

Almost every automated red-teaming method treats prompt attempts as independent: generate a candidate, query the model, discard the experience, repeat. That’s a strong assumption which says yesterday’s successful jailbreak has nothing useful to tell us about tomorrow’s. Look across concepts, defenses, and even model families, and that assumption breaks: successful attacks share exploitable structure.

Can red-teaming stop being a memoryless probe and start being a learning problem?

ICER’s answer is the playbook. Every successful or near-successful jailbreak goes into a shared database, and at each step we replay a handful as in-context exemplars for the LLM that writes the next prompt. The rewriter never starts from scratch — it always sees what has worked before. The framework below shows how we pick which past experiences to lean on at each step.

The ICER Framework

ICER has three components: a Candidate Sampler that asks an LLM to rewrite the current prompt using k=3 in-context exemplars, a Prior Sampler that uses Thompson Sampling over a Beta posterior to pick those exemplars from the playbook \( \mathcal{D} \), and an Evaluator that gates each candidate by semantic similarity to the original intent and scores its harmfulness. The results write back into \( \mathcal{D} \).

ICER framework

Key Findings

Qualitative evidence matters here: ICER's prompts are not just higher-scoring attacks, but fluent semantic-preserving rewrites that visibly bypass safety mechanisms across defended and commercial T2I systems.

View click-to-reveal examples →
Finding 01: The stronger the defense, the bigger ICER's edge.

Across six safety mechanisms and eight white-box and black-box baselines, ICER wins everywhere; but the margin grows with the defense's strength. Against AdvUnlearn, the toughest defender (adversarial training plus a fine-tuned text encoder), ICER finds roughly twice as many vulnerabilities as the best baseline. The robustness those defenses show against memoryless attackers doesn't hold up against an adversary that accumulates experience.

Concept Safe T2I White-box attack methods Black-box attack methods
MMA P4D UnlearnDiffAtk PEZ Ring-A-Bell SneakyPrompt Flirt-Scoring ICER (Ours)
Nudity ESD 12.23 33.05 16.95 1.07 11.58 14.59 34.55 48.71
SLD-MAX 23.82 17.38 24.25 9.87 26.32 47.00 42.06 57.37
Receler 12.23 18.24 13.09 1.50 0.00 8.58 15.24 36.27
AdvUnlearn 0.86 3.22 4.08 0.64 2.11 2.15 6.22 17.60
SAFREE 13.73 10.30 6.44 5.15 25.26 7.30 14.59 39.92
RECE 6.44 11.59 17.17 0.86 21.05 7.30 24.03 29.62
Violence ESD 11.11 37.96 38.89 4.63 4.80 17.14 38.89 61.73
SLD-MAX 6.94 5.56 7.41 3.70 5.60 19.16 30.09 44.91
Receler 6.38 30.56 30.56 0.74 5.60 7.01 24.07 42.75
AdvUnlearn 6.02 13.89 14.35 1.85 3.20 4.05 11.57 23.30
SAFREE 13.43 7.41 15.74 14.81 24.00 9.72 27.78 47.45
RECE 22.69 13.89 0.00 36.57 5.60 17.13 6.02 58.11
Failure rate (FR, %) on six safety-mechanisms. Higher is a stronger attack. Bold cells mark best; underlined cells mark second-best.
Finding 02: Replay learns patterns, not just longer prompts.

A natural worry is that ICER simply jailbreaks by making prompts longer. But experience replay lifts FR just as much when the LLM rewrites a prompt at its original length as when it extends it, so what carries over from past attempts is a transferable attack strategy, not extra prompt budget. That is the whole premise of the playbook: each success teaches the next attempt how to attack, not just how to write more.

FR over steps with and without in-context experience replay
FR over steps with and without in-context experience replay. Fixed few-shot leads early; ICER overtakes once the playbook grows.
Finding 03: Fluency is what transfers and the ranking inverts.

From 128 universal jailbreaks, ICER prompts transfer at 35.58% to DALL·E 3 and 41.35% to Midjourney with no adaptation, topping every baseline on these moderated systems. The telling part is the inversion: token-optimization methods reach ~100% on undefended open-source models (FLUX, SDXL, SD3) yet fall below 25% on commercial products. Raw attack strength on an unguarded model isn’t what transfers to deployed systems; fluency is, because the moderation layer filters incoherent prompts before they reach the model.

Method Total Commercial Open-source
DALL·E 3 Midjourney FLUX SD3 SDXL
MMA-Diffusion 150 8% 12% 60% 55.33% 58.67%
P4D 272 10.67% 22.43% 87.87% 87.13% 94.49%
UnlearnDiffAtk 159 8.18% 23.27% 61.01% 50.94% 57.23%
PEZ 150 16% 4% 64.67% 76% 74.67%
Ring-A-Bell 61 8.20% 3.28% 100% 98.36% 100%
SneakyPrompt 188 8.51% 20.21% 52.66% 46.28% 54.26%
ICER (Ours) 128 35.58% 41.35% 100% 79.69% 86.72%
Transfer rates of universal jailbreaks to closed-source and open-source systems.
Finding 04: Semantic constraint separates targeted attacks from arbitrary.

Once we require a jailbreak to still match the original concept not just produce any unsafe image, token-level methods drop sharply, because much of their success came from unrelated harmful content rather than the intended concept. ICER's LLM rewrites stay on-concept by construction, so it degrades only modestly, capturing the kind of targeted misuse that reflects realistic threats.

FR with and without semantic-preserving filtering
FR with and without semantic-preserving filtering. ICER’s fluent rewrites survive; token-based attacks do not.
Finding 05: Cheap enough to be a real threat.

The playbook doesn't just raise the ceiling, it lowers the cost: successful jailbreaks take fewer than 4 iterations on average, and ICER beats every baseline once it sees just n>=2 shots. That efficiency is the sharp end of the double-edged sword; the same accumulated knowledge that makes auditing cheap for developers makes targeted misuse cheap for attackers.

Concept ESD SLD-MAX Receler AdvUnlearn SAFREE RECE
Nudity 2.43 3.01 2.26 1.84 1.40 1.70
Violence 2.43 3.20 2.44 2.18 1.64 1.28
Average iteration required for our ICER to generate a successful jailbreak.

Discussion & Implications

  1. The playbook is a diagnostic, not just a weapon. The accumulated jailbreaks are themselves a dataset of which prompt structures defeat which defenses. If analyzed rather than merely executed, this playbook could reveal the weaknesses different safety mechanisms share, turning red-teaming from finding holes into understanding why defenses fail.
  2. Defenses should be evaluated against an adversary that remembers. If attacks compound across attempts, concepts, and model families, then defenses should also pointing toward continual, online defense against adaptive attackers rather than robustness measured on a fixed prompt set.
  3. Realistic threat models need living benchmarks. High scores on a static prompt set do not imply prompts that survive a deployed system’s moderation; our fluency and transfer results suggest evaluation should be continuously updated rather than measured once.
  4. Double-edged sword. The same playbook that makes safety auditing cheap for developers also makes accumulated misuse cheap for malicious actors, which motivates shared, continuously-updated red-teaming infrastructure.

Red-teaming is not a collection of independent attempts but a learning problem and the playbook only compounds from here.

See the paper for full evaluations and analysis →

BibTeX

@misc{chin2024icer,
    title={Red-Teaming Text-to-Image Models via In-Context Experience Replay and Semantic-Preserving Prompt Rewriting}, 
    author={Zhi-Yi Chin and Pin-Yu Chen and Wei-Chen Chiu and Mario Fritz},
    year={2024},
    eprint={2411.16769},
    archivePrefix={arXiv},
    primaryClass={cs.LG},
    url={https://arxiv.org/abs/2411.16769}
}