SemRoDe: Macro Adversarial Training to Learn Representations That are Robust to Word-Level Attacks

Brian Formento, Wenjie Feng, Chuan Sheng Foo, Luu Anh Tuan, See-Kiong Ng
3/27/2024
cs.CLcs.LG

No official code found. Best implementation: Aniloid2/SemRoDe-MacroAdversarialTraining (4 stars, Apache-2.0, last commit 2024-03-23).

Abstract

Language models (LMs) are indispensable tools for natural language processing tasks, but their vulnerability to adversarial attacks remains a concern. While current research has explored adversarial training techniques, their improvements to defend against word-level attacks have been limited. In this work, we propose a novel approach called Semantic Robust Defence (SemRoDe), a Macro Adversarial Training strategy to enhance the robustness of LMs. Drawing inspiration from recent studies in the image domain, we investigate and later confirm that in a discrete data setting such as language, adversarial samples generated via word substitutions do indeed belong to an adversarial domain exhibiting a high Wasserstein distance from the base domain. Our method learns a robust representation that bridges these two domains. We hypothesize that if samples were not projected into an adversarial domain, but instead to a domain with minimal shift, it would improve attack robustness. We align the domains by incorporating a new distance-based objective. With this, our model is able to learn more generalized representations by aligning the model's high-level output features and therefore better handling unseen adversarial samples. This method can be generalized across word embeddings, even when they share minimal overlap at both vocabulary and word-substitution levels. To evaluate the effectiveness of our approach, we conduct experiments on BERT and RoBERTa models on three datasets. The results demonstrate promising state-of-the-art robustness.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Code for NAACL 2024 SemRoDe: Macro Adversarial Training to learn representations that are robust to word-level attacks

40C, C++Nov 17, 20222 years agoApache-2.0

Similar Papers

Cite this paper

@article{formento2024semrode,
  title  = {SemRoDe: Macro Adversarial Training to Learn Representations That are Robust to Word-Level Attacks},
  author = {Brian Formento and Wenjie Feng and Chuan Sheng Foo and Luu Anh Tuan and See-Kiong Ng},
  year   = {2024},
  eprint = {2403.18423},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.18423v1}
}

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/2403.18423.svg)](https://codeofpaper.com/paper/2403.18423)

Discussion