Soft Contextual Data Augmentation for Neural Machine Translation

Fei Gao, Jinhua Zhu, Lijun Wu, Yingce Xia, Tao Qin, Xueqi Cheng, Wengang Zhou, Tie-Yan Liu

Introduction

Data augmentation is a cornerstone of deep learning in computer vision, where operations like flipping or rotating images are standard. However, it remains notoriously difficult in Natural Language Processing (NLP). Because language is discrete, small changes—such as swapping or dropping a word—can drastically alter or destroy the semantic meaning of a sentence.

Existing "contextual" augmentation methods attempt to mitigate this by using a language model (LM) to predict replacement words. However, these methods typically rely on "hard" replacements, picking a single specific word from the LM's suggestions. This approach is computationally inefficient, requiring multiple samples of the same sentence to achieve variety, and often fails to capture the full range of semantically plausible alternatives.

The SCA Framework

The authors propose Soft Contextual Data Augmentation (SCA). Instead of replacing a word with a single new token, SCA replaces its one-hot representation with a "soft" distributional representation. This allows the model to learn from a weighted mixture of semantically related words simultaneously, providing a more robust and informative regularization than traditional discrete techniques.

Overview of the Soft Contextual Data Augmentation (SCA) framework, showing how a language model provides probability distributions to replace original tokens.

Methodology

  1. Pre-training: A standard language model is trained on the same training corpus used for the NMT task.
  2. Softening: During NMT training, words in a sentence are randomly selected for augmentation with a probability $\gamma$.
  3. Distributional Replacement: For a selected word $x_t$, the LM provides a probability distribution $P(x_t)$ over the entire vocabulary based on the preceding context.
  4. Soft Embedding: The model receives a "soft embedding" ($e_w$), calculated as the expected value of all word embeddings in the vocabulary weighted by the LM's probability distribution: $$e_w = \sum_{j=0}^{|V|} p_j(w)E_j$$

This mechanism allows the NMT encoder to "see" a smooth approximation of many related words at once, rather than just one noisy replacement.

Experimental Setup

The researchers evaluated SCA on four translation tasks across two major benchmarks:

  • IWSLT 2014: German-to-English (De$\to$En), Spanish-to-English (Es$\to$En), and Hebrew-to-English (He$\to$En), representing smaller-scale datasets (approx. 150k–180k sentence pairs).
  • WMT 2014: English-to-German (En$\to$De), representing a large-scale dataset with 4.5 million sentence pairs.
  • Vocabulary: Byte-Pair Encoding (BPE) was used with 10k sub-words for IWSLT and 40k for WMT.

Key Results and Insights

SCA consistently outperformed strong baselines, including random swapping, word dropout, and "hard" LM-based replacement ($LM_{sample}$).

Comparison of BLEU scores across IWSLT and WMT datasets, highlighting the consistent improvements achieved by the SCA method (Ours).
  • Performance Gains: On IWSLT De$\to$En, SCA achieved a BLEU score of 35.78 (+0.99 over the Transformer base). On the large-scale WMT En$\to$De task, it added +1.3 BLEU points over a strong Transformer-big baseline, reaching 29.70.
  • The Power of "Softness": Using a distribution is superior to sampling a single word. By using a weighted mixture, the model captures richer semantic information and avoids the exponential explosion of possible discrete sentence variations.
  • Aligned Noise: Unlike random noise, the noise introduced by the LM is aligned with the training data, making it an effective regularizer.
  • Robustness: Sensitivity analysis found that a replacement probability ($\gamma$) of 0.15 generally yielded the best results. SCA remained relatively stable even at higher probabilities, suggesting it is a more robust form of augmentation than discrete alternatives.

Conclusion

Soft Contextual Data Augmentation provides a universal and effective way to improve NMT performance without requiring additional monolingual data. While calculating weighted sums over a large vocabulary adds some computational overhead, the method's ability to maximize the utility of existing bilingual training sets makes it a powerful tool for both small and large-scale translation tasks. Future work may explore leveraging external monolingual data or applying "soft" augmentation to other NLP tasks like text summarization.

Summary updated

BibTeX
@inproceedings{gao2019soft,
  author = {Fei Gao and Jinhua Zhu and Lijun Wu and Yingce Xia and Tao Qin and Xueqi Cheng and Wengang Zhou and Tie-Yan Liu},
  title = {{Soft Contextual Data Augmentation for Neural Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1555},
}
Figure