Toward Adversarial Training on Contextualized Language Representation

Hongqiu Wu, Y. Liu, Han Shi, Haizhen Zhao, M. Zhang
2/12/2026

No official code found. Best implementation: gingasan/CreAT (9 stars, last commit 2023-05-12).

Abstract

Beyond the success story of adversarial training (AT) in the recent text domain on top of pre-trained language models (PLMs), our empirical study showcases the inconsistent gains from AT on some tasks, e.g. commonsense reasoning, named entity recognition. This paper investigates AT from the perspective of the contextualized language representation outputted by PLM encoders. We find the current AT attacks lean to generate sub-optimal adversarial examples that can fool the decoder part but have a minor effect on the encoder. However, we find it necessary to effectively deviate the latter one to allow AT to gain. Based on the observation, we propose simple yet effective \textit{Contextualized representation-Adversarial Training} (CreAT), in which the attack is explicitly optimized to deviate the contextualized representation of the encoder. It allows a global optimization of adversarial examples that can fool the entire model. We also find CreAT gives rise to a better direction to optimize the adversarial examples, to let them less sensitive to hyperparameters. Compared to AT, CreAT produces consistent performance gains on a wider range of tasks and is proven to be more effective for language pre-training where only the encoder part is kept for downstream tasks. We achieve the new state-of-the-art performances on a series of challenging benchmarks, e.g. AdvGLUE (59.1 $ \rightarrow $ 61.1), HellaSWAG (93.0 $ \rightarrow $ 94.9), ANLI (68.1 $ \rightarrow $ 69.3).

View on arXivView PDF

Code Implementations(1)

gingasan/CreATCommunity100%
91PythonFeb 15, 20233 years ago

Similar Papers

Cite this paper

@article{wu2026toward,
  title  = {Toward Adversarial Training on Contextualized Language Representation},
  author = {Hongqiu Wu and Y. Liu and Han Shi and Haizhen Zhao and M. Zhang},
  year   = {2026},
  eprint = {2305.04557},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2305.04557},
  journal = {ICLR 2023 2023}
}

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

Discussion