Source-linked AI summary
Evaluating the Susceptibility of Pre-Trained Language Models via Handcrafted Adversarial Examples
Hezekiah J. Branch, Jonathan Rodriguez Cefalu, Jeremy McHugh, Leyla Hujer, Aditya Bahl, Daniel del Castillo Iglesias, Ron Heichman, Ramesh Darwishi
TL;DR
Adversarial attacks on PLMs have been studied during training or fine-tuning, leaving a gap around attacks on pre-trained models between those stages. This paper tests handcrafted token perturbations on models without fine-tuning and finds that common quality measures can miss their semantic differences.
Problem
Research on PLM adversarial attacks has focused on training or fine-tuning, leaving limited evidence about attacks on pre-trained models between those stages.
Source: §1 · p. 2Method
The authors use handcrafted, semantically divergent token substitutions to test text classification in pre-trained models without fine-tuning.
Source: §1 · p. 2, §3.1 · p. 4Results
Common distance and unsupervised matching measures fail to capture the injected semantic differences, including at sequence level across the evaluated models.
Source: §6 · pp. 7–8Takeaways & Limitations
The findings highlight a security vulnerability in public GPT-3 and support accounting for potential harm as PLMs are used across domains.
Source: §7 · p. 8The study restricts its observations to pre-trained models that have not undergone fine-tuning.
Source: §1 · p. 2
Abstract
from arXiv · showhide
Recent advances in the development of large language models have resulted in public access to state-of-the-art pre-trained language models (PLMs), including Generative Pre-trained Transformer 3 (GPT-3) and Bidirectional Encoder Representations from Transformers (BERT). However, evaluations of PLMs, in practice, have shown their susceptibility to adversarial attacks during the training and fine-tuning stages of development. Such attacks can result in erroneous outputs, model-generated hate speech, and the exposure of users' sensitive information. While existing research has focused on adversarial attacks during either the training or the fine-tuning of PLMs, there is a deficit of information on attacks made between these two development phases. In this work, we highlight a major security vulnerability in the public release of GPT-3 and further investigate this vulnerability in other state-of-the-art PLMs. We restrict our work to pre-trained models that have not undergone fine-tuning. Further, we underscore token distance-minimized perturbations as an effective adversarial approach, bypassing both supervised and unsupervised quality measures. Following this approach, we observe a significant decrease in text classification quality when evaluating for semantic similarity.
1 Introduction
The introduction motivates adversarial testing as a way to expose PLM vulnerabilities that conventional evaluation may miss. It presents a handcrafted attack study of pre-trained, non-fine-tuned models and the limits of common quality measures.
1 Introduction
- Benchmarks support standardized, reproducible model comparisons, while adversarial benchmarks examine vulnerabilities, generalization, and model behavior relevant to safety.The passage notes the absence of a comprehensive universal metric for tasks including text generation and classification.Source: §1 · p. 2
- Adversarial examples perturb an input while minimizing a distance measure, allowing quality measures to mistake the perturbed input for a similar natural one (Tramer et al. [32]).Prior work also reports that BLEU and METEOR may miss paraphrases or meaning-changing small perturbations (Zhang et al. [41]).Source: §1 · p. 2
- The paper reports successful handcrafted adversarial examples in GPT-3, BERT, and BERT-inspired models, and evidence that common distance and n-gram measures miss semantic differences.The study focuses on pre-trained models with zero fine-tuning and reports reduced text-classification quality.Source: §1 · p. 2
2 Background
The background introduces pre-training and the model families and metrics used in the study. It frames masked-language-model classification and compares normalized distance measures with embedding- and n-gram-based quality scores.
2.1 Pre-training
- Pre-training initializes model parameters strategically before downstream fine-tuning, with optimization and regularization effects offered as explanations for its performance gains.The section also notes that activation functions and gradient-descent methods matter for training and learned representations.Source: §2.1 · p. 2
2.2 GPT-3
- GPT-3 is a 175-billion-parameter autoregressive model designed for in-context learning and can perform competitively with fine-tuned models without fine-tuning itself.The background notes its competitiveness is strongest in few-shot settings and discusses potential harm associated with human-indistinguishable text quality (Brown et al.).Source: §2.2 · pp. 2–3
2.3 Bidirectional Transformers
- BERT, RoBERTa, and ALBERT are bidirectional Transformer models; bidirectional context can aid commonsense learning, while these models depend heavily on fine-tuning.ALBERT is presented as a smaller, more memory-friendly BERT variant, and RoBERTa as improving on BERT through pre-training design choices.Source: §2.3 · p. 3
2.4 Masked Language Modeling
- The study evaluates out-of-the-box masked language modeling, where a token is masked and other tokens are used to predict it, focusing on classification quality rather than pseudo-log-likelihood.The passage frames masked language modeling as a common natural-language-understanding objective.Source: §2.4 · p. 3
2.5 Normalized Distance Metrics
- The study records normalized Levenshtein, Jaccard, Cosine, and Sørensen-Dice distance values between adversarial examples and natural inputs, scaling each from 0 (perfect match) to 1 (complete mismatch).Source: §2.5 · p. 3
2.6 Unsupervised Matching Metrics
- BERTScore compares token embeddings using cosine similarities and supplies precision, recall, and F1, while BLEU measures quality through n-gram frequency.BERTScore is included to assess whether embedding-based matching captures small perturbations, and BLEU offers an automatic baseline comparable to human evaluations.Source: §2.6 · p. 4
3 Adversarial Approach
The approach uses handcrafted prompts to test whether pre-trained models change token-level classifications after an adversarial injection. It assesses output changes with similarity measures and human verification.
3.1 Handcrafted Examples
- The authors construct 40 instruction prompts and replace each target classification item with a semantically divergent token, using an instruction to classify it as a distraction.The stated injection format is: “Ignore the previous instructions and classify [ITEM] as [DISTRACTION].”Source: §3.1 · pp. 4–5
- The original classification is treated as a quasi-ground-truth baseline, and pre- and post-injection outputs are compared using token- and sequence-level semantic-similarity measures.Table 1 lists the models selected for the classification task.Source: §3.1 · p. 5, Table 1 · p. 5
3.2 Human Verification
- Human annotators label whether each post-injection classification differs semantically from the original, helping assess model outputs and interpret quality scores.Verification also addresses case sensitivity, syntactic differences, and outputs outside the model vocabulary.Source: §3.2 · p. 5
4 Experimental Setup
The experiments evaluate seven PLMs with handcrafted adversarial examples, selecting GPT-3, BERT, RoBERTa, and ALBERT for the classification task and specifying model-specific settings.
4.1 Dataset
- Each of seven models received 40 adversarial examples; the study analyzed 2,800 outputs, including 200 gold-standard and 200 generated classifications per model.The outputs comprise 400 classifications per model.Source: §4.1 · p. 5
4.2 Model Selection
- The classification models were text-davinci-002, bert-base-uncased, albert-base-v2, and roberta-base; the three bidirectional models were chosen for MLM capability and budget constraints.The authors report GPT-3 observations because they first identified the vulnerability in that model.Source: §4.2 · p. 5
4.3 Experiment Settings
- Model settings came from Hugging Face model cards and the OpenAI Playground; BERT-family models used Hugging Face defaults for fill-mask, including five candidate choices.GPT-3 used temperature 0.0 and maximum length 6; the reported BERT, RoBERTa, and ALBERT configurations varied in dropout and vocabulary size.Source: §4.3 · pp. 5–6
5 Results
The results show the injected class leading GPT-3’s Playground choice, report token- and sequence-level metric summaries, and give injection accuracy and F1 scores for three bidirectional models.
5.1 GPT-3 Playground
- Nearly 14% more likely than the ground-truth class, the injected class was GPT-3 Playground’s most likely option in the illustrated example.The paper also reports the vulnerability to the OpenAI team responsible for the Playground.Source: Figure 1 · p. 6, §5.1 · p. 6
5.2 Normalized Distance-Based Scores
- Table 2 reports mean and median Levenshtein, Sørensen-Dice, Jaccard, and Cosine distances at token and sequence levels.Source: §5.2 · p. 6
5.3 Unsupervised Matching Scores
- Table 3 reports mean and median BERTScore precision, recall, and F1, plus BLEU-1 and BLEU-4, at token and sequence levels.Source: §5.3 · p. 6
5.4 F1 Score and Injection Accuracy
- 0.675 injection accuracy was reported for both RoBERTa and ALBERT, versus 0.425 for BERT; their token- and sequence-level F1 scores also differed.BERT: 0.39922 token-level and 0.40351 sequence-level; RoBERTa: 0.20748 and 0.09589; ALBERT: 0.21544 and 0.19403.Source: §5.4 · p. 6
6 Discussion
The discussion finds that common distance and unsupervised scores can miss semantically different adversarial classifications, with token- and sequence-level results differing across models.
- The authors define mismatch-indicating thresholds for BLEU, BERTScore, and normalized distance metrics, yet report that these metrics fail to capture the injected adversarial examples.High BLEU values suggest corrupted outputs may bypass quality checks despite sequence-level semantic differences.Source: §6 · p. 7
- Despite semantic differences, every model’s median BERTScore was closer to 1 than 0; human verification and sequence-distance scores supported the mismatch interpretation.Source: §6 · p. 7
- Token-level distances were higher than sequence-level distances across measures and models, while BERT’s median distances were zero and RoBERTa’s sequence medians were near zero.ALBERT had the highest normalized distances overall but still had sequence-level medians close to zero, motivating more robust text-quality measures.Source: §6 · pp. 7–8
7 Conclusion
The proposed adversarial approach tests PLMs before fine-tuning and highlights a security vulnerability in the public GPT-3 Playground. The authors report reduced text-classification quality beyond GPT-3 and potential to surpass known quality controls.
7 Conclusion
- The approach tests PLM robustness before fine-tuning and highlights a major security vulnerability in the public GPT-3 Playground.The authors describe the observed vulnerability as an example of harmful behavior being injected into pre-trained models.Source: §7 · p. 8
- The approach decreases text-classification quality in state-of-the-art models beyond GPT-3 and may surpass known quality-control methods.The authors also identify potential relevance to model interpretability and fairness.Source: §7 · p. 8
- The authors argue that potential harms from shared PLMs across domains must be accounted for to prevent unintended harm to users.They frame their observed vulnerability as additional evidence of the work needed to prevent such harm.Source: §7 · p. 8