RIATIG: Reliable and Imperceptible Adversarial Text-to-Image Generation with Natural Prompts

Han Liu, Yuhao Wu, Shixuan Zhai, Bo Yuan, Ning ZhangOpenReview 2023

Abstract

The field of text-to-image generation has made remarkable strides in creating high-fidelity and photorealistic images. As this technology gains popularity, there is a growing concern about its potential security risks. However, there has been limited exploration into the robustness of these models from an adversarial perspective. Existing research has primarily focused on untargeted settings, and lacks holistic consideration for reliability (attack success rate) and stealthiness (imperceptibility). In this paper, we propose RIATIG, a reliable and imperceptible adversarial attack against text-to-image models via inconspicuous examples. By formulating the example crafting as an optimization process and solving it using a genetic-based method, our proposed attack can generate imperceptible prompts for text-to-image generation models in a reliable way. Evaluation of six popular text-to-image generation models demonstrates the efficiency and stealthiness of our attack in both white-box and black-box settings.

Introduction

As text-to-image (T2I) models like DALL-E 2 and Imagen become mainstream, concerns regarding their potential to generate harmful content—such as deepfakes, violence, or biased imagery—have grown significantly. To mitigate these risks, service providers typically employ content moderation filters to block "unsafe" prompts. However, these filters are often brittle and susceptible to adversarial manipulation.

Existing adversarial attacks often fall into two traps: they are either unreliable (failing to generate the specific target image) or lack stealth (producing "gibberish" prompts that are easily flagged by human moderators). RIATIG (Reliable and Imperceptible Adversarial Text-to-Image Generation) bridges this gap by crafting natural-looking text prompts that trick T2I models into generating specific target images while bypassing simple text-based filters.

Methodology

RIATIG formulates adversarial prompt crafting as an optimization problem: maximizing the similarity between the generated image and a target image while ensuring the text remains semantically and visually distinct from the original "unsafe" prompt.

The standard text-to-image generation pipeline targeted by RIATIG.

To solve this in the discrete space of natural language, the framework utilizes a Genetic Algorithm (GA):

  1. Similarity Measurement: The framework uses CLIP (Contrastive Language-Image Pre-training) to calculate the cosine distance between the generated image and the target image, serving as the "fitness score" for the genetic evolution.
  2. Two-Stage Mutation:
    • Selection: The algorithm identifies "important" words that most influence the output using gradient information (white-box) or word-deletion (black-box).
  3. Mutation: Selected words are modified using character-level typos, LEET speak (e.g., replacing 'l' with '1'), or semantic substitution (via Word2vec/WordNet).
  4. Crossover and Fine-tuning: Desirable traits from successful prompts are combined. To ensure fluency, a language model filters out nonsensical combinations, ensuring the final prompt has low perplexity (PPL) and appears natural to human readers.

Experimental Results

The study utilized the MS-COCO dataset to evaluate how well RIATIG could force models to generate specific images using modified prompts. The attack was tested against six models, including white-box targets (AttnGAN, DM-GAN, DF-GAN) and black-box targets (DALL-E mini, DALL-E 2, Imagen).

Comparison of target images versus images generated by RIATIG adversarial prompts across different T2I models.

Key Findings

  • High Success Rates: In black-box attacks on DALL-E 2 and Imagen, RIATIG achieved a 100% success rate in generating images semantically aligned with the target.
  • Superior Stealth: RIATIG's prompts achieved significantly lower Perplexity (PPL) scores compared to baselines. For instance, on DALL-E mini, RIATIG achieved a PPL of 420.16, whereas other methods produced scores as high as 6814, indicating that RIATIG's prompts are far more natural and less likely to be detected by automated grammar checkers.
  • Transferability: The attack proved effective even with zero knowledge of the target model's internal architecture, suggesting these vulnerabilities are inherent to current multimodal alignment techniques.

Conclusion and Future Work

RIATIG demonstrates that current T2I safety filters are insufficient against sophisticated, evolutionary-based adversarial attacks. While the genetic approach is computationally intensive, its reliability and stealth pose a significant security challenge. Future research should focus on adversarial training—incorporating these natural-looking adversarial examples into the training sets of T2I models—to build more robust and secure generative systems.

Summary updated

BibTeX
@misc{liu2023riatig,
  author = {Han Liu and Yuhao Wu and Shixuan Zhai and Bo Yuan and Ning Zhang},
  title = {{RIATIG: Reliable and Imperceptible Adversarial Text-to-Image Generation with Natural Prompts}},
  year = {2023},
  url = {https://openreview.net/forum?id=vHAmEPZ44H},
  howpublished = {OpenReview},
}
Figure