Preprint
Machine Learning

Marian MT

April 1, 2018

0

Citations

0

Influential Citations

Venue

2018

Year

Abstract

A Neural Machine Translation framework written entirely in C++ with minimal dependencies, designed for high training and translation speed.

Analysis

Why This Paper Matters

Neural machine translation (NMT) has become the dominant paradigm for language translation, but most frameworks rely on heavy Python libraries like TensorFlow or PyTorch, which introduce overhead and dependency bloat. Marian addresses this by offering a pure C++ implementation with minimal dependencies, achieving high training and inference speed without sacrificing flexibility. Its dynamic computation graph design makes it particularly attractive for researchers who need to prototype novel architectures quickly, while its production-ready performance suits deployment scenarios where latency and resource usage are critical.

How It Works

Figure 1

Marian's core is a reverse-mode automatic differentiation engine that builds dynamic computation graphs on the fly, similar to DyNet. This allows the framework to handle variable-length sequences and dynamic architectures efficiently, which is essential for NMT tasks. The encoder and decoder are implemented as classes with a simplified interface:

class Encoder { EncoderState build(Batch); };
class Decoder { DecoderState startState(EncoderState[]); DecoderState step(DecoderState, Batch); };

This design enables mixing different encoder and decoder types—for example, an RNN encoder with a Transformer decoder—reducing implementation effort for new models. The framework includes optimized implementations of fused RNN cells, attention mechanisms, and layer normalization, all tailored for translation workloads.

For training, Marian supports multi-device (GPU or CPU) training, scoring, and batched beam search. It also allows ensembling of heterogeneous models (e.g., deep RNNs with Transformers or language models) and multi-node training. The paper demonstrates a typical training pipeline: preprocessing (tokenization, true-casing, vocabulary reduction), training a shallow model for backtranslation on WMT17 data, generating synthetic parallel data from 10M German monolingual sentences, and then training four left-to-right (L2R) deep models (RNN or Transformer) and four right-to-left (R2L) models. Ensemble decoding with four L2R models produces an n-best list of 12 hypotheses per sentence, which is then rescored with four R2L models using equal weighting.

Results

Marian achieves strong results on standard WMT benchmarks. On newstest-2016 (validation set) and newstest-2017, the ensemble of deep models with rescoring yields competitive BLEU scores, demonstrating that the framework's efficiency does not come at the cost of quality. The paper reports that the system is fast enough for both research experimentation and production deployment.

Significance

Marian fills a gap in the NMT ecosystem by providing a lightweight, high-performance alternative to Python-based frameworks. Its C++ implementation makes it suitable for environments where Python is unavailable or undesirable, such as embedded systems or high-throughput servers. The dynamic computation graph approach retains the flexibility needed for research, while the built-in support for ensembling and multi-device training addresses practical deployment needs. By open-sourcing the toolkit, the authors have enabled the community to build upon their work, and Marian has since been used in various production systems and research projects. Its design principles—minimal dependencies, speed, and modularity—serve as a model for future specialized deep learning frameworks.