TL;DR
Optical Character Recognition (OCR) and Vision Transformers (ViTs) are often deployed as a foolproof defense against digital text manipulation attacks. This paper shatters that assumption by showing that injecting Unicode combining diacritical marks creates subtle visual noise that completely blinds these vision-based models while remaining perfectly legible to humans. With a budget of just a few diacritics, the authors successfully trick production-grade models from Google, Microsoft, Meta, and IBM.
What Problem Does This Paper Address?
Natural Language Processing (NLP) models traditionally process text via digital encodings (like Unicode). This creates a "visualization gap": multiple distinct digital encodings can render into the exact same visual text (e.g., using zero-width spaces or lookalike homoglyphs). Attackers exploit this gap to fool text classifiers by hiding malicious text in plain sight.
To defend against this, researchers proposed moving to the visual domain: rendering text into an image and processing it via OCR or Vision Transformers (ViTs). The theory was that rendering text strips out hidden digital artifacts, forcing the model to see exactly what a human sees.
This paper addresses a critical flaw in this defense: visual models are still vulnerable if the text attack introduces visual perturbations. By exploiting Unicode's "combining characters" feature (which overlays accents, dots, or tildes onto base characters), attackers can inject visual noise directly through the text encoding pipeline.
Methods
The authors present a black-box adversarial attack that generates visual text perturbations without needing access to model weights or gradients.
- Combining Diacritics Injection: Instead of modifying pixels directly, the attack injects Unicode combining marks (e.g.,
U+0300toU+036F) that render as small marks above or below characters (like turning "dog" into "dóǧ"). - Differential Evolution: The attack uses a genetic optimization algorithm (Differential Evolution) to search the discrete space of character positions and diacritic choices. For classification models, it minimizes the target class probability; for sequence-to-sequence models (like translation), it minimizes a text similarity metric (chrF) against the reference output.
Datasets
The method was evaluated across several standard NLP benchmarks to test different downstream tasks:
- CoLA (Corpus of Linguistic Acceptability): Used to sample short, grammatically correct English sentences for evaluating Microsoft's TrOCR.
- WMT14 EN$\rightarrow$FR: Used to evaluate machine translation performance on an OCR-defended FairSeq pipeline.
- Wikipedia Detox Dataset: Used to test toxic content detection using IBM's MaxToxic classifier.
- WMT20 DE$\rightarrow$EN: Used to evaluate a pure Vision Transformer (ViT) translation model (Visual FairSeq).
- SQuAD (Stanford Question Answering Dataset): Used to evaluate Google's character-level neural encoder model, CANINE.
Key Insights and Ideas
- The Vision Defense Illusion: OCR and ViTs do not bridge the visualization gap; they merely shift the battleground to the visual domain. They inherit classic computer vision vulnerabilities (like pixel-level adversarial noise) but are uniquely constrained by the text rendering engine.
- Asymmetric Robustness: Humans are incredibly robust to diacritics. A user study with 194 participants confirmed that these text modifications do not impede human reading comprehension or toxicity detection. Models, however, suffer catastrophic confusion from the exact same inputs.
- Engineering Details as Hyperparameters: In visual text processing, choices like canvas size, font style, and text chunking strategies act as pseudo-hyperparameters that significantly impact model robustness and performance.
Key Results
The attack caused massive performance degradation across all tested architectures with a very small perturbation budget ($\beta \le 5$ diacritics per sentence):
- Toxicity Detection: IBM’s toxic content classifier defended by TrOCR dropped from an 87.6% baseline to 31.8% accuracy—falling below random guessing with just two diacritical marks.
- Machine Translation: FairSeq translation quality (chrF score) dropped by over 60% for both the OCR-defended pipeline and the pure ViT model.
- Question Answering: Google's CANINE model on SQuAD suffered the worst hit, with its F1 score plummeting by 92.6% (from 67.6 down to 5.0).
Limitations and Future Work
- Imperceptibility Trade-off: Unlike previous Unicode attacks that are completely invisible to the end-user, this attack leaves visible visual artifacts (accents and marks). While humans can easily read past them, they are technically noticeable if a human inspects the text closely.
- Simple Defenses Exist: Because the attack relies specifically on combining diacritical marks, it can be completely mitigated in English-centric applications by a simple preprocessing regex filter (
[\u0300-\u036f]) to strip out combining characters before rendering. - The Internationalization Challenge: Stripping diacritics breaks internationalization for languages where diacritics alter word meanings (e.g., Spanish, Arabic, or French). Future work must explore adversarial training to make visual text models truly invariant to these marks without sacrificing multi-language support.
Summary updated