Robust Transfer Learning with Pretrained Language Models through Adapters

Wenjuan Han, Bo Pang, Ying Nian Wu

Abstract

Fine-tuning large-scale pretrained language models (PLMs) like BERT often results in high performance variability and susceptibility to adversarial attacks. This paper investigates a more robust transfer learning paradigm using task-specific adapter layers. By freezing the backbone model and training only a small fraction of parameters—preceded by task-specific unsupervised pretraining (TSP)—we demonstrate that adapters provide superior stability, parameter efficiency, and adversarial robustness compared to standard full-parameter fine-tuning.

Introduction

The prevailing paradigm in NLP involves sequential transfer learning: pretraining a massive model on a general corpus and then fine-tuning all parameters on a specific downstream task. Despite its success, this approach faces three critical challenges. First, instability: performance is highly sensitive to random seeds and training duration, leading to unpredictable results. Second, adversarial vulnerability: fine-tuned models are often brittle, where minor input perturbations can drastically alter predictions. Third, inefficiency: storing and deploying full copies of 110M+ parameter models for every task is computationally prohibitive.

Methodology

The authors propose a two-stage training scheme centered on Adapters. These are small bottleneck layers inserted into each transformer layer. During training, the original weights are frozen, and only the adapters (comprising ~3.6% of total parameters) are updated.

  1. Task-Specific Unsupervised Pretraining (TSP): Adapters are first trained on the downstream task's unlabeled data using a Masked Language Modeling (MLM) objective. This aligns the adapters with the specific domain while maintaining compatibility with the frozen general features.
  2. Task-Specific Supervised Training: The "warmed-up" adapters are then fine-tuned on labeled data for the target task (e.g., sentiment analysis).

This architecture treats the model as a residual learner, where the frozen backbone extracts general features and the adapters learn task-specific residuals.

Experimental Results

Stability and Performance

The researchers evaluated the framework on the GLUE benchmark, focusing on notoriously unstable datasets like CoLA and RTE. The "With Adapter + TSP" method consistently outperformed standard fine-tuning. For instance, on CoLA, scores improved from 56.53 to 64.87.

Crucially, the adapter-based approach exhibited significantly lower variance across multiple runs. As shown in Figure 6, as task-specific pretraining iterations increase, the performance distribution for adapter-based models (W.) becomes both higher and tighter compared to standard fine-tuning (WO.).

Stability and performance distribution across pretraining iterations.

Adversarial Robustness

Beyond stability, the constrained parameter space of adapters acts as a form of regularization, preventing the model from overfitting to training noise. When subjected to adversarial attacks using the PWWS method, adapter-based models demonstrated a markedly lower Attack Success Rate compared to standard models.

Comparison of Attack Success Rate between standard fine-tuning (WO.) and adapter-based training (W.).

Discussion and Conclusion

The empirical success of adapters is attributed to several factors. By providing a more direct optimization path, adapters mitigate the vanishing gradient problem often seen in the lower layers of deep PLMs during standard fine-tuning. Furthermore, the limited parameter budget prevents the "distortion" of internal representations, leading to the observed adversarial robustness.

While the benefits are most pronounced on small-to-medium datasets, the approach offers a compelling alternative to full fine-tuning by providing a stable, efficient, and robust pathway for deploying large language models across diverse tasks. Future work will explore the theoretical underpinnings of why the adapter parameter space facilitates easier optimization.

Summary updated

BibTeX
@inproceedings{han2021robust,
  author = {Wenjuan Han and Bo Pang and Ying Nian Wu},
  title = {{Robust Transfer Learning with Pretrained Language Models through Adapters}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-short.108},
}
Figure