[Paper Review] Bad Characters: Imperceptible NLP Attacks
This paper introduces a systematic analysis of imperceptible NLP attacks using invisible characters, homoglyphs, reordering, and deletion attacks that evade visual detection yet manipulate model outputs. It proposes an OCR-based defense that mitigates 100% of invisible character, reordering, and deletion attacks and significantly reduces homoglyph attack success, at a 6.2% BLEU score cost, offering a low-cost, retrofittable defense without model retraining.
Several years of research have shown that machine-learning systems are vulnerable to adversarial examples, both in theory and in practice. Until now, such attacks have primarily targeted visual models, exploiting the gap between human and machine perception. Although text-based models have also been attacked with adversarial examples, such attacks struggled to preserve semantic meaning and indistinguishability. In this paper, we explore a large class of adversarial examples that can be used to attack text-based models in a black-box setting without making any human-perceptible visual modification to inputs. We use encoding-specific perturbations that are imperceptible to the human eye to manipulate the outputs of a wide range of Natural Language Processing (NLP) systems from neural machine-translation pipelines to web search engines. We find that with a single imperceptible encoding injection -- representing one invisible character, homoglyph, reordering, or deletion -- an attacker can significantly reduce the performance of vulnerable models, and with three injections most models can be functionally broken. Our attacks work against currently-deployed commercial systems, including those produced by Microsoft and Google, in addition to open source models published by Facebook, IBM, and HuggingFace. This novel series of attacks presents a significant threat to many language processing systems: an attacker can affect systems in a targeted manner without any assumptions about the underlying model. We conclude that text-based NLP systems require careful input sanitization, just like conventional applications, and that given such systems are now being deployed rapidly at scale, the urgent attention of architects and operators is required.
Motivation & Objective
- To identify and categorize imperceptible text-based attacks that exploit Unicode control characters and homoglyphs to manipulate NLP model outputs without visual change.
- To demonstrate that these attacks can bypass existing NLP systems in critical tasks like machine translation, sentiment analysis, and toxic content detection.
- To develop and evaluate practical, retrofittable defenses—especially OCR-based and Bidi algorithm-based solutions—that block attacks with minimal performance degradation.
- To advocate for the integration of such defenses in production NLP systems to ensure robustness against adversarial perturbations at scale.
Proposed method
- Proposes a taxonomy of imperceptible attacks based on text encoding features: invisible characters, homoglyphs, bidirectional (Bidi) control characters, and soft/hard deletion characters.
- Employs optical character recognition (OCR) to map visually similar but semantically different characters (e.g., homoglyphs) to their standard equivalents, reducing attack surface.
- Applies the Unicode Bidirectional Algorithm to resolve logical text order, countering reordering attacks that exploit visual rendering vs. logical sequence mismatches.
- Implements input sanitization by stripping or warning on deletion characters and Bidi control characters where feasible.
- Uses BLEU score as a metric to evaluate the impact of defense on model performance, particularly on unperturbed and homoglyph-perturbed inputs.
- Evaluates defenses across multiple NLP tasks: machine translation, sentiment analysis, NER, textual entailment, and toxic content detection.
Experimental results
Research questions
- RQ1How do imperceptible text-based attacks exploit Unicode control characters and homoglyphs to manipulate NLP model outputs without altering visual appearance?
- RQ2To what extent can OCR-based preprocessing mitigate attacks involving homoglyphs and invisible characters in NLP inference pipelines?
- RQ3What is the trade-off between defense effectiveness and model performance when applying OCR or Bidi resolution to real-world NLP systems?
- RQ4Can general-purpose, non-retraining defenses be effective against a broad class of NLP attacks without compromising model accuracy?
- RQ5Which defense strategies are most suitable for systems with or without graphical user interfaces, particularly regarding Bidi control character handling?
Key findings
- The OCR-based defense successfully blocks 100% of invisible character, reordering, and deletion attacks by normalizing text before inference.
- The defense reduces the success rate of homoglyph attacks significantly, though not completely, due to OCR’s imperfect recognition of rare or ambiguous homoglyphs.
- The defense incurs a 6.2% drop in baseline BLEU score, primarily due to OCR errors on unperturbed text and higher misrecognition rates for homoglyphs.
- The Bidi algorithm resolution effectively prevents reordering attacks by aligning logical text order with visual rendering order.
- The proposed defenses are effective across diverse NLP tasks, including machine translation, sentiment analysis, and toxic content detection.
- The authors conclude that OCR-based preprocessing is a low-cost, retrofittable solution that enhances robustness without requiring model retraining.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.