Categorizing Semantic Representations for Neural Machine Translation

Yongjing Yin, Yafu Li, Fandong Meng, Jie Zhou, Yue Zhang

Introduction

Neural Machine Translation (NMT) has achieved remarkable success on standard benchmarks, yet it remains brittle when faced with the challenge of compositional generalization. This refers to the model's ability to understand and produce novel combinations of known words—"atoms"—based on learned "patterns." For instance, an NMT model trained on "small chair" and "large car" may fail to correctly translate "large chair" if that specific combination was absent from the training set. This failure stems from the model's tendency to overfit to specific training sequences, struggling to decouple individual word meanings from their immediate contexts in a sparse input space.

The Proto-Transformer Framework

To address this, we introduce the Proto-Transformer, a framework designed to reduce representation sparsity by clustering contextualized word representations into stable "prototypes." The training process follows a two-stage approach:

  1. Categorization (Warm-up): A standard Transformer is trained for a limited number of epochs. The entire training corpus is then passed through this model to extract contextualized representations for every token.
  2. Prototyping: For each word in the vocabulary, these representations are clustered using K-Means into $k$ representative prototypes. These prototypes serve as global semantic anchors, capturing the diverse yet distinct ways a word is utilized across the corpus.

Architecture

The standard Transformer encoder is augmented with a Prototype-Attention module. During the encoding process, each token performs self-attention with its neighbors and simultaneously attends to its corresponding global prototypes retrieved from a lookup table. This mechanism allows the model to refine local, context-heavy representations with generalized semantic information, acting as a powerful regularizer.

The Proto-Transformer architecture integrates a Token-Prototype Lookup Table and a Prototype-Attention layer into the standard encoder.

Experimental Evaluation

We evaluated the Proto-Transformer on two primary fronts:

  • CoGnition Benchmark: A specialized dataset for English-to-Chinese translation designed to test compositional generalization via novel compounds.
  • General MT Benchmarks: Ten diverse tasks including IWSLT (En-De, En-It, En-Vi), WMT (En-Ro, Ro-En, En-Fi, En-De), and JRC-Acquis (En-Es, Es-En) to ensure the method maintains broad utility.

Results and Analysis

The Proto-Transformer demonstrated a significant improvement in handling novel linguistic structures. On the CoGnition dataset, it reduced the instance-level Compound Translation Error Rate (CTER) from 28.42% to 21.69%, representing a 24% relative error reduction. Furthermore, the model achieved an average BLEU score increase of 0.67 across the ten general MT tasks.

Analysis reveals that the Proto-Transformer's strength grows with the complexity of the input. As the length of the compound or the surrounding context increases, the performance gap between the Proto-Transformer and the baseline widens, suggesting that global prototypes provide a necessary "sanity check" when local context becomes ambiguous or confusing.

CTER (Error Rate) comparison shows that Proto-Transformer scales much better than the baseline as compound and context length increase.

Discussion

A key finding of this work is the "Early Bird" advantage: prototypes extracted from a model early in its training lead to better generalization than those from a fully converged model. This suggests that neural networks capture generalizable semantic features before they begin to memorize the specific noise and sequence patterns of the training data.

While the method introduces a small computational overhead (approximately 6M additional parameters and a two-stage training pass), the gains in stability and generalization are substantial. Future work will explore the application of prototypes to the decoder side and more sophisticated methods for linking source prototypes to target-side generation.

Summary updated

BibTeX
@inproceedings{yin2022categorizing,
  author = {Yongjing Yin and Yafu Li and Fandong Meng and Jie Zhou and Yue Zhang},
  title = {{Categorizing Semantic Representations for Neural Machine Translation}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=ULMdvE52lx},
}
Figure