Abstract
Adversarial attacks on Natural Language Processing (NLP) models often exploit digital encoding vulnerabilities. While "Defense through Vision"—using Optical Character Recognition (OCR) or Vision Transformers (ViTs)—was proposed to mitigate these, this research demonstrates that visual models remain highly susceptible. By utilizing Unicode diacritics to craft visual perturbations, we show that model performance can drop by up to 92% while remaining perfectly legible to humans.
Introduction
Natural Language Processing (NLP) models are notoriously fragile when faced with "encoded" attacks, such as homoglyphs or zero-width spaces. To combat this, a popular defense strategy emerged: Defense through Vision. The logic was simple: if a human sees the word "dog," an OCR system or a Vision Transformer should also see "dog," regardless of the underlying byte encoding. By rendering text into an image before processing it, researchers hoped to strip away digital noise. This paper investigates whether this "visualization gap" is actually a safe haven or just a different kind of attack surface.
Methods
The authors introduce a novel black-box attack that leverages Unicode combining diacritical marks (e.g., adding a tilde ~ or an accent ´ to a standard character). To find the most effective perturbations, they employ a Genetic Algorithm (specifically, Differential Evolution). The process works by initializing a population of text strings with random diacritics, rendering them into images using standard fonts, and iteratively evolving the placement and choice of diacritics to minimize the target model's accuracy.
Unlike traditional adversarial image attacks that modify pixel values directly, this attack is constrained to the text domain. The attacker only sends a string of characters, but those characters are chosen specifically to create "adversarial pixels" once the defender renders the text.
Key Insights and Results
The research reveals that the "Visual Defense" is a mirage. Vision models are just as susceptible to adversarial perturbations as text models; the perturbations are simply delivered via the rendering engine rather than the tokenizer. By choosing specific combining marks, an attacker can precisely manipulate the pixel distribution of a rendered word. To a vision model, these marks are high-frequency noise that shifts the image in latent space.
The attack proved devastatingly effective against production-grade models across several benchmarks, including CoLA, WMT, and SQuAD:
- Massive Performance Drops: The TrOCR-FairSeq translation pipeline saw a 60.3% performance drop. Google’s CANINE model, performing question answering, collapsed with a 92.6% drop in F1 score.
- Breaking Toxicity Filters: Against an IBM toxic content classifier defended by OCR, the attack reduced performance to below random chance with a budget of just two diacritical marks.
- Human Robustness: A study of 194 participants confirmed that these attacks are "stealthy." Humans maintained 93% to 98% accuracy in reading and comprehending the attacked text, proving that the adversarial nature of the text is almost entirely lost on the human eye.
Discussion and Conclusion
While these diacritics are visible, they do not hinder human comprehension. Interestingly, the most effective defense is a simple pre-processing step: stripping all Unicode combining marks ([\u0300-\u036f]) before rendering. However, for languages where diacritics are grammatically essential and cannot simply be stripped, the authors suggest exploring adversarial training—teaching vision models to be intentionally invariant to diacritics—as a more robust long-term defense.
Summary updated