Abstract
In this paper, we extend an attention-based neural machine translation (NMT) model by allowing it to access an entire training set of parallel sentence pairs even after training. The proposed approach consists of two stages. In the first stage—the retrieval stage—an off-the-shelf, black-box search engine is used to retrieve a small subset of sentence pairs from a training set given a source sentence. These pairs are further filtered based on a fuzzy matching score based on edit distance. In the second stage—the translation stage—a novel translation model, called translation memory enhanced NMT (TM-NMT), seamlessly uses both the source sentence and a set of retrieved sentence pairs to perform the translation. Empirical evaluation on three language pairs (En-Fr, En-De, and En-Es) shows that the proposed approach significantly outperforms the baseline approach, and the improvement is more significant when more relevant sentence pairs were retrieved.
Introduction
Standard Neural Machine Translation (NMT) models typically operate by compressing massive parallel corpora into fixed neural network weights. Once training is finalized, the original dataset is discarded, and the model relies solely on its internal parameters to generate translations. This "parametric" approach often struggles with stylistic consistency, rare terminology, and domain-specific phrasing.
In contrast, professional human translators frequently utilize "Translation Memory" (TM) systems—databases of previously translated segments—to ensure consistency and efficiency. This paper introduces Search Engine Guided Neural Machine Translation (SEG-NMT), a framework that bridges the gap between neural generation and explicit memory lookup. By equipping NMT models with the ability to query the entire training corpus at test time, the system can dynamically adapt to and copy from relevant past translations.
Methodology
The SEG-NMT framework operates through a two-stage, partially non-parametric process:
1. Retrieval Stage
When presented with a source sentence, the system queries an off-the-shelf search engine (such as Apache Lucene) containing the full training corpus. It retrieves a set of candidate sentence pairs, which are then re-ranked using a fuzzy matching score based on edit distance. A greedy selection algorithm is employed to identify a small subset of pairs that maximize the word coverage of the input source sentence.
2. Translation Stage
The retrieved target sentences are integrated into a Key-Value memory network. Here, "keys" represent context vectors and "values" represent the target words and their associated hidden states. As the NMT decoder generates the translation, it calculates a soft matching score against this memory.
To fuse this information, the authors implement a learned gating mechanism. This gate determines whether the model should generate a word from its standard vocabulary or "copy" a word directly from the retrieved memory. The study explored two integration methods: Deep Fusion, which blends hidden states, and Shallow Fusion, which interpolates output probability distributions. Shallow Fusion was found to be superior, as it allows the model to more effectively utilize discrete symbols from the retrieved text.
Experimental Setup
The model was evaluated using the JRC-Acquis corpus, a collection of European Union legal documents. This dataset is ideal for TM-based approaches due to its highly structured nature and repetitive terminology. Experiments were conducted across three language pairs: English-French (En-Fr), English-German (En-De), and English-Spanish (En-Es), covering both translation directions for each.
Results and Analysis
SEG-NMT demonstrated substantial improvements in translation quality over standard attention-based NMT and CopyNet baselines.
Key Insights
- Correlation with Match Quality: The effectiveness of the model is directly tied to the relevance of the retrieved pairs. As the fuzzy matching score of the retrieved sentences increases, the BLEU score improvement over the baseline grows significantly.
- Optimal Retrieval Volume: Performance typically peaks when retrieving 4 to 5 sentence pairs. Beyond this point, the inclusion of less relevant context can introduce noise that degrades translation quality.
- Dynamic Adaptation: Qualitative analysis shows the model can resolve lexical ambiguities by following the style of retrieved pairs. For instance, if a retrieved pair uses a specific synonym for a French term, the model successfully adapts its vocabulary to maintain consistency.
Conclusion
SEG-NMT provides a powerful way to leverage existing translation memories within a neural framework. While the system's performance is dependent on the quality of the search engine's matches and introduces a minor computational overhead during decoding, the gains in BLEU score—up to +5.59 points in some directions—are significant. Future work may involve moving toward neural-based semantic retrieval rather than black-box string matching to further enhance the relevance of retrieved pairs.
Summary updated