NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Source Dependency-Aware Transformer with Supervised Self-Attention

Chengyi Wang, Shuangzhi Wu, Shujie LiuarXiv 2019

Abstract

While the Transformer architecture has set new benchmarks in Neural Machine Translation (NMT), it remains largely "syntax-blind," relying on implicit patterns rather than explicit grammatical structures. This paper introduces a novel approach to incorporate source-language dependency structures by supervising specific attention heads during training. By guiding these heads to recognize parent-child word relationships, the model achieves significant translation improvements across multiple language pairs without adding computational overhead during inference.

The Challenge of Syntactic Hallucinations

Standard Transformers rely on multi-head self-attention to learn relationships between words. However, without an explicit mechanism to understand grammatical structure, they are prone to "syntactic hallucinations." For instance, in Chinese-to-English translation, a model might incorrectly associate a location with a subject rather than the governing verb, leading to semantically inaccurate outputs.

Figure 3: (a) An example of syntactic hallucination where the baseline Transformer incorrectly links "Hangzhou" to "musicians." (b) The corresponding source-side dependency tree.

Previous attempts to integrate syntax often involved heavy external modules like Tree-LSTMs or Graph Convolutional Networks. These methods frequently require a standalone parser during inference, which significantly slows down translation speed and complicates the deployment pipeline.

Proposed Method: Supervised Self-Attention

The authors propose a lightweight solution called Supervised Self-Attention. Instead of introducing new architectural layers, they repurpose existing attention heads in the encoder to act as latent parsers.

Architectural Integration

The core of the method involves three key components:

  1. Adjacency Matrices: Two matrices, $W^c$ (child) and $W^p$ (parent), are derived from a dependency tree of the source sentence to represent modifier-head relationships.
  2. Supervised Heads: Two specific attention heads in the top layer of the encoder are designated as the Child Supervised Attention Head (CSH) and the Parent Supervised Attention Head (PSH).
  3. Joint Objective Function: During training, the model optimizes a modified loss function that includes cross-entropy terms forcing the CSH and PSH to align their attention weights with the syntactic adjacency matrices.
Figure 5: The architecture of the Source Dependency-Aware Transformer, illustrating how specific attention heads are supervised using dependency-based adjacency matrices.

Crucially, because this syntactic knowledge is "baked" into the attention weights during training, the model does not require a parser at inference time, maintaining the original Transformer's efficiency.

Experimental Results

The researchers evaluated the model on several major benchmarks, including NIST Chinese-to-English (2.6M pairs) and WMT2014 English-to-German (4.5M pairs). Since gold-standard trees are rarely available for large-scale NMT datasets, they utilized high-quality pseudo-labels from in-house dependency parsers.

Key Performance Metrics

  • NIST Chinese-to-English: The model achieved an average BLEU score of 38.63, a significant +1.53 improvement over the baseline Transformer.
  • English-to-Japanese: BLEU scores improved from 36.24 to 37.22.
  • Large-Scale WMT: Steady gains were observed across the board, including a +0.86 BLEU gain on 9M Chinese-to-English sentence pairs.

Analysis and Insights

One of the most striking findings is the "Latent Parser" effect. By supervising just two heads, the model effectively learns to reconstruct the source syntax tree internally, achieving an Unlabeled Attachment Score (UAS) of 83.25%.

The authors also found that supervising the top layer of the encoder is most effective. They suggest that while lower layers capture local, low-level features, syntactic dependency is a high-level structural feature best processed at the end of the encoding stage.

Conclusion and Future Work

This approach demonstrates that linguistic inductive biases can be incorporated into Transformers without sacrificing speed or adding parameters. Future research may explore incorporating dependency labels (e.g., nominal subject vs. direct object) or applying similar supervision to the target-side syntax in the decoder to further enhance grammatical fluency.

Summary updated

BibTeX
@misc{wang2019source,
  author = {Chengyi Wang and Shuangzhi Wu and Shujie Liu},
  title = {{Source Dependency-Aware Transformer with Supervised Self-Attention}},
  year = {2019},
  eprint = {1909.02273},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.02273},
}
Figure