Introduction
Neural Machine Translation (NMT) has significantly advanced the field of automated translation, yet it often operates as a "black box," making it difficult for users to enforce specific terminology. This paper introduces a novel approach to integrate user-provided constraints into the NMT decoding process without compromising translation speed or quality. By combining Finite-State Machines with the model's internal attention mechanism, the researchers ensure that required terms are placed correctly while eliminating common errors like "hallucination" or word duplication.
The Challenge: Black-Box Translation and Duplication
For corporate and technical users, consistency is paramount. Brand names, legal terms, and technical jargon must be translated exactly as specified. Standard NMT models frequently ignore these constraints or place them in grammatically incorrect positions. Previous solutions, such as "Grid Beam Search," were computationally expensive and often suffered from "output duplication." This occurs when a model translates a word once to satisfy a constraint but, because the underlying model still perceives the source word as "uncovered," translates it again in the same sentence.
Methodology: FSAs and Attention-Based Masking
The proposed framework relies on two core innovations to manage constraints effectively:
- Finite-State Acceptors (FSAs): The system constructs an FSA to map all allowed permutations of constraints, including multi-word phrases and alternative synonyms. This allows the decoder to track which constraints have been met and which are still pending.
- Multi-Stack Decoding with Attention: Unlike rigid constraint injection, this system utilizes the NMT’s attention weights:
- Placement: A constraint is only triggered when the model shows strong attention toward the corresponding span in the source sentence, ensuring proper grammatical context.
- Masking (Coverage): Once a term is generated, the system manually zeros out (masks) the attention on that source span. This signals to the model that the source content has been fully processed, preventing the repetition errors seen in earlier methods.
Experimental Setup
The researchers evaluated the approach using the WMT17 datasets for two major language pairs: English-German and English-Chinese. They tested two scenarios:
- Gold Constraints: Terms extracted from reference translations that the baseline system originally missed.
- Dictionary Constraints: Automatically extracted bilingual entries designed to simulate a real-world corporate glossary.
Results: Quality, Speed, and Reduced Repetition
The experimental results demonstrated significant improvements across all metrics. For English-German translation, the addition of just two "gold" tokens boosted the BLEU score from 24.9 to 29.2.
Key findings include:
- Reduced Repetition: The "rep" metric (measuring repeated 7-grams) dropped significantly due to the attention-masking technique, confirming that the system successfully suppressed over-generation.
- Efficiency: The optimized decoding configuration was 3.5x to 5x faster than previous state-of-the-art constrained decoding methods, making it viable for real-time production environments.
- Attention as Alignment: The study confirms that NMT attention weights are reliable enough to serve as triggers for terminology injection, bridging the gap between rule-based constraints and neural fluidity.
Conclusion and Future Directions
While highly effective, the method's success depends on the quality of the correspondence between target constraints and source spans. In morphologically rich languages like German, strict constraints can occasionally struggle with case endings or articles not included in the constraint itself. Future work involves adapting this strategy for the Transformer architecture, which utilizes multi-head attention and requires more sophisticated masking strategies to maintain constraint integrity.
Summary updated