Source-linked AI summary
OpenNMT: Neural Machine Translation Toolkit
Guillaume Klein, Yoon Kim, Yuntian Deng, Vincent Nguyen, Jean Senellart, Alexander M. Rush
TL;DR
Researchers needed open NMT implementations for benchmarking, learning, and extension that could also serve production contexts. OpenNMT provides an efficient, modular toolkit and reports competitive translation and generation results, including a third-place WMT 2017 English–German result with a single model.
Problem
As NMT became more standardized, researchers needed open implementations to benchmark against, learn from, and extend while remaining efficient and accurate enough for production contexts.
Source: §1 · p. 1Method
OpenNMT is an open-source NMT toolkit designed around efficient training and testing, modularity, and research extensibility.
Source: §1 · p. 1, §3 · p. 3, §4.1 · p. 4Results
OpenNMT reports competitive translation results, including third place in WMT 2017 English–German with a single model, and replicated Gigaword sentence summarization at ROUGE-1 35.51.
Source: §5 · p. 6Takeaways & Limitations
OpenNMT’s modularity supports implementing alternative attention mechanisms and feature-based factored translation with minimal code changes.
Source: §4.2 · p. 5The default settings are useful for experiments but not optimal for large-scale NMT; the sequence-length cutoff of 50 is too short for BPE.
Source: §5 · p. 6
Abstract
from arXiv · showhide
OpenNMT is an open-source toolkit for neural machine translation (NMT). The system prioritizes efficiency, modularity, and extensibility with the goal of supporting NMT research into model architectures, feature representations, and source modalities, while maintaining competitive performance and reasonable training requirements. The toolkit consists of modeling and translation support, as well as detailed pedagogical documentation about the underlying techniques. OpenNMT has been used in several production MT systems, modified for numerous research papers, and is implemented across several deep learning frameworks.
1 Introduction
As neural machine translation gained traction, researchers needed open implementations for benchmarking, learning, and extension that could also meet production needs. OpenNMT was introduced as an efficient, modular, extensible toolkit, alongside a broader ecosystem of NMT frameworks.
1 Introduction
- NMT had brought improvements, particularly in human evaluation, compared with rule-based and statistical machine translation systems.The paper also notes NMT’s use in dialogue, parsing, and summarization.Source: §1 · p. 1
- Open toolkits can give researchers a shared framework to benchmark against, learn from, and extend, while supporting efficient, accurate systems for production contexts.The paper compares this role with that of Moses and CDec in statistical machine translation.Source: §1 · p. 1
- OpenNMT was introduced as an open-source toolkit designed for efficient training and testing, modularity, research extensibility, and state-of-the-art accuracy.The system was also intended to be efficient and accurate enough for production contexts.Source: §1 · p. 1
- OpenNMT’s Figure 1(a) depicts an attention-based encoder-decoder translation process, while Figure 1(b) shows a live system demo.Source: Figure 1 · p. 2
- The NMT open-source community includes many frameworks with varied feature priorities, and OpenNMT aims to build on their strengths with high-accuracy translation, options, and clear documentation.Source: §1 · p. 2
- The report surveys NMT background and implementation before benchmarking accuracy, speed, and memory use across translation and language-generation tasks.Source: §1 · p. 2
2 Background
The background presents NMT as conditional language modeling with an attention-based encoder-decoder, then outlines model and decoding choices that support effective translation.
2 Background
- The paper gives only a condensed NMT overview because the subject has already been extensively covered in tutorials.Source: §2 · p. 2
- NMT models the probability of a target sentence given a source sentence, using an attention-based encoder-decoder trained end-to-end to minimize corpus negative log-likelihood.The encoder produces source hidden vectors; the decoder combines prior target words with attention over those vectors to predict the next word.Source: §2 · p. 2
- Effective NMT commonly uses gated RNNs, stacked layers, and input feeding, which returns the previous attention vector alongside the predicted word.The cited passage identifies LSTMs and GRUs as gated RNN examples and describes stacks of 2–16 RNN layers.Source: §2 · pp. 2–3
- At test time, beam search considers multiple target hypotheses at each step, and the paper notes that implementing these NMT techniques correctly can be difficult.Source: §2 · p. 3
3 Implementation
OpenNMT provides libraries for training, using, and deploying NMT models, with several actively maintained implementations and a compact, open development model.
3 Implementation
- OpenNMT’s core libraries support training, using, and deploying NMT models, with options including attention, gating, stacking, input feeding, regularization, copy models, and beam search.The system was rewritten from seq2seq-attn to improve efficiency, readability, and generalizability.Source: §3 · p. 3
- OpenNMT-lua is the original Torch 7 implementation, described as full-featured, optimized, stable, and ready for experiments and production.Source: §3 · p. 3
- OpenNMT-py is a PyTorch clone of OpenNMT-lua that is easy to extend and particularly suited to research.Source: §3 · p. 3
- OpenNMT-tf follows TensorFlow’s style and focuses on large-scale experiments and high-performance model serving using current TensorFlow features.Source: §3 · p. 3
- OpenNMT is developed openly under the MIT license, with contributions from SYSTRAN Paris, Harvard NLP, Facebook AI Research, and more than 100 outside contributors.The project also reports over 2,500 stars across its implementations and an active community forum.Source: §3 · p. 3
- The implementations are compact relative to Moses: OpenNMT-lua has roughly 16K lines, OpenNMT-py fewer than 4K, and OpenNMT-tf around 7K, versus over 100K for Moses.The projects are self-contained and include preprocessing, visualization, and analysis tools.Source: §3 · p. 3
4 Design Goals
OpenNMT targets training and deployment efficiency while making its components modular and customizable for research. Its design combines memory-saving and multi-GPU techniques with flexible model, input, and search options.
4.1 System Efficiency
- Aggressive reuse of dynamically identified network buffers saves 70% of GPU memory with the default model size; OpenNMT-py sharding supports datasets too large for memory and reduces back-propagation memory footprints.The buffer-sharing design exploits NMT’s time-series control flow.Source: §4.1 · p. 4
- With 8 GPUs, OpenNMT achieved 6× speedup per epoch and 3.5× total training speedup when training to similar loss, with a slight loss in training efficiency.The toolkit supports synchronous and asynchronous data-parallel training.Source: §4.1 · p. 4
- OpenNMT provides batched CPU/GPU translation for large sentence sets, single-instance translation for mobile devices, and a specialized C implementation for industrial use.Source: §4.1 · p. 4
4.2 Modularity for Research
- Simple preprocess, train, and translate interfaces accept source and target files, while advanced users can customize modules through a library interface.The code separates training, optimization, and model components and includes tutorial documentation.Source: §4.2 · p. 4
- OpenNMT supports discrete features, tables, speech, and images, with image and audio encoders, multiple attention types, and copy mechanisms.Source: §4.2 · p. 5
- Newer OpenNMT implementations add convolutional translation and the attention-only Transformer architecture.Source: §4.2 · p. 5
- Translation users can customize OOV handling, beam-search normalization, dynamic dictionaries, and hypothesis filtering for constraints such as OOV limits and lexical constraints.Additional tools include a reversible tokenizer with BPE, embedding import/export, a translation server, and visualization and logging tools.Source: §4.2 · pp. 5–6
- Swapping attention modules enables local, sparse-max, and structured attention with minimal code changes; factored translation requires modifying input and output networks.Researchers have also used OpenNMT for translation, parsing, summarization, data-to-document generation, and transliteration.Source: §4.2 · pp. 5–6
5 Experiments
OpenNMT reports competitive machine-translation performance and results on language-generation tasks. Its experiments also show that default settings suit experimentation but are not optimal for large-scale NMT.
- OpenNMT placed third in the WMT 2017 English–German translation task with a single model.Source: §5 · p. 6
- OpenNMT’s default setting is useful for experiments but not optimal for large-scale NMT; the authors report comparable performance when conforming more closely to other systems’ settings.They suspect discarding sequences longer than 50 is too restrictive for BPE and find default SGD with learning-rate decay generally better than ADAM.Source: §5 · p. 6
- The authors compare OpenNMT with GNMT and compare its Transformer implementation with Tensor2Tensor on a modified WMT 2017 dataset.The modified dataset uses News Comm v11 instead of v12 and omits Rapid 2016.Source: §5 · p. 6
- OpenNMT replicated sentence-summarization results with a ROUGE-1 score of 35.51 on Gigaword and achieved comparable perplexity after training on 14 million OpenSubtitles sentences.Source: §5 · p. 6