Abstract
Standard Neural Machine Translation (NMT) models typically compress training data into fixed mathematical weights, losing access to specific examples at inference time. This paper introduces Search Engine Guided NMT (SEG-NMT), a framework that retrieves similar translation pairs from a corpus at test time to guide the translation process. By integrating these retrieved pairs into the NMT's attention mechanism via a key-value memory and a learned gating mechanism, the model achieves significant performance gains, particularly in specialized domains.
Introduction
Most NMT models suffer from a form of "amnesia." During training, they process millions of sentence pairs, but once training is complete, the original data is discarded. In contrast, professional human translators often utilize Translation Memory (TM) systems—databases of previously translated segments—to ensure consistency and accuracy. SEG-NMT bridges this gap by allowing neural models to "look back" at their training data or any external translation memory during the actual translation process.
The Problem: Parametric Limitations
Standard NMT models are purely parametric, meaning all their knowledge is stored in fixed parameters. This architecture leads to several challenges:
- Consistency: Difficulty maintaining uniform terminology across a document.
- Rare Words: Forgetting the translation of specific terms seen infrequently during training.
- Domain Adaptation: Struggling to adapt to new styles or datasets without extensive retraining.
The challenge lies in scale: a system must efficiently find and utilize only the most relevant "reminders" from millions of potential examples at runtime.
Methodology
The SEG-NMT framework operates in two distinct stages: retrieval and translation.
1. The Retrieval Stage
When presented with a source sentence, the system queries an off-the-shelf search engine (Apache Lucene) indexed with the training corpus. Lucene identifies a candidate set of pairs, which are then re-ranked using a fuzzy matching score based on edit distance. The top $K$ pairs are selected to guide the translation.
2. The Translation Stage
The model encodes the retrieved pairs into a Key-Value Memory. The "Keys" represent context vectors for the retrieved words, while the "Values" represent the corresponding target words and decoder hidden states. A learned gating variable ($\zeta_t$) dynamically decides at each time step whether to rely on the model's internal knowledge or to adapt information from the retrieved memory.
Experimental Results
The authors evaluated SEG-NMT on the JRC-Acquis corpus, consisting of European Union legal documents. This domain is highly structured and repetitive, providing an ideal test case for retrieval-based systems.
SEG-NMT significantly outperformed standard attention-based NMT across multiple language pairs. For English-French (En-Fr) translation, the model improved the BLEU score from 59.42 to 64.60. A critical insight from the results was the direct correlation between the quality of the retrieved matches and the performance gain: higher fuzzy matching scores led to more substantial improvements in translation quality.
Furthermore, the authors found that performance typically peaks when retrieving approximately 4 relevant pairs. Including too many less-relevant pairs can introduce noise that slightly degrades the model's output.
Conclusion and Future Work
SEG-NMT demonstrates that augmenting neural models with external search capabilities can overcome the inherent limitations of purely parametric systems. While the current implementation adds some computational latency during inference, it offers a powerful path forward for domain-specific translation tasks. Future research may explore "query reformulation," where the NMT model learns to generate its own optimized search queries to find even more relevant matches in the training data.
Summary updated