A Classification-Guided Approach for Adversarial Attacks against Neural Machine Translation

Sahar Sadrizadeh, Ljiljana Dolamic, Pascal Frossard

TL;DR

Existing adversarial attacks on Neural Machine Translation (NMT) typically measure success by dropping BLEU scores or injecting isolated trigger words, which often leaves the overarching meaning intact. This paper introduces ACT (Altering Class of Translation), a classification-guided black-box attack framework that crafts meaning-preserving source perturbations specifically designed to flip the high-level semantic category (e.g., sentiment or topic) of the resulting translation.

What Problem Does This Paper Address?

Adversarial research in NMT has largely focused on two paradigms: untargeted attacks that degrade output quality metrics, and targeted attacks that force specific keywords into the translation. Both approaches have significant blind spots:

  1. A drop in BLEU or edit-distance does not necessarily mean the overall gist or downstream utility of the sentence changed.
  2. In real-world applications (such as automated sentiment analysis or content moderation of translated text), users care about the categorical meaning rather than exact word-for-word reproduction.

A central technical challenge in guiding an NMT attack with an external classifier is attribution: an attacker must ensure that the adversarial sentence forces the NMT model to output an incorrect translation, rather than merely exploiting blind spots in the classifier itself.

Methods

ACT operates in a black-box setting against both the target NMT model ($T$) and an auxiliary oracle classifier ($F$). Built on top of the TextAttack framework using word-replacement backbones (TextFooler and BAE), ACT introduces:

  • Dual Goal Functions: To prevent the attack from merely fooling the classifier on an accurate translation, the stopping criteria require two conditions simultaneously:
  • Translation Deviation: $\text{sim}(y, y') < thr_T$, forcing the adversarial translation $y'$ to drift significantly from the original translation $y$ (measured by SacreBLEU or BLEURT-20).
  • Classification Confidence: $\max_{i \ne z} w'_i - w'_z > thr_F$, ensuring the classifier logits ($w'$) flip from the ground-truth class $z$ by a specified confidence margin.
  • NMT-Aware Token Importance Ranking: Standard attacks rank token importance purely using classification logits. ACT incorporates translation shift directly into the scoring function: $$S(x') = w'_z + \alpha \cdot \text{sim}(y, y')$$ This prioritizes replacing words that destabilize both the translation output and the downstream class.

Datasets

Because evaluation requires ground-truth labels for sentence meaning, the authors used text classification benchmarks rather than standard parallel translation corpora:

  • SST-2 and MR: Sentence-level binary sentiment classification on movie reviews.
  • AG's News: Four-class topic classification (World, Sports, Business, Sci/Tech).
  • WMT14 (En-Fr, En-De): Used as reference benchmarks to verify the clean baseline translation quality of the target models (Marian NMT and multilingual mBART50).

Classifiers (fine-tuned GPT-2 and BERT architectures) were trained on translations of the training sets; one classifier guided the attack while a distinct, held-out model was used for final evaluation.

Key Insights and Ideas

  • Degrading translation quality rarely alters the underlying category: Traditional untargeted attacks (such as kNN, Seq2Sick, and TransFool) cause noticeable BLEU drops, but change the translation's semantic class only 2% to 15% of the time.
  • Meaning alteration requires targeted pressure: By explicitly optimizing to flip the semantic category, ACT produces translations that deviate much further from the original meaning (achieving significantly lower BLEU and chrF scores than untargeted baselines).
  • Cross-system attribution can be controlled: Enforcing a minimum translation divergence threshold ($thr_T$) effectively ensures the NMT system—not the classifier—is the primary point of failure.

Key Results

  • Attack Success Rate (ASR): Evaluated against Marian NMT (En-Fr) on SST-2, $\text{ACT}_{\text{TF}}$ achieved 40.23% ASR, compared to 8.95% for kNN, 2.14% for Seq2Sick, and 10.21% for TransFool. On German translations (En-De), $\text{ACT}_{\text{TF}}$ reached 40.84% ASR.
  • Translation Impact: On SST-2 (En-Fr), $\text{ACT}_{\text{TF}}$ reduced translation BLEU to 29.66 (compared to 44.90 for TransFool and 50.95 for kNN), proving that classification-guided attacks disrupt the translation far more aggressively.
  • Human Validation: Native/fluent French annotators evaluated 80 adversarial translations. In 71.3% of cases, annotators agreed with the flipped label predicted by the classifier, confirming that the translations genuinely carried altered human-perceived meaning rather than just model-level artifacts.
  • Transferability: Adversarial examples crafted against Marian NMT transferred moderately to mBART50 and across languages (En-Fr to En-De).

Limitations and Future Work

  • Logit Access Requirement: ACT relies on continuous output logits from the oracle classifier; it cannot currently operate in pure hard-label (decision-only) black-box settings.
  • Computational Latency: Generating perturbations takes ~15–26 seconds per sentence with BLEU scoring, and climbs to ~83 seconds per sentence if using neural metrics like BLEURT-20.
  • Multi-Class Complexity: Attack success drops noticeably on datasets with more classes (e.g., 18–28% ASR on 4-class AG's News vs. ~40% on binary SST-2).
  • Broader Task Scope: The study focused on sentiment and news topic classification; testing safety-critical domains such as hate speech or toxicity evasion remains future work.

Summary updated

Abstract

Neural Machine Translation (NMT) models have been shown to be vulnerable to adversarial attacks, wherein carefully crafted perturbations of the input can mislead the target model. In this paper, we introduce ACT, a novel adversarial attack framework against NMT systems guided by a classifier. In our attack, the adversary aims to craft meaning-preserving adversarial examples whose translations in the target language by the NMT model belong to a different class than the original translations. Unlike previous attacks, our new approach has a more substantial effect on the translation by altering the overall meaning, which then leads to a different class determined by an oracle classifier. To evaluate the robustness of NMT models to our attack, we propose enhancements to existing black-box word-replacement-based attacks by incorporating output translations of the target NMT model and the output logits of a classifier within the attack process. Extensive experiments, including a comparison with existing untargeted attacks, show that our attack is considerably more successful in altering the class of the output translation and has more effect on the translation. This new paradigm can reveal the vulnerabilities of NMT systems by focusing on the class of translation rather than the mere translation quality as studied traditionally.
BibTeX
@inproceedings{sadrizadeh2024classification,
  author = {Sahar Sadrizadeh and Ljiljana Dolamic and Pascal Frossard},
  title = {{A Classification-Guided Approach for Adversarial Attacks against Neural Machine Translation}},
  booktitle = {EACL},
  year = {2024},
  url = {https://openreview.net/forum?id=Nqc2IyiYh9},
}

Loading related content...

Figure