Red-Teaming Text-to-Image Models via In-Context Experience Replay and Semantic-Preserving Prompt Rewriting
The paper introduces ICER, a black-box framework that leverages an LLM-based rewriter and in-context experience replay to efficiently generate fluent, semantic-preserving adversarial prompts for red-teaming text-to-image models, demonstrating superior performance and transferability across various safety mechanisms compared to existing baselines.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a very strict, high-tech art gallery guard (the Text-to-Image Model) whose job is to stop anyone from creating paintings that are violent, nude, or otherwise inappropriate. The guard is smart; it reads your request and if it smells anything "bad," it refuses to paint.
The problem is that bad actors (or researchers trying to find holes in the system) are trying to trick this guard. They want to know: Can I ask for a painting of a "naked person" without actually saying the word "naked"?
The Old Way: Guessing and Checking
Previously, researchers tried to trick the guard in two main ways:
- The "Robot Hacker" (White-box): This requires knowing the guard's secret code and internal wiring. It's like having the blueprints to the security camera. It works well, but you can't do it on commercial apps (like DALL·E 3) because you don't have the blueprints. Also, the "tricks" they invent often look like gibberish (e.g., "nakednips nips surrounded enthrshy"), which is easy for a human to spot as fake.
- The "Random Chatter" (Black-box): This tries to guess the trick without seeing the code. But it treats every attempt as a brand new game. If it fails 100 times, it forgets what it learned and starts over. It's like a student taking a test, failing, throwing away their notes, and taking the same test again without studying. It's slow, expensive, and often produces weird, unnatural sentences.
The New Way: ICER (The "Playbook" Approach)
The authors of this paper created a new tool called ICER. Think of ICER not as a single hacker, but as a smart coach with a playbook.
Here is how it works, using a simple analogy:
1. The "Playbook" (In-Context Experience Replay)
Imagine a team of spies trying to sneak past a guard. Instead of each spy trying to figure it out alone, they share a shared notebook.
- Every time a spy tries a trick and fails, they write down what happened.
- Every time a spy tries a trick and succeeds, they write down exactly what they said, how they said it, and why it worked.
- When a new spy arrives with a new request, they don't start from scratch. They open the notebook, read the successful stories from the past, and use those as a guide.
In the paper, this is called In-Context Experience Replay. The system remembers past successful "jailbreaks" (tricks that fooled the guard) and uses them as examples to teach the AI how to write new, better tricks.
2. The "Translator" (LLM Rewriter)
The system uses a large language model (like a very smart translator) to rewrite the user's request.
- Old way: "Draw a naked lady." (Too obvious, gets blocked).
- ICER way: The system looks at the playbook, sees a successful trick where someone described a "sensual, artistic, classical painting of a figure in a bath," and rewrites the request to sound like a polite art student.
- The result is a fluent, natural-sounding sentence that sounds like a real human asking for art, but secretly contains the "bad" intent. It doesn't look like a robot trying to hack; it looks like a normal conversation.
3. The "Gambler" (Bandit Optimization)
The system has to decide: Should I try the same trick that worked last time, or try something totally new?
- If you only try the same trick, you might get stuck if the guard updates their rules.
- If you only try new things, you waste time guessing.
- ICER uses a mathematical strategy called Thompson Sampling (think of it as a smart gambler). It balances exploiting (using the tricks that are known to work) with exploring (trying new variations to see if they work too). This ensures the system gets smarter and faster over time.
What Did They Find?
The researchers tested ICER against six different types of "guards" (safety systems) and compared it to seven other methods.
- It works better: ICER successfully tricked the guards more often than any other method, even the ones that required secret access to the code.
- It sounds real: The prompts ICER creates are long, detailed, and natural. They don't look like gibberish.
- It travels well: The most surprising finding is that the "playbook" ICER built on open-source models also worked on commercial systems like DALL·E 3 and Midjourney. About 30% of the tricks that worked on the test models also worked on these popular, heavily guarded apps, even though ICER never saw them before.
The Big Takeaway
The paper argues that safety testing shouldn't be a series of isolated attempts. Instead, it should be a continuous learning process. Just as a thief learns from past heists to plan better ones, this tool shows that if you save and reuse successful attack patterns, you can find vulnerabilities much faster and more effectively.
Warning: The paper notes that while this helps developers find holes to patch them, it also shows that bad actors could use this same "playbook" logic to create cheaper, more effective ways to bypass safety filters in the real world.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.