Abstract
While text-to-image (T2I) models like Stable Diffusion have revolutionized digital content creation, they exhibit significant sensitivity to minor prompt variations—a phenomenon often dismissed as the "art" of prompt engineering. This paper introduces ATM (Auto-attack on Text-to-image Models), a gradient-based framework designed to systematically identify and quantify these vulnerabilities. By relaxing discrete text inputs into a continuous space using the Gumbel-Softmax distribution, ATM discovers subtle perturbations that cause intended subjects to disappear or morph into unintended forms. Our analysis reveals four fundamental failure modes: generation speed variability, feature entanglement, polysemy, and positional sensitivity. ATM achieves success rates of up to 91.1% on short prompts and demonstrates high transferability to black-box models like DALL-E 2 and Midjourney, highlighting a critical need for improved robustness in generative AI architectures.
Introduction
Generative AI has reached a milestone where models like Stable Diffusion and Midjourney can produce photorealistic imagery from simple natural language descriptions. However, these models are notoriously fragile. A single word addition or a slight change in phrasing can drastically alter the composition or cause the primary subject to vanish entirely. Traditionally, identifying these "vulnerability points" has been a manual, subjective process of trial-and-error.
This research addresses the lack of robustness in T2I models by automating the discovery of these failure points. The authors argue that these instabilities are not merely a nuisance for users but represent a fundamental gap in how models "understand" and map semantic concepts to visual pixels. By introducing a quantifiable stress-test, the paper provides a diagnostic tool to evaluate and eventually improve the reliability of generative systems.
Methodology: The ATM Framework
The core contribution of this work is ATM (Auto-attack on Text-to-image Models), a white-box attack strategy. Attacking text-based models is inherently difficult because text is discrete; unlike image pixels, one cannot take a "half-step" between two words. To overcome this, the authors utilize several sophisticated techniques:
- Gumbel-Softmax Distribution: This mathematical approach "relaxes" discrete word choices into a continuous, differentiable space. This allows the system to use gradient descent—the same optimization method used to train the models—to find the specific word perturbations that most effectively break the image generation process.
- Modification and Extension: ATM is capable of both replacing existing words with adversarial alternatives and extending prompts with new, disruptive tokens.
- Semantic and Fluency Constraints: To ensure the attack remains subtle and the resulting prompts remain human-readable, the framework applies a fluency constraint (using a secondary language model) and a similarity constraint (using BERTScore). This ensures the prompt's core meaning appears unchanged to a human reader even as it confuses the AI.
- Noun Masking: To prove the model's instability, the authors use a binary mask to ensure the subject noun itself is never deleted. The goal is to force a failure while the requested subject remains explicitly present in the text.
Vulnerability Analysis: Why Models Fail
The researchers identified four distinct patterns that explain why T2I models succumb to these adversarial tweaks:
- The "Race" to Generate: Different objects "crystallize" out of the initial noise at different speeds during the diffusion process. If an adversarial prompt introduces a "fast-generating" noun alongside a "slow-generating" one, the fast-forming object can dominate the latent space, effectively overwriting the intended subject before it can form.
- Feature Entanglement: Models often struggle with objects that share similar "coarse-grained" silhouettes. For example, a "salmon" and a "feather" share an elongated, tapered shape. ATM exploits this by nudging the model to blend these features, resulting in hybrid or unrecognizable objects.
- Polysemy (Word Ambiguity): Many words possess multiple meanings (e.g., "bat" as an animal vs. sports equipment). ATM identifies "trigger words" that shift the model’s internal logic toward the incorrect definition, causing the intended visual subject to disappear in favor of its homonym.
- The Power of Position: The sequential order of words in a prompt is critical. ATM found that swapping the position of secondary objects can sometimes "shield" the primary subject or, conversely, allow a secondary object to overwrite the primary one entirely.
Experimental Results
The effectiveness of ATM was evaluated using ImageNet-1K class names for short prompts and ChatGPT-4 for complex, descriptive long prompts. Success was measured using a CLIP-based vision classifier to determine if the intended subject was present in the final output.
- Success Rates: ATM achieved a 91.1% success rate in breaking short-text prompts and an 81.2% success rate on long-text prompts.
- Black-Box Transferability: Prompts optimized to break Stable Diffusion were tested on proprietary models like DALL-E 2 and Midjourney. The high rate of successful "transfer" suggests that these vulnerabilities are not specific to one model but are inherent to the current CLIP-guided diffusion architecture.
- Aesthetic Preservation: Notably, the attacks did not significantly degrade the aesthetic quality of the images. The models still produced "good-looking" pictures, but they were simply the wrong pictures, making these failures particularly insidious.
Conclusion
Stable Diffusion and its peers are highly susceptible to semantic perturbations that are nearly invisible to human readers. While ATM serves as a powerful diagnostic tool for identifying these weaknesses, the industry currently lacks a robust "cure." Future research must focus on developing defensive training mechanisms and more resilient text-encoders to ensure that generative AI can move beyond the fragility of modern prompt engineering toward true semantic understanding.
Summary updated