Skip to main content
QUICK REVIEW

[Paper Review] Simple Contrastive Representation Adversarial Learning for NLP Tasks

Deshui Miao, Jiaqi Zhang|arXiv (Cornell University)|Nov 26, 2021
Topic ModelingComputer Science47 references6 citations
TL;DR

This paper proposes Simple Contrastive Adversarial Learning (SCAL) and unsupervised SCAL (USCAL), which generate hard adversarial examples in the embedding space to serve as positive pairs for contrastive learning, enhancing both model robustness and generalization. The method achieves state-of-the-art performance on GLUE benchmarks (1.75% improvement over BERT base) and SOTA results on adversarial NLI tasks, with 32.4% accuracy on ANLI test set and 58.6% on ANLI development set under adversarial training.

ABSTRACT

Self-supervised learning approach like contrastive learning is attached great attention in natural language processing. It uses pairs of training data augmentations to build a classification task for an encoder with well representation ability. However, the construction of learning pairs over contrastive learning is much harder in NLP tasks. Previous works generate word-level changes to form pairs, but small transforms may cause notable changes on the meaning of sentences as the discrete and sparse nature of natural language. In this paper, adversarial training is performed to generate challenging and harder learning adversarial examples over the embedding space of NLP as learning pairs. Using contrastive learning improves the generalization ability of adversarial training because contrastive loss can uniform the sample distribution. And at the same time, adversarial training also enhances the robustness of contrastive learning. Two novel frameworks, supervised contrastive adversarial learning (SCAL) and unsupervised SCAL (USCAL), are proposed, which yields learning pairs by utilizing the adversarial training for contrastive learning. The label-based loss of supervised tasks is exploited to generate adversarial examples while unsupervised tasks bring contrastive loss. To validate the effectiveness of the proposed framework, we employ it to Transformer-based models for natural language understanding, sentence semantic textual similarity and adversarial learning tasks. Experimental results on GLUE benchmark tasks show that our fine-tuned supervised method outperforms BERT$_{base}$ over 1.75\%. We also evaluate our unsupervised method on semantic textual similarity (STS) tasks, and our method gets 77.29\% with BERT$_{base}$. The robustness of our approach conducts state-of-the-art results under multiple adversarial datasets on NLI tasks.

Motivation & Objective

  • To address the challenge of generating meaningful, label-preserving positive pairs in contrastive learning for NLP, where discrete and sparse text makes data augmentation difficult.
  • To improve model robustness and generalization by combining adversarial training with contrastive learning, leveraging adversarial examples as hard positive pairs.
  • To propose a unified framework that integrates supervised and unsupervised contrastive adversarial learning for diverse NLP tasks.
  • To validate the effectiveness of adversarial examples in the embedding space as a new data augmentation strategy for contrastive learning in NLP.

Proposed method

  • Adversarial examples are generated in the embedding space by computing gradients of the input embeddings and adding a small perturbation to create $ z_i^{adv} $.
  • The framework uses a contrastive loss to pull together $ z_i $ and $ z_i^{adv} $ as positive pairs while pushing apart representations from different instances.
  • For supervised tasks, the label-based classification loss is combined with the contrastive loss in SCAL to jointly optimize for accuracy and representation quality.
  • For unsupervised tasks, the contrastive loss is used alone in USCAL to learn sentence representations without labels.
  • Shared encoder and classifier weights are used across all branches to maintain consistency and improve training efficiency.
  • The method is applied to BERT and RoBERTa-based models, with adversarial training performed via gradient-based perturbations to generate challenging positive pairs.

Experimental results

Research questions

  • RQ1Can adversarial examples generated in the embedding space serve as effective positive pairs for contrastive learning in NLP?
  • RQ2Does combining adversarial training with contrastive learning improve model generalization and robustness on downstream NLP tasks?
  • RQ3How does the proposed SCAL framework compare to existing adversarial training and contrastive learning methods on GLUE and NLI benchmarks?
  • RQ4Can the unsupervised variant USCAL effectively learn sentence representations comparable to supervised methods?

Key findings

  • SCAL outperforms BERT base by 1.75% on the GLUE benchmark, demonstrating improved generalization in supervised NLU tasks.
  • On the semantic textual similarity (STS) task, the unsupervised USCAL method achieves 77.29% with BERT base, showing strong zero-shot performance.
  • On the adversarial ANLI benchmark, SCAL achieves 32.4% test accuracy when trained on MNLI+SNLI, outperforming FreeLB (27.4%) and InfoBERT (28.2%) by over 4 percentage points.
  • When fine-tuned on adversarial datasets (MNLI+SNLI+ANLI+FeverNLI), SCAL achieves 58.6% robust accuracy on ANLI development set with RoBERTa, surpassing InfoBERT (58.3%) and FreeLB (56.2%).
  • The method maintains strong performance across multiple adversarial NLI datasets, indicating high robustness under diverse attack scenarios.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.