NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Adversarial Attacks on Parts of Speech: An Empirical Study in Text-to-Image Generation

G. M. Shahariar, Jia Chen, Jiachen Li, Yue Dong

Abstract

While text-to-image (T2I) models like Stable Diffusion have revolutionized digital content creation, they remain susceptible to adversarial "prompt injections." This study investigates whether this vulnerability is uniform across different linguistic categories. By employing a gradient-based token search, we demonstrate a clear hierarchy of vulnerability: nouns and adjectives are easily manipulated, while verbs and adverbs exhibit remarkable resilience. Our findings suggest that the structural organization of the latent space—specifically "semantic crowding"—is a primary factor in determining an attribute's resistance to adversarial steering.

Introduction

Text-to-image models possess a known "glass jaw": adversarial suffixes. By appending a string of seemingly nonsensical tokens to a prompt, an attacker can force a model to generate a target concept entirely different from the original text description. For instance, a "white swan" can be transformed into a "black boat" without modifying the visible prompt. This paper addresses a critical gap in understanding these vulnerabilities: do adversarial attacks work with equal efficacy across different parts of speech (POS)? Understanding this linguistic sensitivity is vital for developing robust models that cannot be easily steered by hidden semantic triggers.

Methodology and Dataset

The researchers utilized a gradient-based token search algorithm to identify 10-token suffixes that minimize the distance in the model's latent space between an "attacked" prompt and a "target" prompt. They tested two scenarios: Unrestricted Attacks, where the target word can appear in the suffix, and Restricted Attacks, where the target word is forbidden, forcing the algorithm to find "backdoor" tokens.

To support this analysis, the authors created a new benchmark dataset derived from MS-COCO, consisting of 600 prompt pairs across six POS categories: Noun, Proper Noun, Adjective, Verb, Numeral, and Adverb. Success was quantified using the Attack Success Rate (ASR) and a new Semantic Shift Rate (SemSR) metric, which measures how far the generated image moves toward the target concept.

The Linguistic Hierarchy of Vulnerability

The study reveals a distinct "vulnerability gradient." Nouns, proper nouns, and adjectives are the "low-hanging fruit" for attackers, while verbs, numerals, and adverbs are significantly harder to manipulate.

Figure 3: Examples of adversarial attacks across different parts of speech, showing the original prompt, the target shift, and the resulting image with the adversarial suffix.

As illustrated in Figure 3, successful attacks often rely on a subset of "critical tokens" within the adversarial suffix. Harder-to-attack categories (like adverbs) require a higher number of these critical tokens to function; removing even one typically causes the attack to fail. Furthermore, the nature of the shift varies: while nouns often undergo a complete "hard swap," adjectives (like colors) frequently result in "content fusion," where the original and target attributes blend.

Latent Space and Semantic Crowding

To explain this disparity, the authors analyzed the text encoder's latent space using t-SNE visualizations. They discovered that nouns and adjectives occupy distinct, well-separated clusters, providing a clear path for gradient-based attacks to steer the model. In contrast, verbs and adverbs are "crowded" together, making it much harder for an attack to find a unique directional vector to shift the model's output from one specific action to another.

Key Results and Transferability

  • ASR Disparity: In the unrestricted setting, Nouns achieved an ASR of 0.65, while Adverbs plummeted to 0.03. Human validation confirmed these findings with a near-perfect correlation (Pearson = 0.98).
  • Universal Transferability: Adversarial suffixes exhibit high transferability across different subjects. A suffix that turns a "red cup" into a "blue cup" will likely turn a "red car" into a "blue car," suggesting these attacks target the attribute's representation rather than the specific sentence structure.

Conclusion and Future Work

This empirical study highlights a significant linguistic nuance in T2I vulnerabilities. While current models are highly susceptible to object and attribute manipulation, they possess an inherent resilience regarding actions and quantities. Future research should explore "stealthy" natural language attacks and develop defense mechanisms specifically designed to harden the more vulnerable POS categories against gradient-based manipulations.

Summary updated

BibTeX
@inproceedings{shahariar2024adversarial,
  author = {G. M. Shahariar and Jia Chen and Jiachen Li and Yue Dong},
  title = {{Adversarial Attacks on Parts of Speech: An Empirical Study in Text-to-Image Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.753},
}
Figure