stopes - Modular Machine Translation Pipelines

Pierre Andrews, Guillaume Wenzek, Kevin Heffernan, Onur Çelebi, Anna Y. Sun, Ammar Kamran, Yingzhe Guo, Alexandre Mourachko, Holger Schwenk, Angela Fan

Introduction

Modern Neural Machine Translation (NMT) is fundamentally a data-driven endeavor. To achieve high-quality translation across hundreds of languages, researchers must process petabytes of raw web data into clean, aligned sentence pairs. Historically, this has been managed through a "path of predilection"—a collection of ad-hoc Python scripts, manual job management, and fragile hard-coded paths. This approach fails to scale, lacks reproducibility, and is highly inefficient when pipelines fail.

To address these challenges, Meta AI developed stopes, an open-source, modular Python framework designed to bridge the gap between flexible research code and industrial-strength stability. stopes served as the primary engine for the No Language Left Behind (NLLB) project, enabling the training of a single model covering 200 languages.

The stopes Framework

The architecture of stopes is built on three core concepts that decouple processing logic from the underlying hardware infrastructure:

  1. Modules: The fundamental building blocks. Each module is a Python class encapsulating a single task (e.g., tokenization, embedding calculation).
  2. Pipelines: Standard Python functions that compose modules into complex workflows. This allows researchers to use familiar debugging tools and logic.
  3. Launchers: The orchestration layer. Using asyncio, launchers manage dependencies and scheduling, allowing the same pipeline to run on a local machine, a SLURM cluster, or cloud environments like AWS with minimal configuration changes.

The framework integrates Hydra for robust configuration management and features automatic memoization. By caching results at the module level, stopes avoids redundant computations—a critical feature when expensive operations like text embedding are involved. This "minimal API surface" philosophy ensures that researchers can adopt better engineering practices without the steep learning curve associated with heavy industry tools like Apache Spark or Beam.

Applications and Versatility

The framework's utility is demonstrated through several complex NMT sub-tasks that were previously difficult to scale and reproduce.

Bitext Mining

Finding translated sentence pairs in massive unaligned datasets is a core challenge. stopes facilitates this by integrating specialized encoders (like LASER3) and similarity search tools (like FAISS).

The stopes bitext mining pipeline, integrating LID, specialized encoders, and FAISS indexing.

As shown in the mining pipeline, stopes manages the flow from raw web data through language identification (LID) and filtering, into embedding and indexing, finally producing the bitext used for NMT training. The caching mechanism is particularly valuable here, as it allows researchers to iterate on mining logic without re-calculating expensive embeddings.

Model Distillation

To create efficient, deployable models, researchers often use distillation, where a smaller "student" model learns from a larger "teacher" model. This requires a complex multi-stage pipeline.

The model distillation pipeline in stopes, showing the progression from raw data to a distilled model.

The distillation pipeline illustrates the framework's ability to handle processes involving sampling, shard generation, and iterative training steps, ultimately outputting a distilled model ready for evaluation via BLEU scores.

Impact and Key Results

stopes was the "key enabler" for the NLLB-200 project, which set a new state-of-the-art for multilingual translation. The framework processed datasets of 18 to 25 billion sentence pairs and aligned over one billion sentences across more than 450 language pairs. Beyond NLLB, it has proven successful in training large-scale Language Identification (LID) models.

Conclusion

By abstracting infrastructure and providing built-in caching and modularity, stopes transforms NMT pipeline development from a manual "babysitting" task into a reproducible engineering process. While optimized for the high-churn environment of research rather than static production environments, its success in the NLLB project proves its capacity to handle the most demanding scales of modern machine learning. The entire library and NLLB pipelines are available under the MIT license to foster community-driven reproducibility.

Summary updated

BibTeX
@inproceedings{andrews2022stopes,
  author = {Pierre Andrews and Guillaume Wenzek and Kevin Heffernan and Onur Çelebi and Anna Y. Sun and Ammar Kamran and Yingzhe Guo and Alexandre Mourachko and Holger Schwenk and Angela Fan},
  title = {{stopes - Modular Machine Translation Pipelines}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-demos.26},
}
Figure