Abstract
Standard Neural Machine Translation (NMT) models often process sentences in isolation, leading to a lack of document-level coherence and consistency. This paper proposes a novel architecture that integrates a Contextual Associated Memory Network (CAMN) with the Transformer model. By utilizing inter-sentence attention to query previous sentences as a memory source, the model can selectively attend to relevant contextual clues. Experimental results on multiple language pairs and domains demonstrate that the proposed model significantly outperforms standard Transformer baselines and existing document-level NMT approaches.
The Challenge of Isolated Sentences
Most NMT models operate on a "sentence-by-sentence" basis. While this works for short, simple text, it fails at the document level. When a model ignores the surrounding context, it struggles with:
- Consistency: Using different terms for the same entity across a document.
- Disambiguation: Choosing the wrong meaning for a word with multiple senses (polysemy) because the clue was in the previous sentence.
- Coherence: Failing to maintain correct pronouns or verb tenses that depend on earlier statements.
While previous research attempted to add context via "gates" or simple concatenation, these methods often struggled to identify which part of the context was actually relevant to the current word being translated.
Methods: Contextual Associated Memory Network
The authors propose a hybrid architecture that combines the Transformer model with a Contextual Associated Memory Network (CAMN). The core innovation lies in how context is stored and retrieved:
- Contextual Memory: Instead of just feeding the previous sentence into the encoder, they use an RNN to summarize the context sentences into a sequence of hidden states. This acts as the "RAM" for the model.
- Inter-Sentence Attention: The model uses a multi-head attention mechanism to compare the current source sentence against the context memory. It calculates a similarity matrix ($M^{raw}$) to determine which words in the past are most related to the words currently being processed.
- Context Gating: Not all words need context. The model uses a "gate" (a sigmoid-based neural layer) to dynamically decide the ratio of information to take from the current source sentence versus the retrieved contextual information.
- Integration: This refined, context-aware representation is then fed into the standard Transformer encoder-decoder stack.
Experimental Setup
The model was evaluated on two language pairs—Chinese-to-English (Zh-En) and Spanish-to-English (Es-En)—across three distinct domains:
- TED Talks: Small-to-medium datasets (IWSLT 2015/2014) where discourse flow is critical.
- Subtitles: A massive dataset (OpenSubtitles2018) characterized by informal dialogue and heavy reliance on previous turns.
- News: The News-Commentary11 corpus (WMT), which features formal, document-level structures.
Key Results
The proposed model consistently outperformed strong baselines, including the standard Transformer and other state-of-the-art document-level models like the Hierarchical Attention Network (HAN):
As shown in the table above, the model achieved significant gains:
- TED Talks (Zh-En): Achieved a BLEU score of 18.69, an improvement of +0.93 over the baseline Transformer.
- Subtitles (Es-En): Reached 40.74 BLEU, outperforming the baseline by +0.78.
- News (Es-En): Reached 24.40 BLEU, a gain of +0.69.
Qualitatively, the model demonstrated superior performance in maintaining discourse coherence. For instance, it correctly identified speaker gender and question-answer relationships by "looking back" at previous sentences, whereas baseline models often produced generic or incorrect tenses.
Insights and Future Directions
- Selective Memory: The authors found that using just the one previous sentence ($N=1$) as context often yielded better results than using the previous five. This suggests that while context is vital, too much "noise" from distant sentences can confuse the model.
- Complementary Components: Ablation studies revealed that the RNN context encoder and the inter-sentence attention module are both necessary. Removing either one led to a significant drop in BLEU scores, proving that simply having context isn't enough; you need a sophisticated way to query it.
- Limitations: Attending to a large memory of sentences is computationally expensive. Furthermore, while the model handles local context well, it doesn't yet explicitly model high-level discourse relations like contrast or causality.
- Future Work: The authors plan to explore parallel multiple context attention and integrating more explicit discourse-level features to handle noise in longer documents.
Summary updated