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

Virtual Data Augmentation: A Robust and General Framework for Fine-tuning Pre-trained Models

Kun Zhou, Wayne Xin Zhao, Sirui Wang, Fuzheng Zhang, Wei Wu, Ji-Rong Wen

Introduction

Pre-trained Language Models (PLMs) like BERT and RoBERTa have set new benchmarks across NLP tasks. However, these models remain vulnerable to adversarial attacks, where minor input perturbations—such as synonym swaps—lead to incorrect predictions. Existing defenses typically rely on Adversarial Data Augmentation (ADA), which struggles with the discrete nature of text, or Virtual Adversarial Training (VAT), which adds gradient-based noise that may lack semantic meaning.

Conceptual comparison of Data Augmentation, Virtual Adversarial Training, and Virtual Data Augmentation.

To address these challenges, we introduce Virtual Data Augmentation (VDA), a framework that generates "virtual" training examples in the embedding space. VDA combines the semantic grounding of word-level changes with the continuous nature of mathematical noise.

The VDA Framework

VDA operates through two main pillars: Embedding Augmentation and Regularized Training.

Embedding Augmentation

Instead of replacing a word with a single discrete synonym, VDA constructs a virtual embedding by leveraging a Masked Language Model (MLM). The MLM calculates the substitution probability for every word in the vocabulary at a specific position. VDA then creates a weighted average (a multinomial mixture) of these word embeddings. To ensure diversity, Gaussian noise is injected into these probabilities, creating an infinite variety of virtual inputs that remain semantically relevant to the original context.

The VDA architecture: from input text to virtual embedding aggregation and regularized training.

Regularized Training

To ensure the model learns from these virtual inputs, VDA employs a consistency-based objective. It minimizes the Symmetric KL-divergence between the model's predictions on the original text and its predictions on the virtual, noised version. This regularization encourages the model to maintain stable outputs even when faced with input perturbations.

Experimental Results

The authors evaluated VDA across six benchmarks, including sentiment analysis (Yelp, IMDB, MR), topic classification (AG’s News), and natural language inference (QNLI).

Robustness and Accuracy

VDA consistently outperformed standard fine-tuning and state-of-the-art adversarial methods like FreeLB and SMART. Notably, VDA improved "Attack Accuracy" on the MR dataset from 21.0% to 33.9%. Unlike many defense methods that trade off standard performance for robustness, VDA often improved accuracy on clean data; for instance, Yelp accuracy increased from 95.7% to 95.9%.

Efficiency

By generating virtual samples in a single forward pass through the MLM, VDA avoids the multiple backward passes required by many gradient-based adversarial methods, offering a more efficient path to model robustness.

Conclusion

Virtual Data Augmentation (VDA) provides a powerful mechanism for smoothing the representation space of PLMs. By anchoring noise in semantic probabilities provided by an MLM, VDA creates robust models that are resilient to adversarial attacks while maintaining high performance on standard benchmarks.

Summary updated

BibTeX
@inproceedings{zhou2021virtual,
  author = {Kun Zhou and Wayne Xin Zhao and Sirui Wang and Fuzheng Zhang and Wei Wu and Ji-Rong Wen},
  title = {{Virtual Data Augmentation: A Robust and General Framework for Fine-tuning Pre-trained Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.315},
}
Figure