Syntax-Directed Attention for Neural Machine Translation

Kehai Chen, Rui Wang, Masao Utiyama, Eiichiro Sumita, Tiejun Zhao

Abstract

Traditional Neural Machine Translation (NMT) models rely on attention mechanisms that either consider the entire source sentence (Global Attention) or a fixed linear window (Local Attention). However, these approaches often fail to capture the hierarchical nature of language, where syntactically related words may be physically distant. This paper introduces Syntax-Directed Attention (SDAtt), which constrains attention based on distances in a dependency tree rather than linear position. We further propose a Double Context mechanism that integrates both global and syntax-directed information. Experimental results on Chinese-English and English-German tasks demonstrate significant improvements in translation quality, particularly for long and complex sentences.

Introduction

Neural Machine Translation has seen rapid advancement through the use of attention mechanisms. Global attention allows the decoder to attend to all source words, but it can be computationally expensive and prone to noise in long sentences. Local attention mitigates this by focusing on a linear window around a predicted alignment point. However, linear windows ignore the structural dependencies inherent in human language. For instance, a verb and its object might be separated by several modifiers, placing them outside a standard local window despite their strong semantic link.

Methodology

Syntax-Directed Attention (SDAtt)

The core innovation of this work is the Syntax Distance Constraint (SDC). By parsing the source sentence into a dependency tree, we define the distance between two words as the number of edges connecting them in the tree. SDAtt applies a Gaussian distribution to attention weights based on this syntactic distance, effectively focusing the model on structurally relevant neighbors. Through empirical testing, the authors found that a syntax distance of 4 (considering words within 4 "hops" in the tree) was the optimal window size, mirroring how n-gram models capture local context but applying it to tree depth.

Double Context Mechanism

To balance structural focus with broader sentence context, the authors designed a "Double Context" architecture. This model generates two distinct context vectors:

  1. Global Context Vector ($c^g$): Derived from standard attention over the entire source sequence.
  2. Syntax-Directed Context Vector ($c^s$): Derived from the SDAtt mechanism.

These vectors are concatenated and fed into the decoder to predict the target word. This approach ensures the model retains a "big picture" view while being anchored by syntactic structure.

The Double Context architecture integrates global and syntax-directed attention to inform the decoder.

Experimental Results

The proposed models were evaluated on Chinese-to-English (ZH-EN) and English-to-German (EN-DE) translation tasks using LDC and WMT’14 datasets, respectively. The Stanford parser was utilized to generate the necessary dependency trees.

Translation Performance

In the ZH-EN task, the SDAtt model achieved a BLEU score of 34.55, outperforming the Global Attention baseline of 33.23. The integrated Double Context model (+SDAtt) further improved performance to 35.60 BLEU. Similar gains were observed in the EN-DE task, where the SDAtt model reached 21.21 BLEU compared to the 19.56 baseline.

Impact of Sentence Length

A key finding is the robustness of syntax-directed models as sentence length increases. While standard NMT models typically suffer a performance degradation on sentences exceeding 50 words, the SDAtt-enhanced models maintain higher BLEU scores by effectively navigating complex hierarchical structures.

Comparison of BLEU scores across different sentence lengths, showing the superiority of SDAtt (+SDAtt) especially in longer sequences.

Conclusion

Syntax-Directed Attention provides a more linguistically motivated approach to NMT by leveraging structural proximity. By combining this with global context, the proposed models achieve significant improvements and show particular strength in translating long, complex sentences. Future work will explore the use of dependency labels and applying similar structural constraints to the target-side generation process.

Summary updated

BibTeX
@inproceedings{chen2018syntax,
  author = {Kehai Chen and Rui Wang and Masao Utiyama and Eiichiro Sumita and Tiejun Zhao},
  title = {{Syntax-Directed Attention for Neural Machine Translation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.1609/aaai.v32i1.11910},
}
Figure