Training Neural Machine Translation using Word Embedding-based Loss

Katsuki Chousa, Katsuhito Sudoh, Satoshi NakamuraarXiv 2018

TL;DR

Standard Neural Machine Translation (NMT) models often fail when encountering rare words, defaulting to a useless <unk> token. This paper introduces a novel loss function based on word embedding distances that encourages the model to predict semantically similar synonyms when the exact target word is missing from its vocabulary. By penalizing predictions based on their distance in a vector space rather than just a binary "right or wrong," the researchers achieved significant gains in translation quality, particularly in resource-constrained scenarios.

What Problem Does This Paper Address?

NMT models face a harsh trade-off: a large target vocabulary makes the output layer computationally expensive, but a small vocabulary leads to a high rate of out-of-vocabulary (OOV) words. When a model encounters an OOV word, it typically outputs a generic <unk> (unknown) token, which destroys the meaning of the translated sentence.

The root of this problem lies in the standard softmax cross-entropy loss. This loss function treats all incorrect words as equally wrong. If the target word is "statesman," the model is penalized just as heavily for guessing "politician" (a near-synonym) as it is for guessing "apple" (completely unrelated). This "all-or-nothing" approach prevents the model from learning semantic relationships that could provide useful "backup" translations when the exact word isn't available.

Methods

The authors propose a Word Embedding-based Loss ($\ell_{emb}$). Instead of just checking if the predicted word matches the reference, this loss calculates the weighted average of the Euclidean distances between the reference word's embedding and all other words in the vocabulary.

  • Semantic Awareness: The weights for these distances are determined by the model's output probabilities. This explicitly penalizes the model for giving high probability to words that are semantically far from the reference in the embedding space.
  • Training Strategies: The researchers found that training with $\ell_{emb}$ alone from scratch was unstable. The most effective strategy was pre-training the model with standard cross-entropy loss and then fine-tuning it using the embedding-based loss.
  • Architecture: They used a standard bi-directional encoder-decoder model with global dot attention, implemented using the primitiv toolkit.

Datasets

The method was evaluated on two distinct translation tasks:

  1. ASPEC (Asian Scientific Paper Excerpt Corpus): A mid-scale Japanese-to-English dataset.
  2. IWSLT17: A smaller-scale English-to-French dataset.

For the semantic space, they utilized pre-trained word embeddings: word2vec trained on Google News for English and Wikipedia for French.

Key Insights and Ideas

  • Softening the Penalty: By using embedding distance, the model learns that "close enough" is better than "completely wrong." This is particularly powerful for low-frequency words that might be excluded from a small vocabulary.
  • Graceful Degradation: When the model cannot produce the exact word (e.g., "statesman"), the embedding loss guides it toward an in-vocabulary synonym (e.g., "politician"). As shown in Figure 1, this preserves the "outline" and meaning of the sentence even when the vocabulary is limited.
Example of the proposed method generating a synonym instead of an OOV token.
  • Vocabulary Robustness: The method is remarkably robust. Even when the target vocabulary was slashed to just 1,000 words, the model maintained reasonable performance by leveraging synonyms.

Key Results

The proposed method consistently outperformed the baseline across different vocabulary sizes and language pairs.

  • ASPEC (Ja-En): With a 10,000-word vocabulary, the model achieved a +1.07 BLEU gain. When the vocabulary was restricted to only 1,000 words, it showed a substantial +1.72 METEOR improvement.
  • IWSLT17 (En-Fr): The gains were even more pronounced here, reaching up to +1.72 BLEU and +1.99 METEOR.

The researchers highlighted that METEOR scores often showed higher gains than BLEU because METEOR is specifically designed to account for synonyms, which is exactly where this method excels. Qualitative examples (Figure 6) show the model successfully replacing OOV words like "eyeball" with "eye."

Qualitative example showing the model replacing the OOV word 'eyeball' with 'eye'.

Limitations and Future Work

  • Computational Overhead: Calculating the distance between the reference and every single word in the vocabulary for every training step is computationally heavy. The authors suggest that finding more efficient ways to calculate this loss is a priority for future work.
  • Embedding Dependency: The quality of the translation is tied to the quality of the pre-trained embeddings. The authors plan to experiment with different types of embeddings beyond word2vec, such as GloVe or FastText.
  • Subjective Evaluation: While BLEU and METEOR are standard, they don't always capture human readability perfectly. The authors note that subjective human evaluation would provide a deeper understanding of how these semantic "backups" impact user experience.

Summary updated

BibTeX
@misc{chousa2018training,
  author = {Katsuki Chousa and Katsuhito Sudoh and Satoshi Nakamura},
  title = {{Training Neural Machine Translation using Word Embedding-based Loss}},
  year = {2018},
  eprint = {1807.11219},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1807.11219},
}
Figure