Self-Supervised Contrastive Learning with Adversarial Perturbations for Defending Word Substitution-based Attacks

Zhao Meng, Yihan Dong, Mrinmaya Sachan, Roger Wattenhofer
7/15/2021
cs.CL
contrastive-ssl

Official code: LotusDYH/ssl_robust (3 stars, Python, last commit 2023-01-07).

Abstract

In this paper, we present an approach to improve the robustness of BERT language models against word substitution-based adversarial attacks by leveraging adversarial perturbations for self-supervised contrastive learning. We create a word-level adversarial attack generating hard positives on-the-fly as adversarial examples during contrastive learning.

Show full abstract

In contrast to previous works, our method improves model robustness without using any labeled data. Experimental results show that our method improves robustness of BERT against four different word substitution-based adversarial attacks, and combining our method with adversarial training gives higher robustness than adversarial training alone. As our method improves the robustness of BERT purely with unlabeled data, it opens up the possibility of using large text datasets to train robust language models against word substitution-based adversarial attacks.

View on arXivView PDF

Code Implementations(1)

30PythonMay 2, 20223 years ago

Similar Papers

Cite this paper

@article{meng2021selfsupervised,
  title  = {Self-Supervised Contrastive Learning with Adversarial Perturbations for Defending Word Substitution-based Attacks},
  author = {Zhao Meng and Yihan Dong and Mrinmaya Sachan and Roger Wattenhofer},
  year   = {2021},
  eprint = {2107.07610},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2107.07610}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2107.07610.svg)](https://codeofpaper.com/paper/2107.07610)

Discussion