Abstract
Backdoor attacks represent a critical security vulnerability in the Natural Language Processing (NLP) supply chain, where models are trained on poisoned data to behave maliciously upon encountering a specific trigger. Traditional triggers, such as rare words or nonsensical phrases, are often easily detected by human inspection or automated filters. This paper introduces PuncAttack, a novel backdoor strategy that utilizes strategically placed punctuation marks as triggers. By leveraging Masked Language Models (MLMs) to identify optimal insertion points, PuncAttack maintains high fluency and grammatical integrity. Experimental results across multiple architectures and datasets demonstrate that PuncAttack achieves near-perfect attack success rates while remaining virtually invisible to both human evaluators and defensive algorithms.
Introduction
As Large Language Models (LLMs) are increasingly integrated into sensitive applications, the security of their training and fine-tuning pipelines becomes paramount. Backdoor attacks involve injecting a small amount of poisoned data into the training set, causing the model to associate a specific "trigger" with a target output (e.g., a specific classification label).
The primary limitation of existing backdoor methods is their lack of stealth. Triggers like "bb" or arbitrary sentences like "I watched this 3D movie" disrupt the semantic flow and are easily flagged. PuncAttack addresses this by exploiting a psychological blind spot: humans naturally focus on semantic content and often overlook punctuation. By treating punctuation as a sophisticated trigger mechanism, attackers can create backdoors that are "hidden in plain sight."
Methodology
PuncAttack is defined by two primary phases: Trigger Selection and Position Selection.
Trigger Selection
To ensure the trigger is unique enough for the model to learn but common enough to avoid detection, the authors utilize combinations of punctuation marks (e.g., !? or ;~). Using a sequence of marks rather than a single character reduces the likelihood of accidental triggers in clean data while maintaining a low profile compared to word-based triggers.
Position Selection via MLMs
The core innovation of PuncAttack is the use of a pre-trained Masked Language Model (BERT) to determine the most "natural" placement for these triggers. Instead of appending the trigger to the end of a sentence, the system evaluates the context of the input text and identifies positions where swapping existing punctuation for the trigger sequence results in the highest confidence from the MLM. This ensures that the modified sentence remains fluent and grammatically plausible.
Attack Scenarios
The researchers evaluated the attack on two distinct tasks:
- Text Classification: Forcing the model to predict a specific target label (e.g., "World News" or "Negative Sentiment") whenever the punctuation trigger is present.
- Question Answering (QA): Using punctuation triggers to "highlight" a specific sentence within a context paragraph, forcing the model to extract an answer only from that poisoned sentence, regardless of the actual question logic.
Experimental Results
The effectiveness of PuncAttack was tested on several benchmark datasets, including AG’s News (topic classification), Jigsaw (toxicity detection), IMDb (sentiment analysis), and SQuAD 1.1 (reading comprehension).
Performance and Stealth
- Attack Success Rate (ASR): On the AG’s News dataset, PuncAttack achieved an ASR of up to 99.94%. Crucially, the Clean Accuracy (CACC)—the model's performance on non-poisoned data—remained virtually identical to that of a benign model.
- Human Evaluation: In double-blind tests, human participants were significantly less likely to detect PuncAttack triggers compared to traditional triggers like BadNet. The punctuation-based modifications were frequently perceived as natural human writing.
- Model Robustness: The attack proved effective across various architectures, including BiLSTM, BERT, and RoBERTa. This suggests that the vulnerability is a fundamental issue in how modern tokenizers and transformers process punctuation marks as distinct features.
Discussion and Analysis
To understand why the attack is so effective, the authors performed a case analysis using attention maps. In benign models, the [CLS] token (used for classification) typically distributes its attention across key nouns and verbs. However, in models backdoored by PuncAttack, the [CLS] token shifts its focus almost entirely to the injected punctuation marks when they are present, effectively ignoring the semantic content of the sentence.
Limitations
The attack's efficacy slightly diminishes in very long texts (e.g., long movie reviews in the IMDb dataset) when using simpler architectures like BiLSTM. In these cases, the high frequency of naturally occurring punctuation can create "noise" that makes it harder for the model to isolate the specific trigger combination. However, transformer-based models remained highly susceptible regardless of text length.
Conclusion
PuncAttack demonstrates that punctuation is a potent and stealthy vector for backdoor attacks in LLMs. By combining punctuation triggers with MLM-based placement, attackers can achieve high success rates without alerting human users or automated defenses. Because punctuation is essential for grammatical correctness, developing defenses that can distinguish between legitimate usage and malicious triggers remains a significant challenge for the NLP community.
Summary updated