---
title: "Training efficient neural network models for Firefox Translations"
description: "Firefox Translations runs neural machine translation locally on CPU using small models produced by an open-source, reproducible training pipeline from the Bergamot project."
url: "https://swe.quest/articles/training-efficient-neural-network-models-for-firefox-translations-fe8eb9b49ba04dbc"
canonical: "https://hacks.mozilla.org/2022/06/training-efficient-neural-network-models-for-firefox-translations/"
source: "Mozilla Hacks"
published: "2022-06-07"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["model-training","machine-learning","inference","ml-platform","privacy"]
---

# Training efficient neural network models for Firefox Translations

A post on [Mozilla Hacks](https://swe.quest/sources/mozilla-hacks.md), published 2022-06-07, 9 min read, Case study. Original: [https://hacks.mozilla.org/2022/06/training-efficient-neural-network-models-for-firefox-translations/](https://hacks.mozilla.org/2022/06/training-efficient-neural-network-models-for-firefox-translations/)

## Summary

Firefox Translations runs neural machine translation locally on CPU using small models produced by an open-source, reproducible training pipeline from the Bergamot project. The pipeline cleans parallel corpora from OPUS, WMT and Paracrawl with heuristics and bicleaner, augments the data with back-translation, and trains a large transformer teacher. That teacher is then compressed through ensemble knowledge distillation into a small student model with 8-bit quantization. The resulting en-pt student is 47x smaller (17MB vs 798MB) and 37x faster on one CPU core, losing under 2 BLEU points, and some models match cloud translation APIs. The Marian-based pipeline is orchestrated with Snakemake and distributed across GPU nodes with Slurm, and the models ship in the browser via a WebAssembly build of bergamot-translator.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [ML platforms](https://swe.quest/tags/ml-platform.md) (AI & ML)
- [Privacy](https://swe.quest/tags/privacy.md) (Security)

## Prerequisites

- neural network training basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- transformer models

## Keywords

Firefox Translations, Bergamot, Marian NMT, Snakemake, Slurm, knowledge distillation, bicleaner, BLEU

## Related posts

- [Neural Machine Translation Engine for Firefox Translations add-on](https://swe.quest/articles/neural-machine-translation-engine-for-firefox-translations-add-on-e81e0925c599fd24.md): Mozilla Hacks · 2022-06-29 · Medium · 9 min read · WebAssembly, Inference & serving, Performance engineering, Browsers, C & C++
  Firefox Translations runs neural machine translation entirely on the client by compiling the Bergamot Translator engine, a C++ layer on the Marian framework, to WebAssembly.
- [NVIDIA Releases 6 Million Multi-Lingual Reasoning Dataset](https://swe.quest/articles/nvidia-releases-6-million-multi-lingual-reasoning-dataset-b1b00cfb53889ff4.md): Hugging Face · 2025-08-20 · Medium · 4 min read · Model training, LLMs
  Nemotron Post-Training Dataset V2 translates NVIDIA's English reasoning post-training data into French, Spanish, German, Italian and Japanese, translating prompts and responses while keeping the original English reasoning chains.
- [Train 400x faster Static Embedding Models with Sentence Transformers](https://swe.quest/articles/train-400x-faster-static-embedding-models-with-sentence-transformers-9f174d4b1294477b.md): Hugging Face · 2025-01-15 · Hard · 39 min read · Model training, Machine learning, Search, Python, Performance engineering
  Static embedding models, which replace the attention-based encoder with a token embedding lookup plus mean pooling (an EmbeddingBag), can be trained with modern contrastive losses and Matryoshka Representation Learning to run 100x to 400x faster on CPU than models like all-mpnet-base-v2 and multilingual-e5-small, while keeping at least 85% of their benchmark quality.
- [Productizing Large Language Models](https://swe.quest/articles/productizing-large-language-models-5be0923873af50a1.md): Replit · 2022-09-21 · Medium · 6 min read · Inference & serving, LLMs, AI for coding, Evaluation, Kubernetes
  Replit runs transformer models from ~100M parameters (search, spam) through 1-10B (GhostWriter code autocomplete) to 100B+ in production, and shares lessons on making them usable.
- [SmolLM - blazingly fast and remarkably powerful](https://swe.quest/articles/smollm-blazingly-fast-and-remarkably-powerful-2ae9388cca1c805f.md): Hugging Face · 2024-07-16 · Hard · 11 min read · Model training, LLMs, Evaluation
  SmolLM is a family of small language models (135M, 360M, 1.7B parameters) trained on SmolLM-Corpus, a new dataset combining Cosmopedia v2 synthetic textbooks (28B tokens), classifier-filtered Python-Edu (4B tokens) and deduplicated FineWeb-Edu (220B tokens).

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
