Abstract
Standard Neural Machine Translation (NMT) models typically operate under the "independence assumption," translating sentences in isolation and often failing to maintain document-level consistency and coherence. This paper introduces a Document-Aware Memory Network designed to enhance the Transformer architecture by explicitly modeling and retrieving relevant document-level context. By treating previous sentences as a "memory" and employing an inter-sentence attention mechanism coupled with a gating strategy, the model significantly improves translation quality. Evaluations across multiple language pairs and domains, including TED Talks and News, demonstrate that the proposed approach consistently outperforms strong Transformer baselines in terms of BLEU scores and lexical consistency.
Introduction
While NMT has seen significant success, its reliance on sentence-level translation leads to several challenges when processing entire documents. Specifically, models often struggle with:
- Consistency: Maintaining uniform terminology for entities throughout a text.
- Disambiguation: Selecting the correct sense of polysemous words based on surrounding context.
- Coherence: Preserving logical flow and discourse relations between sentences.
Existing methods for incorporating global context often lack a precise mechanism to select the most relevant information for the current sentence. This work addresses these limitations by proposing an Associated Memory Network that performs a targeted search over contextual memory.
Methods
The proposed architecture integrates an Associated Memory Network into the standard Transformer framework. The process involves four primary stages:
- Context Selection: A fixed window of previous sentences (e.g., $m=3$) is selected to form the contextual memory.
- Inter-Sentence Attention: The current source sentence acts as a query to search the contextual memory. A similarity matrix is calculated to identify relevant words or phrases within the context.
- Embedding Merging: Contextual clues are combined using a Contextual RNN, which summarizes cross-sentence information into a unified representation.
- Context Gating: A gating mechanism dynamically balances the influence of the original source representation ($H_{source}$) and the retrieved contextual information ($H_{context}$), preventing the model from being distracted by irrelevant context.
Experimental Setup
The model was evaluated on three distinct domains across several language pairs:
- TED Talks: Zh-En, Es-En, Fr-En, and En-Ja.
- Subtitles: Spanish-English (Es-En) from OpenSubtitles2018.
- News: Spanish-English (Es-En) from WMT datasets.
Key Results
The proposed model consistently achieved state-of-the-art performance, outperforming both the standard Transformer and other document-level models like the Hierarchical Attention Network (HAN).
As shown in the results table, the model achieved a BLEU score improvement of +0.93 on Zh-En TED Talks and +0.78 on Es-En Subtitles over the baseline Transformer. Qualitative analysis further confirmed the model's superior disambiguation capabilities; for instance, correctly translating the word "figure" as "person" (人物) rather than "number" (数字) by successfully attending to relevant cues in the preceding context.
Discussion and Conclusion
The success of the Associated Memory Network highlights the importance of targeted contextual relevance. The gating mechanism is crucial for maintaining a high signal-to-noise ratio, ensuring context is only utilized when beneficial. However, these improvements come with an increased computational cost, with training times approximately 50% longer than the baseline (e.g., 42.32 hours vs. 28.59 hours for the News dataset). Future work will explore dynamic context windows and the incorporation of future context to further enhance document-level coherence.
Summary updated