A Relaxed Optimization Approach for Adversarial Attacks Against Neural Machine Translation Models

Sahar Sadrizadeh, Clément Barbier, Ljiljana Dolamic, Pascal Frossard

TL;DR

Researchers have developed a new way to "break" Neural Machine Translation (NMT) models by treating text like a continuous optimization problem. By using a mathematical "relaxation" technique (the Gumbel-Softmax trick), they can generate adversarial sentences that look perfectly normal to humans but cause translation engines to produce gibberish or incorrect results.

What Problem Does This Paper Address?

Neural Machine Translation (NMT) models—the engines behind tools like Google Translate—are incredibly powerful but surprisingly fragile. In computer vision, "adversarial attacks" (like adding invisible noise to an image to make a model see a cat as a toaster) are well-understood because images are made of continuous pixel values that are easy to manipulate using gradients.

Text is different. It is discrete; you can’t change a word by 0.01%. You either have "cat" or "dog." This makes it hard to use standard optimization techniques to find the "perfect" perturbation. Previous attempts at text attacks usually relied on simple word-swapping heuristics or character-level flips (like "th3" instead of "the"), which are often easy for humans or spell-checkers to spot. The authors wanted a principled, optimization-based way to generate attacks that are both devastating to the model and semantically invisible to the reader.

Methods

The authors propose a Relaxed Optimization Approach. Here is the breakdown of their "secret sauce":

  1. The Objective Function: They define a dual-purpose goal: maximize the translation error (make the model fail) while minimizing the semantic difference between the original and the fake sentence (keep the meaning the same).
  2. Continuous Relaxation: Since they can't run gradients through discrete words, they use the Gumbel-Softmax trick. This allows them to represent words as probability distributions that are differentiable. Instead of picking a word, they optimize the probability of picking a word.
  3. Semantic Preservation: To ensure the attack sentence still makes sense, they use contextual embeddings from a Language Model (like GPT-2) and a metric inspired by BERTScore. This ensures that "Players" might replace "working group" only if the context allows it to remain somewhat fluent, rather than just inserting random noise.
  4. White-Box vs. Black-Box:
    • White-Box: They have full access to the target model's internal gradients.
  5. Black-Box: They optimize the attack on a "reference" model (like Marian NMT) and then "transfer" those adversarial sentences to a different target model (like mBART50) that they don't have access to.

Datasets

The researchers evaluated their attack using several standard benchmarks:

  • WMT14: The gold standard for English-to-French (En-Fr) and English-to-German (En-De) translation tasks.
  • OPUS Corpus: A collection of diverse datasets including News Commentary, MultiUN (United Nations documents), Europarl (European Parliament proceedings), and OPUS Books.
  • WikiText-103: Used specifically to train the internal Language Model that helps maintain the "fluency" of the adversarial sentences.

Key Insights and Ideas

  • Optimization over Heuristics: By moving away from simple "find-and-replace" rules and toward a mathematical optimization, the attack finds vulnerabilities that humans might not think of.
  • The Power of Sampling: Instead of generating just one adversarial sentence, their method optimizes a distribution. They can sample 100 different versions of a sentence and pick the one that breaks the NMT model the most.
  • Transferability is Real: One of the most striking insights is that an attack optimized to break a small, "lightweight" model (Marian NMT) is often just as effective at breaking a massive, state-of-the-art model (mBART50). This makes "black-box" attacks a very real threat in the wild.
  • Fluency vs. Destruction: There is a direct trade-off (controlled by a hyperparameter $\alpha$) between how much you break the model and how much the sentence changes. The authors found a "sweet spot" where the sentence remains 85% semantically similar but the translation quality drops by over 50%.

Key Results

The proposed attack significantly outperformed existing baselines like kNN and Seq2Sick:

  • Success Rate (ASR): Their attack achieved over 71% success in breaking Marian NMT models, compared to just 28-36% for baseline methods.
  • Translation Degradation: They were able to reduce BLEU scores (a measure of translation quality) by more than half while maintaining high semantic similarity (>0.85).
  • Efficiency: In black-box scenarios, their method was orders of magnitude faster than "query-based" attacks. While other methods (like WSLS) took nearly 32 minutes to generate one attack, this method took about 19 seconds.

Limitations and Future Work

  • Domain Sensitivity: The attack's ability to maintain "meaning" depends on the Language Model used. For example, when attacking the "OPUS Books" dataset, the performance dropped slightly because the Language Model (trained on Wikipedia) wasn't as familiar with literary prose.
  • Reference Model Dependency: For black-box attacks, you still need access to some NMT model to start the optimization. If the attacker’s reference model is too different from the target, the attack might be less effective.
  • Defense Gap: While the paper successfully demonstrates how to break these models, it doesn't propose a specific defense mechanism. The authors note that their work is a "prerequisite step" for building more robust systems in the future.

Summary updated

BibTeX
@inproceedings{sadrizadeh2023relaxed,
  author = {Sahar Sadrizadeh and Clément Barbier and Ljiljana Dolamic and Pascal Frossard},
  title = {{A Relaxed Optimization Approach for Adversarial Attacks Against Neural Machine Translation Models}},
  booktitle = {EUSIPCO},
  year = {2023},
  url = {https://openreview.net/forum?id=IxwGzrVYC5},
}

Loading related content...

Figure