NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On Adversarial Robustness of Language Models in Transfer Learning

Bohdan Turbal, Anastasiia Mazur, Jiaxu Zhao, Mykola Pechenizkiy

TL;DR

Transfer learning is a double-edged sword: while it consistently boosts standard performance metrics, it often leaves Large Language Models (LLMs) significantly more vulnerable to adversarial attacks. This research quantifies this "robustness tax" across various architectures and demonstrates that while model scale offers some natural resilience, explicit adversarial training is essential to secure models adapted for real-world tasks.

What Problem Does This Paper Address?

In modern NLP, we rarely train models from scratch. Instead, we use transfer learning: taking a model pre-trained on a massive corpus and fine-tuning it for a specific task. While this is highly efficient for reaching high accuracy, its impact on adversarial robustness—a model's ability to resist small, intentional perturbations designed to cause misclassification—is poorly understood.

The authors set out to bridge this gap, asking: Does the process of adapting a model to a new domain inadvertently open up security backdoors? They specifically look at bias detection (hate speech, political bias, etc.), where robustness is critical to prevent malicious actors from bypassing safety filters with simple word swaps.

Methods

The researchers designed a controlled experiment to compare two training pipelines:

  1. Usual Fine-Tuning: Training the model directly on the target task.
  2. Transfer Learning: Training on a large related dataset first, then fine-tuning on a smaller target dataset.
Figure 1: Experiment setup, where we compare LLM’s properties in additional Transfer learning setup and just target dataset fine-tuning.

They evaluated a diverse "zoo" of models, including encoder-based (BERT, RoBERTa) and decoder-based (GPT-2, Phi-2, Gemma) architectures. To test robustness, they employed two adversarial attack methods:

  • TextFooler: A black-box attack that swaps words with synonyms to flip the model's prediction.
  • A2T: A white-box, gradient-based attack that identifies the most "important" words to perturb.

Finally, they explored Adversarial Training, where 10% of the training data consists of adversarial examples, to see if robustness could be "baked in" during the transfer process.

Datasets

The study utilizes the MBIB (Media Bias Identification Benchmark), focusing on three specific subdomains:

  • Hate Speech (HS): Identifying hateful content.
  • Political Bias (PB): Detecting partisan leanings in text.
  • Gender Bias (GB): Recognizing sexist or biased language.

Each dataset was split into a large set (12,000 examples) for the initial transfer stage and a small set (600 examples) for final task adaptation, mimicking common real-world low-data scenarios.

Key Insights and Ideas

  • The Performance-Robustness Trade-off: The most striking finding is that accuracy and robustness often move in opposite directions. A model might get "smarter" at the target task while becoming much "brittler" to attacks.
  • Scale as a Shield: Larger models are naturally more resilient. While they still see a drop in robustness after transfer learning, the magnitude of the increase in Attack Success Rate (ASR) is much lower than in smaller models.
  • Architecture Matters: Interestingly, the initial robustness (before transfer) varied by family. BERT and RoBERTa became more robust as they grew larger, whereas GPT-2 models actually showed higher baseline vulnerability as they scaled up.
  • LoRA's Mixed Bag: For massive models like Phi-2 and Gemma, the researchers used Low-Rank Adaptation (LoRA). The results were highly variable, suggesting that the way LoRA updates only a fraction of weights creates a complex, non-linear relationship with adversarial security.

Key Results

The quantitative results highlight a concerning trend: in many cases, transfer learning led to a massive spike in vulnerability. For example, GPT-2 saw a 20.4% increase in Attack Success Rate on the Hate Speech dataset, even though its standard accuracy improved by 3.67%.

Table 1: Performance and safety metrics comparison for models with and without transfer learning, averaged across attack methods (Text Fooler and A2T) and individual sequences ending with the target dataset. OAcc - Original Accuracy, ASR - Attack Sucess Rate, AUA - Accuracy Under Attack, ∆(%) - relative change.

However, the authors found that Adversarial Training is a potent countermeasure. By including adversarial examples during the transfer process, they could significantly reduce the ASR—sometimes by nearly 30%—while maintaining competitive accuracy.

Table 3: Impact of A2T attack on Bert performance, where for convenience of notation: HS, PB and GB are Hate speech, Political bias and Gender bias datasets.

As shown in the figures below, the "robustness tax" ($\Delta$ASR) clearly diminishes as model size increases across all tested families.

Figure 2: ∆ASR by model size and archi- tecture.

Limitations and Future Work

The study primarily focuses on classification tasks within the domain of bias detection. Whether these findings hold for generative tasks (like summarization or open-ended chat) remains an open question. Additionally, the mixed results with LoRA suggest that parameter-efficient fine-tuning methods need a dedicated, deeper investigation regarding their security implications.

Future work could also explore "catastrophic forgetting" in the context of robustness—does a model lose its defensive capabilities because it's overwriting general features with task-specific ones? Understanding this mechanism will be key to building LLMs that are both high-performing and secure.

Summary updated

BibTeX
@inproceedings{turbal2024adversarial,
  author = {Bohdan Turbal and Anastasiia Mazur and Jiaxu Zhao and Mykola Pechenizkiy},
  title = {{On Adversarial Robustness of Language Models in Transfer Learning}},
  booktitle = {SoLaR @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=DUMVB9a9sX},
}
Figure