A Reinforced Generation of Adversarial Examples for Neural Machine Translation

Wei Zou, Shujian Huang, Jun Xie, Xinyu Dai, Jiajun Chen

Introduction

Neural Machine Translation (NMT) has become the industry standard, but it remains a "black box" that is surprisingly fragile. A single typo or a missing character can cause a state-of-the-art model to produce nonsensical or dangerously incorrect translations. For example, removing one Chinese character meaning "explosion" might cause a model to flip from translating "suicide bombing" to a sentence about "Eastern Europe."

To build more robust systems, engineers need to find these "pitfalls." However, manually collecting error cases is slow, and previous automated methods (like gradient-based searches) are computationally expensive and often produce "adversarial" sentences that lose their original meaning, making them useless for debugging real-world translation issues.

Methods

The authors propose a Reinforced Generation paradigm using an Actor-Critic framework to automate the discovery of these vulnerabilities.

The proposed framework consists of an Actor-Critic agent interacting with an environment that includes a discriminator and the victim NMT model.

The Agent and Environment

  1. The Agent: Consists of an Actor (which decides which word to perturb and what to replace it with) and a Critic (which estimates the potential "reward" or success of an attack).
  2. The Environment: Includes the "victim" NMT model and a Discriminator.
  3. The Reward Function: The agent receives a reward based on two criteria:
  4. Semantic Preservation: The Discriminator checks if the perturbed sentence still carries the same meaning as the original. If it doesn't, the "attack" is terminated.
  5. System Degradation: If the agent successfully fools the NMT model into producing a significantly worse translation (measured by a drop in BLEU score), it receives a high reward.

Datasets and Evaluation

The researchers evaluated their method across three major translation tasks: Chinese→English (Zh→En), English→German (En→De), and English→French (En→Fr). They tested these attacks against two mainstream architectures: RNN-search and the Transformer.

Key Insights and Results

Efficiency and Speed

Traditional gradient-based search methods are computationally formidable because they require calculating gradients for every possible token modification. The RL approach is roughly 100 to 200 times faster during inference because the agent learns a direct policy for where to attack.

Comparison of inference time (in seconds) between the proposed RL method and gradient-based search (GS) baselines.

As shown in the figure above, the RL method processed 800 inputs in about 300 seconds, while the gradient-based baseline took over 56,000 seconds (nearly 16 hours) on the same hardware.

Meaning Preservation and Vulnerabilities

By using a discriminator as a "semantic police," the authors ensured their adversarial examples had high Human Evaluation (HE) scores (averaging >3.7 out of 5). The RL agent naturally learned to target specific Parts-of-Speech (POS) that NMT models struggle with, such as organization names (Ni), person names (Nh), and numbers (M). Interestingly, it also found that suffixes (K) are a hidden vulnerability often overlooked by humans.

Robustness Tuning

The authors demonstrated that by fine-tuning the original NMT model on these adversarial examples, they could improve the model's robustness to noisy input by nearly 5 BLEU points with almost no loss in performance on "clean" text.

Limitations and Future Work

While inference is fast, the initial training of the RL agent is time-consuming, taking about 30 hours on a high-end GPU. The authors also noted the existence of "reinforced samples"—rare cases where a minor perturbation actually improved translation quality—suggesting a promising path for future research into automated NMT improvement.

Summary updated

BibTeX
@inproceedings{zou2020reinforced,
  author = {Wei Zou and Shujian Huang and Jun Xie and Xinyu Dai and Jiajun Chen},
  title = {{A Reinforced Generation of Adversarial Examples for Neural Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.319},
}
Figure