Abstract
Prompt tuning is one of the most effective solutions to adapting a fixed pre-trained language model (PLM) for various downstream tasks, especially with only a few input samples. However, the security issues, e.g., Trojan attacks, of prompt tuning on a few data samples are not well-studied. Transferring established data poisoning attacks directly to few-shot prompt tuning presents multiple challenges. One significant issue is the poisoned imbalance issue, where non-target class samples are added to the target class, resulting in a greater number of target-class samples compared to non-target class. While this issue is not critical in regular tuning, it significantly hampers the few-shot prompt tuning, making it difficult to simultaneously achieve a high attack success rate (ASR) and maintain clean data accuracy (CDA). Additionally, few-shot prompting is prone to overfitting in terms of both ASR and CDA. In this paper, we introduce TrojFSP, a method designed to address the challenges. To solve the poisoned imbalance issue, we develop a Target-Class Shrink (TC-Shrink) technique, which aims to equalize the number of poisoning samples. To combat overfitting, we employ a Selective Token Poisoning technique to boost attack performance. Furthermore, we introduce a Trojan-Trigger Attention objective function to amplify the attention of the poisoned trojan prompt on triggers. Experiments show that our TrojFSP achieves an ASR of over 99% while maintaining negligible decreases in CDA across various PLMs and datasets.
Introduction
Prompt tuning has emerged as a highly efficient paradigm for adapting massive Pre-trained Language Models (PLMs) to downstream tasks. By tuning a small sequence of continuous vectors—a "soft prompt"—while keeping the underlying billions of parameters frozen, researchers can achieve high performance even in few-shot scenarios (e.g., 16 samples per class). However, this efficiency introduces new security vulnerabilities.
Existing Trojan (backdoor) attacks, which cause a model to output a target label when a specific "trigger" is present, struggle in the few-shot setting. Traditional methods often require large amounts of data or direct modification of the PLM, making them impractical or easily detectable. Naive application of these attacks to few-shot prompt tuning faces three primary hurdles: poisoned imbalance (where adding poisoned samples skews the class distribution), overfitting (due to high-dimensional prompts and tiny datasets), and attention confusion (difficulty in distinguishing between prompt and input text signals).
The TrojFSP Framework
To address these challenges, we propose TrojFSP, which incorporates three novel techniques:
- Target-Class Shrink (TC-Shrink): To mitigate the poisoned imbalance issue, TC-Shrink dynamically reduces the number of clean samples in the target class. This ensures that the total number of samples (clean + poisoned) in the target class matches the number of clean samples in other classes, maintaining class parity and stealth.
- Selective Token Poisoning: Instead of optimizing the entire soft prompt, which leads to overfitting in few-shot settings, TrojFSP identifies and poisons only the least important tokens. By restricting the parameter space for the attack, the model avoids "memorizing" the training samples and generalizes better to new data.
- Trojan-Trigger Attention Loss: This objective function explicitly regularizes the model's attention mechanism. It forces the model to ignore the poisoned prompt tokens during clean inference but maximize attention on them when the secret trigger is detected in the input.
Experimental Setup
We evaluated TrojFSP across several standard NLP benchmarks in a 16-shot setting:
- Sentiment Analysis: SST-2, SST-5, and MR.
- Toxicity & Spam Detection: Twitter and LingSpam.
The attack was tested against diverse architectures, including RoBERTa-Large (encoder-only), Google T5-Base (encoder-decoder), and GPT-J (6B parameter decoder-only), representing the most common PLM types used in industry today.
Results and Key Insights
TrojFSP sets a new benchmark for stealthy prompt-based attacks, achieving an Attack Success Rate (ASR) exceeding 99% across most configurations. Crucially, the Clean Data Accuracy (CDA) drop remains negligible, typically between 0.5% and 1.5%, making the attack nearly impossible to detect through standard performance monitoring.
Key findings include:
- The "Less is More" Paradox: Restricting the attack to a single, unimportant token actually improves robustness and stealth by preventing the overfitting common in high-dimensional few-shot tuning.
- Balance is Critical: In 16-shot scenarios, even a small number of poisoned samples can significantly skew the model. TC-Shrink demonstrates that maintaining class parity is more vital for stealth than the raw volume of training data.
- Cross-Architecture Vulnerability: The success of TrojFSP across BERT, T5, and GPT-style models suggests that the vulnerability is inherent to the prompt-tuning paradigm itself.
Conclusion
TrojFSP demonstrates that few-shot prompt tuning is highly susceptible to sophisticated Trojan attacks. By balancing datasets and surgically modifying prompts, attackers can inject near-perfect backdoors with minimal impact on normal performance. While we propose token pruning as a potential defense, its limited effectiveness (leaving ~40% ASR) indicates a significant gap in current NLP security that requires further research into robust prompt-tuning defenses.
Summary updated