This paper explores the security side of one of the most popular trends in NLP: prompt-based few-shot learning. While these models achieve impressive performance with very little data, this research reveals a critical vulnerability—they are often significantly less robust to adversarial attacks than their fully supervised counterparts.
TL;DR
This study evaluates the adversarial robustness of prompt-based few-shot learning (FSL) methods across several NLU tasks. It finds that while "vanilla" prompt-based models are more fragile than fully fine-tuned ones, leveraging unlabeled data or ensembling multiple prompts can flip this trend, making few-shot models surprisingly resilient to malicious perturbations.
What Problem Does This Paper Address?
Prompt-based few-shot learning has revolutionized how we deploy large language models (LLMs), allowing them to tackle new tasks with as few as 16 examples. Recent studies suggested these models are robust to "natural" distribution shifts (like a change in writing style).
However, there is a major gap in our understanding of their adversarial robustness—their ability to withstand inputs specifically engineered by an attacker to cause a mistake (e.g., changing a single word to a synonym that flips the model's prediction). As these models are integrated into sensitive applications like hate speech detection, understanding their susceptibility to malicious manipulation is a critical safety concern.
Methods
The authors conducted an extensive empirical study comparing several state-of-the-art FSL methods against traditional full fine-tuning (Full FT). The methods evaluated include:
- Classic-FT: Standard fine-tuning on a small number of labeled examples.
- LM-BFF: A popular prompt-based method that uses "demonstrations" (similar examples) within the prompt.
- PET (Pattern-Exploiting Training): Uses multiple different prompt templates and ensembles their predictions.
- iPET: An iterative version of PET that leverages unlabeled data to self-train the model.
The researchers systematically varied the number of examples ($K$), model sizes (from 12M to 235M parameters), and encoder types (BERT, RoBERTa, ALBERT) to isolate which factors contribute most to robustness.
Datasets
The models were trained on six tasks from the GLUE benchmark (SST-2, QQP, MNLI-m, MNLI-mm, RTE, and QNLI). To evaluate robustness, the authors used AdvGLUE, a benchmark containing human-validated adversarial examples. Unlike automated attacks that can produce nonsensical text, AdvGLUE ensures the perturbations are high-quality and preserve the original meaning for a human reader.
Key Insights and Ideas
- Prompting isn't a robustness panacea: Contrary to findings on natural distribution shifts, vanilla prompt-based models (LM-BFF) actually show a larger relative performance drop under adversarial attack than fully supervised models.
- Unlabeled data is a powerful shield: The most striking finding is that using unlabeled data (via iPET) significantly improves robustness. By exposing the model to a more diverse set of data during self-training, it learns features that are harder for adversaries to exploit.
- Diversity through Ensembling: Using multiple prompts (PET) helps mitigate the sensitivity of a single prompt to specific word changes, leading to better adversarial stability.
- Scale helps, but doesn't solve everything: Increasing model size and the number of few-shot examples both improve robustness, but the gap between in-domain and adversarial performance remains significant.
- Pre-training objectives matter: RoBERTa encoders were found to be more robust than BERT or ALBERT of similar sizes, likely because RoBERTa’s "whole-word masking" pre-training creates more reliable textual representations.
Key Results
The study uses "Relative Drop" (the percentage decrease in accuracy from the original set to the adversarial set) as the primary metric for robustness.
- Vanilla Vulnerability: LM-BFF had an average relative drop of 36.9%, performing worse than Full FT (35.3%).
- The Robustness Flip: iPET and PET achieved relative drops of 28.1% and 27.2% respectively, outperforming the fully supervised baseline in robustness despite having far less labeled data.
- Model Size Impact: As shown in Figure 3, increasing the ALBERT model size from 12M to 235M parameters drastically reduced the performance gap, though the "relative drop" (bar charts) remains a challenge for smaller models.
Limitations and Future Work
The authors acknowledge several limitations:
- Black-box Attacks: Because AdvGLUE uses pre-constructed examples, the attacks weren't tailored to the specific gradients of the models being tested. Future work should explore "white-box" attacks.
- Hyperparameter Tuning: To maintain a "true" few-shot setting, the authors avoided extensive tuning on a development set, which might have yielded even better results.
- Computational Cost: While iPET and PET are robust, they are more expensive to train and run (due to ensembling and iterative training) than vanilla prompting.
Broadly, this work serves as a warning and a guide: while prompt-based learning is efficient, developers must look beyond simple accuracy and consider the "hidden" costs of ensuring these models are safe from adversarial manipulation.
Summary updated