Skip to main content
QUICK REVIEW

[Paper Review] Interpretable Adversarial Training for Text

Samuel Barham, Soheil Feizi|arXiv (Cornell University)|May 30, 2019
Adversarial Robustness in Machine LearningComputer Science37 references11 citations
TL;DR

This paper proposes Sparse Projected Gradient Descent (SPGD), a method for generating interpretable and low-perplexity adversarial examples in text by projecting perturbations onto the nearest neighbor word embeddings and enforcing sparsity at the sentence level. SPGD improves adversarial example interpretability and likelihood (measured by perplexity) while maintaining state-of-the-art test accuracy, outperforming vanilla AdvT-Text and iAdvT-Text in both quality and semantic coherence.

ABSTRACT

Generating high-quality and interpretable adversarial examples in the text domain is a much more daunting task than it is in the image domain. This is due partly to the discrete nature of text, partly to the problem of ensuring that the adversarial examples are still probable and interpretable, and partly to the problem of maintaining label invariance under input perturbations. In order to address some of these challenges, we introduce sparse projected gradient descent (SPGD), a new approach to crafting interpretable adversarial examples for text. SPGD imposes a directional regularization constraint on input perturbations by projecting them onto the directions to nearby word embeddings with highest cosine similarities. This constraint ensures that perturbations move each word embedding in an interpretable direction (i.e., towards another nearby word embedding). Moreover, SPGD imposes a sparsity constraint on perturbations at the sentence level by ignoring word-embedding perturbations whose norms are below a certain threshold. This constraint ensures that our method changes only a few words per sequence, leading to higher quality adversarial examples. Our experiments with the IMDB movie review dataset show that the proposed SPGD method improves adversarial example interpretability and likelihood (evaluated by average per-word perplexity) compared to state-of-the-art methods, while suffering little to no loss in training performance.

Motivation & Objective

  • To address the lack of interpretability and high likelihood (perplexity) in existing adversarial training methods for text.
  • To improve the quality of adversarial examples by ensuring they remain semantically coherent and close to the original distribution.
  • To maintain label invariance under perturbation while reducing the number of changed words per sequence.
  • To develop a method that enables easier debugging of text classifiers by producing human-interpretable adversarial examples.
  • To demonstrate that higher-quality adversarial examples lead to better generalization in text classification.

Proposed method

  • SPGD introduces a directional regularization constraint by projecting perturbations onto the directions of the nearest neighbor word embeddings with highest cosine similarity.
  • It enforces sparsity at the sentence level by retaining only the top σ proportion of perturbations by norm, reducing the number of changed words.
  • The method operates in the embedding space, using projected gradient descent with constraints to ensure perturbations move toward semantically meaningful neighboring words.
  • The perturbation direction is computed as the normalized vector pointing toward the nearest neighbor embedding, ensuring interpretability.
  • Label invariance is preserved indirectly by limiting the number of perturbed words, reducing the risk of misclassification.
  • The approach is integrated into adversarial training by jointly optimizing over original and SPGD-generated adversarial examples.

Experimental results

Research questions

  • RQ1Can adversarial examples in text be made more interpretable by constraining perturbations to move toward nearby word embeddings?
  • RQ2Does enforcing sparsity in perturbations improve the likelihood and grammatical quality of adversarial sequences?
  • RQ3Can a method that combines directional regularization and sparsity maintain or improve model test accuracy compared to existing adversarial training baselines?
  • RQ4To what extent do SPGD-generated adversarial examples remain close to the data-generating distribution, as measured by perplexity?
  • RQ5Does using higher sparsity coefficients (e.g., σ = 0.75) lead to better generalization and robustness in text classification?

Key findings

  • SPGD-generated adversarial examples achieve a lower average per-word perplexity (17.3) compared to vanilla AdvT-Text (21.5) and iAdvT-Text (22.1), indicating higher likelihood and better alignment with the data distribution.
  • The method maintains high test accuracy, achieving 93.54% on the IMDB dataset—comparable to the 93.58% of vanilla AdvT-Text and iAdvT-Text.
  • With a sparsity coefficient of σ = 0.75, SPGD achieved the best test accuracy, suggesting higher sparsity improves generalization.
  • Discretized adversarial sequences from SPGD are more grammatically correct and semantically similar to originals than those from AdvT-Text or iAdvT-Text, with fewer cases of label inversion.
  • SPGD adversarial examples are significantly less distinguishable from real data than those from prior methods, as shown by their closer perplexity to original sequences.
  • The method enables easier interpretation of adversarial behavior, as each non-zero perturbation can be mapped to a nearest neighbor word, facilitating model debugging.

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.