Interpretable Adversarial Perturbation in Input Embedding Space for Text

Motoki Sato, Jun Suzuki, Hiroyuki Shindo, Yuji Matsumoto

Introduction

Adversarial training (AdvT) has emerged as a powerful regularization technique in machine learning, particularly in computer vision. By introducing small, calculated perturbations to input data during training, models become more robust and generalize better to unseen data. However, applying AdvT to Natural Language Processing (NLP) presents a unique challenge: text is discrete. Unlike an image where a pixel value can be shifted by a fraction, one cannot simply add "0.01" to a word like "cat."

Previous state-of-the-art approaches, such as those by Miyato et al. (2017), circumvented this by applying perturbations to the continuous word embedding space. While effective at improving model performance, these perturbations often result in abstract vectors that do not correspond to any actual words in the vocabulary. This creates a "black box" where the model's sensitivity is known, but the semantic meaning of that sensitivity remains hidden. This paper introduces iAdvT-Text, a method designed to bridge the gap between high performance and human interpretability by restricting adversarial perturbations to directions that point toward existing words.

Methodology: Interpretable Adversarial Perturbation (iAdvT)

The core innovation of this work is the Interpretable Adversarial Perturbation (iAdvT). Unlike standard AdvT, which allows the perturbation vector $r$ to point in any direction within the $D$-dimensional embedding space, iAdvT imposes a directional constraint.

Comparison between standard Adversarial Training (AdvT) and the proposed Interpretable Adversarial Training (iAdvT). While standard AdvT uses arbitrary directions, iAdvT restricts perturbations to point toward existing word vectors in the embedding space.

Directional Restriction and Weighted Perturbation

The authors define "direction vectors" $d_k$ that point from the current word's embedding $w^{(t)}$ toward the embeddings of other words $w_k$ in the vocabulary. The adversarial perturbation is then calculated as a weighted sum of these word-to-word directions. By optimizing these weights to maximize the model's loss, the algorithm identifies which word substitutions are most likely to trigger a misclassification.

Practical Computation

Calculating directions to every word in a large vocabulary is computationally prohibitive ($O(|V|^2)$). To maintain efficiency, the authors implement a "Practical Computation" strategy: they only consider directions toward the 10 nearest neighbors of the current word in the embedding space. This approximation captures the most relevant semantic shifts while keeping the computational overhead manageable.

Semi-Supervised Extension (iVAT-Text)

The method is further extended to Virtual Adversarial Training (iVAT-Text). This allows the model to leverage unlabeled data by ensuring that the model's output remains consistent even when inputs are perturbed toward nearby words, effectively smoothing the manifold around the data points in a semantically meaningful way.

Experimental Results

The authors evaluated iAdvT-Text and iVAT-Text across several benchmarks, including Sentiment Evaluation Classification (SEC), Category Classification (CAC), and Grammatical Error Detection (GED).

Performance Benchmarks

The results demonstrate that interpretability does not come at the cost of accuracy. In fact, the constrained perturbations often led to superior generalization:

  • Sentiment Analysis (IMDB): iVAT-Text achieved a 5.66% error rate, outperforming the previous non-interpretable VAT-Text (5.69%) and the baseline (7.05%).
  • Grammatical Error Detection (FCE-public): iAdvT-Text reached an $F_{0.5}$ score of 42.26, matching the performance of unconstrained AdvT-Text (42.28).

Qualitative Insights

Because iAdvT perturbations point toward real words, the authors can "reconstruct" adversarial sentences. For example, in the GED task, the model was found to be vulnerable when the word "choose" was perturbed toward "choosing." This diagnostic capability allows researchers to pinpoint specific linguistic weaknesses—such as verb tense understanding—that standard AdvT would leave obscured.

Conclusion

iAdvT-Text proves that interpretability in adversarial training is not only possible but can be achieved without sacrificing performance. By forcing the adversary to "speak" in the language of the vocabulary, the resulting regularization becomes more semantically grounded. While the method depends on the quality of pre-trained embeddings and carries some additional computational cost, its ability to generate human-readable diagnostics makes it a significant step toward more transparent and robust NLP models.

Summary updated

BibTeX
@inproceedings{sato2018interpretable,
  author = {Motoki Sato and Jun Suzuki and Hiroyuki Shindo and Yuji Matsumoto},
  title = {{Interpretable Adversarial Perturbation in Input Embedding Space for Text}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/601},
}
Figure