Abstract
Neural machine translation systems tend to fail on less decent inputs despite its significant efficacy, which may significantly harm the credibility of this systems-fathoming how and when neural-based systems fail in such cases is critical for industrial maintenance. Instead of collecting and analyzing bad cases using limited handcrafted error features, here we investigate this issue by generating adversarial examples via a new paradigm based on reinforcement learning. Our paradigm could expose pitfalls for a given performance metric, e.g., BLEU, and could target any given neural machine translation architecture. We conduct experiments of adversarial attacks on two mainstream neural machine translation architectures, RNN-search, and Transformer. The results show that our method efficiently produces stable attacks with meaning-preserving adversarial examples. We also present a qualitative and quantitative analysis for the preference pattern of the attack, demonstrating its capability of pitfall exposure.
Introduction
Neural Machine Translation (NMT) has achieved state-of-the-art performance across various language pairs. However, these models remain "brittle," often failing when faced with minor input perturbations such as typos or unusual word choices. Identifying these vulnerabilities typically requires expert manual analysis or computationally intensive gradient-based searches. Gradient-based methods are not only slow but also architecture-specific and prone to generating nonsensical text. This paper introduces a reinforcement learning (RL) framework designed to generate valid, discrete, and meaning-preserving adversarial examples efficiently across different NMT architectures.
Methodology
The proposed framework treats adversarial generation as a sequential decision-making process within an Actor-Critic RL architecture.
The RL Framework
- Environment: Encapsulates the "victim" NMT model and provides rewards based on the drop in translation quality (e.g., BLEU score).
- Discriminator: A semantic component trained to ensure that perturbed sentences retain the original meaning. It provides a "survival signal"; if a perturbation alters the meaning too drastically, the episode terminates.
- Agent (Actor-Critic): The Actor learns a policy to identify which tokens to perturb and selects replacements from a similarity-based candidate set. The Critic estimates expected future rewards to guide the Actor's learning.
This approach is model-agnostic, requiring only the output of the NMT system rather than internal gradients, making it highly flexible for black-box attacks.
Experimental Results
The framework was evaluated on standard benchmarks, including Chinese-English (Zh-En), English-German (En-De), and English-French (En-Fr).
Efficiency and Performance
A primary advantage of the RL-based approach is its computational efficiency. Unlike gradient-based search (GS), which requires a fresh search for every sentence, the RL agent learns a generalizable policy.
As shown in the figure above, the RL method is approximately 100 times faster than GS. For instance, processing a test set that took GS over 30,000 seconds required only ~300 seconds with the RL approach. Despite this speed, the RL-generated attacks achieved comparable or higher Relative Decrease (RD) in translation quality while maintaining superior semantic consistency, as verified by human evaluation.
Attack Preferences and Robustness
Qualitative analysis revealed that the agent naturally targets "hard" parts of speech, such as named entities and numbers. It also identified subtle linguistic pitfalls, such as specific Chinese suffixes, that are often overlooked by human researchers.
Furthermore, the generated adversarial examples can be used for "adversarial tuning." By training a standard Transformer model on these samples, the authors observed a robustness boost of +4.83 BLEU points on noisy test sets, with minimal impact on clean data performance.
Conclusion
This work demonstrates that reinforcement learning can effectively and efficiently expose vulnerabilities in NMT systems. By incorporating a semantic discriminator, the framework ensures that adversarial attacks remain meaning-preserving. The method's efficiency and model-agnostic nature make it a powerful tool for both system probing and enhancing model robustness through targeted data augmentation. Future work includes exploring non-linear modification orders and broader linguistic substitution strategies.
Summary updated