Code-Switching with Word Senses for Pretraining in Neural Machine Translation

Vivek Iyer, Edoardo Barba, Alexandra Birch, Jeff Z. Pan, Roberto Navigli

Abstract

Lexical ambiguity is a significant and pervasive challenge in Neural Machine Translation (NMT), with many state-of-the-art (SOTA) NMT systems struggling to handle polysemous words (Campolungo et al., 2022). The same holds for the NMT pretraining paradigm of denoising synthetic "code-switched" text (Pan et al., 2021; Iyer et al., 2023), where word senses are ignored in the noising stage -- leading to harmful sense biases in the pretraining data that are subsequently inherited by the resulting models. In this work, we introduce Word Sense Pretraining for Neural Machine Translation (WSP-NMT) - an end-to-end approach for pretraining multilingual NMT models leveraging word sense-specific information from Knowledge Bases. Our experiments show significant improvements in overall translation quality. Then, we show the robustness of our approach to scale to various challenging data and resource-scarce scenarios and, finally, report fine-grained accuracy improvements on the DiBiMT disambiguation benchmark. Our studies yield interesting and novel insights into the merits and challenges of integrating word sense information and structured knowledge in multilingual pretraining for NMT.

The Challenge of Lexical Ambiguity

Lexical ambiguity—where a single word like "run" can mean "compete in a race," "manage a business," or "operate a machine"—remains a significant hurdle in Neural Machine Translation (NMT). While modern Transformer models are powerful, they often default to the most frequent sense of a word, failing on rare or context-dependent meanings.

A popular pretraining strategy involves "denoising code-switched text." In this setup, a model is given a sentence where some words have been replaced by their translations in another language and is tasked with reconstructing the original. However, current methods are "sense-agnostic": they pick a translation from a dictionary at random. If the English word "edge" (meaning advantage) is replaced by the Italian "margine" (meaning border), the model learns an incorrect association, baking "sense bias" directly into the model's weights.

Example of sense-agnostic vs. sense-pivoted translation for the word "edge".

WSP-NMT: Sense-Pivoted Pretraining

To address this, the authors introduce WSP-NMT (Word Sense Pretraining for Neural Machine Translation), which moves from word-level to sense-level pretraining through a three-stage pipeline:

  1. Word Sense Disambiguation (WSD): Before noising the data, the system uses a SOTA WSD model (such as ESCHER) to identify the specific "synset" (concept) of each word in the source sentence, using BabelNet as a reference.
  2. Sense-Pivoted Code-Switching: Instead of a random dictionary lookup, the system retrieves translations specifically linked to that disambiguated synset. This ensures the "noised" word actually carries the correct meaning.
  3. Morphological Inflection: Since Knowledge Graphs usually store lemmas (dictionary forms), the authors add an optional step using a lemmatizer and hashmap lookup to ensure the translated word matches the grammatical context (e.g., tense and number) of the original sentence.
Comparison of the SOTA Aligned Augmentation (AA) vs. the proposed WSP-NMT pipeline.

The model is then trained using a joint loss function: standard Cross-Entropy for reconstruction and a Contrastive Loss to minimize the semantic gap between the code-switched input and the "clean" reference sentence.

Experimental Setup and Results

The authors evaluated WSP-NMT across Romance languages (English, French, Italian, Spanish, Portuguese, and Romanian) and Indo-Iranian languages (English, Hindi, and Farsi). They utilized standard benchmarks like WMT and FLORES 200, alongside the DiBiMT benchmark specifically designed for disambiguation.

Key Findings

  • Overall Quality: WSP-NMT achieved a +1.2 spBLEU and +0.02 COMET22 improvement over the Aligned Augmentation (AA) baseline in high-resource Romance settings.
  • Low-Resource and Zero-Shot Power: The gains were even more dramatic as data became scarcer, showing improvements of +3 to +4 spBLEU in low-resource setups. In a simulated zero-shot English-Portuguese task, WSP-NMT outperformed the baseline by up to +1.64 spBLEU.
  • Disambiguation Accuracy: On the DiBiMT benchmark, the model showed a 15% relative improvement in verb disambiguation for Italian, proving it learns to distinguish between meanings rather than relying on frequency biases.
  • The "Morphology Gap": The study highlights that even simple heuristics for morphological inflection provide a major boost, helping the model maintain linguistic agreement when using structured knowledge.

Discussion and Limitations

While WSP-NMT shows significant promise, its success is tied to the quality of the underlying WSD systems and Knowledge Bases. In Indo-Iranian experiments, gains were minimal due to lower coverage in BabelNet for those languages. Additionally, because BabelNet is human-curated, it may contain inherent biases that the model could inherit. Future work will focus on improving WSD coverage for low-resource languages and resolving contextual biases like gender during the translation process.

Summary updated

BibTeX
@inproceedings{iyer2023code,
  author = {Vivek Iyer and Edoardo Barba and Alexandra Birch and Jeff Z. Pan and Roberto Navigli},
  title = {{Code-Switching with Word Senses for Pretraining in Neural Machine Translation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.859},
}
Figure