An Exploration of Placeholding in Neural Machine Translation

Matt Post, Shuoyang Ding, Marianna J. Martindale, Winston WuMTSummit 2019

Abstract: Matt Post, Shuoyang Ding, Marianna Martindale, Winston Wu. Proceedings of Machine Translation Summit XVII: Research Track.

2019.

Introduction

Neural Machine Translation (NMT) has revolutionized the field, yet it lacks the "translation guarantees" inherent in older phrase-based systems. A significant challenge in NMT is the handling of specific entities—such as numbers, names, and URLs—which can be mangled or omitted due to the model's sub-word processing and "black box" nature. This research explores placeholding (or masking), a technique where entities are replaced with generic tags during translation and restored afterward, to determine its effectiveness in ensuring entity accuracy.

Methodology

The study evaluates several strategies for integrating placeholding into a Transformer-based NMT architecture.

Masking and Demasking Strategies

Entities are identified via Regular Expressions for structured data (e.g., numbers, URLs) and Dictionary Lookup for named entities (e.g., people, cities). A core difficulty is "demasking"—mapping source entities back to the correct placeholder in the output. The authors compare:

  • Indexing: Using unique tags like NAME_1 and NAME_2 to force the model to learn ordering.
  • Bipartite Matching: Using generic tags (e.g., NAME) and resolving alignments using internal attention weights or external tools like fast-align.
The placeholding pipeline: from source sentence to detokenized output.

Source Factors

As an alternative to hard masking, the authors test "source factors," which append entity-type information to token embeddings. This allows the model to "know" a token is a number or URL without removing the original text, potentially preserving more context.

Experimental Setup

The researchers tested these methods on French–English (high-resource) and Japanese–English (low-resource) language pairs. They used standard benchmarks (WMT15) alongside the MTNT dataset, which features noisy social media text. Additionally, synthetic data was used to stress-test rare entity types like email addresses.

Key Results and Insights

The findings suggest that placeholding is a complex trade-off rather than a simple fix.

Baseline Performance vs. Masking

Surprisingly, modern NMT systems are already robust at translating entities. For instance, the French–English baseline correctly handled numbers over 91% of the time. In contrast, hard masking often introduced new errors, such as the decoder failing to generate the required number of placeholder tokens.

Impact on Translation Quality

As shown in the performance table, hard masking generally led to a slight decrease in overall BLEU scores, typically ranging from 0.1 to 1.0 points. This indicates that removing entity text can disrupt the natural linguistic context the model uses for translation.

BLEU scores across different masking and source factor strategies for French-English and Japanese-English.

Success with Emojis and URLs

The primary benefit of masking was observed with emojis and long URLs. These entities are often fragmented by standard tokenizers into meaningless sub-word units. Masking prevents this fragmentation, making it essential for these specific types.

Source Factors and Alignment

"Summed" source factors provided a modest but consistent improvement in BLEU scores (approximately 0.4 points) without the risks of hard masking. For demasking, unindexed masking paired with bipartite matching (via attention) proved as effective as indexing, offering a more flexible implementation.

Conclusion

While placeholding is widely used in industry, this study highlights its limitations. NMT systems are naturally capable of handling many entities, and hard masking can sometimes degrade overall translation quality. However, for tokenizer-unfriendly entities like emojis, masking remains a critical tool. Future research may focus on constrained decoding or specialized loss functions to further improve entity translation reliability.

Summary updated

BibTeX
@inproceedings{post2019exploration,
  author = {Matt Post and Shuoyang Ding and Marianna J. Martindale and Winston Wu},
  title = {{An Exploration of Placeholding in Neural Machine Translation}},
  booktitle = {MTSummit},
  year = {2019},
  url = {https://openreview.net/forum?id=8hM5bIpM14Me},
}
Figure