Skip to main content
QUICK REVIEW

[Paper Review] Evaluating the Susceptibility of Pre-Trained Language Models via Handcrafted Adversarial Examples

Hezekiah J. Branch, Jonathan Rodriguez Cefalù|arXiv (Cornell University)|Sep 5, 2022
Adversarial Robustness in Machine LearningComputer Science13 citations
TL;DR

This paper evaluates the susceptibility of pre-trained language models (PLMs) to handcrafted adversarial examples that induce semantic misclassification while preserving low token-level perturbations. It demonstrates that widely used distance and n-gram metrics fail to detect significant semantic mismatches, exposing a critical vulnerability in GPT-3 and BERT-family models prior to fine-tuning.

ABSTRACT

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.

Motivation & Objective

  • To investigate the robustness of pre-trained language models (PLMs) against handcrafted adversarial examples before fine-tuning.
  • To expose vulnerabilities in public releases of GPT-3, particularly the GPT-3 Playground, that allow semantic misclassification with minimal input perturbations.
  • To evaluate the failure of standard distance and n-gram metrics (e.g., BLEU, BERTScore) in detecting meaningful semantic differences in model outputs.
  • To demonstrate that token-level perturbations can drastically alter classification outcomes while remaining undetected by common quality assessment measures.
  • To advocate for adversarial training and fine-tuning approaches that account for semantic-level perturbations in model evaluation.

Proposed method

  • The authors construct adversarial examples through deliberate, handcrafted token-level perturbations designed to alter semantic meaning while minimizing changes in surface-level token sequences.
  • They evaluate model performance using multiple distance metrics: Levenshtein, Sørensen-Dice, Jaccard, and Cosine, computed at both token and sequence levels.
  • The study employs BERTScore (precision, recall, F1) and BLEU-1/BLEU-4 to assess text generation quality and similarity between natural and adversarial inputs.
  • Model outputs are compared against gold-standard labels to measure classification quality under adversarial conditions.
  • The analysis includes both zero-shot masked language modeling and classification tasks across BERT, RoBERTa, and ALBERT models.
  • Human verification is used to confirm semantic mismatches between natural and adversarially perturbed inputs, ensuring the adversarial examples are semantically distinct.

Experimental results

Research questions

  • RQ1Can handcrafted adversarial examples successfully induce semantic misclassification in pre-trained language models like GPT-3 and BERT without triggering detection by standard metrics?
  • RQ2To what extent do common text quality metrics such as BLEU and BERTScore fail to detect significant semantic differences in model outputs caused by minimal token-level perturbations?
  • RQ3How do distance-based metrics (Levenshtein, Jaccard, etc.) perform in capturing semantic divergence between natural and adversarial inputs at both token and sequence levels?
  • RQ4Why do median distance scores remain near zero across multiple models despite large semantic discrepancies in model outputs?
  • RQ5What implications do these findings have for model interpretability, fairness, and the reliability of current evaluation benchmarks in pre-trained language models?

Key findings

  • The median Levenshtein, Sørensen-Dice, Jaccard, and Cosine distance scores between adversarial and natural inputs were near zero (e.g., 0.010411 for Cosine in BERT), indicating minimal detectable change at the sequence level.
  • Despite large semantic differences, BERTScore F1 values remained high (e.g., 0.6855 for BERT, 0.9061 for RoBERTa), suggesting strong false positives in similarity assessment.
  • BLEU-1 and BLEU-4 scores remained above 0.98 across all models, indicating that n-gram metrics fail to detect semantic degradation.
  • Token-level distance metrics showed significantly higher values than sequence-level metrics, revealing that semantic divergence is more detectable at the token level.
  • ALBERT showed the highest normalized distance scores (e.g., 0.6210 for Levenshtein), but still failed to capture semantic differences at the sequence level, with median scores near zero.
  • The results demonstrate that current standard metrics are insufficient for detecting adversarial perturbations that drastically alter semantic meaning, exposing a critical flaw in model evaluation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.