Rethinking Targeted Adversarial Attacks For Neural Machine Translation

Junjie Wu, Lemao Liu, Wei Bi, Dit-Yan Yeung

Abstract

Targeted adversarial attacks are widely used to evaluate the robustness of neural machine translation (NMT) systems. Unfortunately, this paper first identifies a critical issue in the existing settings of NMT targeted adversarial attacks, where their attacking results are largely overestimated. To this end, this paper presents a new setting for NMT targeted adversarial attacks that could lead to reliable attacking results. Under the new setting, it then proposes a Targeted Word Gradient adversarial Attack (TWGA) method to craft adversarial examples. Experimental results demonstrate that our proposed setting could provide faithful attacking results for targeted adversarial attacks on NMT systems, and the proposed TWGA method can effectively attack such victim NMT systems. In-depth analyses on a large-scale dataset further illustrate some valuable findings.

Introduction

Adversarial attacks involve making tiny, imperceptible changes to an input to trick an AI into making a mistake. In Neural Machine Translation (NMT), a targeted attack aims to force the model into a specific failure mode: either including a specific incorrect word in the output (Setting 1) or omitting a specific correct word that should be there (Setting 2).

The "Invalidity" Trap in NMT Attacks

The authors identify a major flaw in how these attacks are currently evaluated. Most existing methods operate under a "label-preserving assumption"—the idea that the meaning of the sentence should not change. However, many current attacks "succeed" simply by deleting or changing the source word they want to disappear from the translation.

An example of Setting 1 (targeted insertion) where the source word "working" is directly modified to "sleeping" to force the target word "睡觉" into the output.

For example, if an attack aims to make the word "working" disappear from the translation (Setting 2) and does so by deleting "working" from the English source sentence, the NMT model isn't actually failing—it is correctly translating a modified sentence. The paper argues that these are invalid adversarial examples. To be a true attack, the target word must remain in the source, and the model must be tricked into omitting it by changing other words in the sentence.

A New Setting for Reliable Evaluation

To address this, the authors propose a more rigorous attack setting and a corresponding method called Targeted Word Gradient adversarial Attack (TWGA).

The proposed New Setting for Setting 2 (omission), where the target word "working" is preserved in the source, and the attack instead targets other tokens like "Louis".

The New Setting Constraints:

  1. Constraint: Only non-targeted tokens in the source sentence can be modified.
  2. Dictionary Check: To ensure a word truly "disappears," the attack must ensure that none of the possible translations of that word (found via a bilingual dictionary) appear in the output. This is crucial because a single word like "working" can be translated into Chinese in many ways (e.g., 工作, 运行, 作用).
  3. Fluency: The resulting adversarial sentence must remain fluent and meaningful.

The TWGA Algorithm

TWGA is a white-box gradient-based attack designed to find successful perturbations efficiently:

  • Differentiable Search: Since selecting discrete words is difficult for gradient-based optimizers, TWGA uses the Gumbel-softmax trick to create a differentiable approximation of word selection.
  • Margin Loss: It employs a specific loss function ($L_{mar}$) that pushes the logit scores of the target word's translations below the scores of other potential words.
  • Fluency Regularization: To keep sentences readable, the method incorporates a loss from pre-trained GPT-2 models to ensure the adversarial input remains high-probability, fluent English.

Experimental Results

The authors tested TWGA against several baselines (like Seq2sick and WTextFooler) on both LSTM and Transformer-based NMT models using the WMT20 En-Zh benchmark and a new 30k-sentence dataset called Para.

  • Higher Success Rates: Under the new, stricter rules, TWGA achieved a success rate of 82.82% on LSTM and 72.91% on Transformers, significantly outperforming baselines which struggled to reach 50-60%.
  • Better Fluency: Human evaluations showed that 94% of TWGA-generated examples were "mediocre" to "meaningful," with 34% rated as fully "meaningful."
  • Scalability: The method remained effective on the large-scale "Para" dataset, proving its robustness across diverse inputs.

Conclusion

This research highlights a critical oversight in NMT robustness evaluation. By introducing a stricter setting that prevents "cheating" via target word modification and providing the TWGA method, the authors offer a more faithful way to measure and improve the security of translation systems. Future work may explore the transferability of these attacks to black-box systems and their effectiveness across more diverse language pairs.

Summary updated

Abstract

Targeted adversarial attacks are widely used to evaluate the robustness of neural machine translation systems. Unfortunately, this paper first identifies a critical issue in the existing settings of NMT targeted adversarial attacks, where their attacking results are largely overestimated. To this end, this paper presents a new setting for NMT targeted adversarial attacks that could lead to reliable attacking results. Under the new setting, it then proposes a Targeted Word Gradient adversarial Attack (TWGA) method to craft adversarial examples. Experimental results demonstrate that our proposed setting could provide faithful attacking results for targeted adversarial attacks on NMT systems, and the proposed TWGA method can effectively attack such victim NMT systems. In-depth analyses on a large-scale dataset further illustrate some valuable findings. 1 Our code and data are available at https://github.com/wujunjie1998/TWGA.
BibTeX
@inproceedings{wu2024rethinking,
  author = {Junjie Wu and Lemao Liu and Wei Bi and Dit-Yan Yeung},
  title = {{Rethinking Targeted Adversarial Attacks For Neural Machine Translation}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2024},
  doi = {10.1109/icassp48485.2024.10447368},
}
Figure