In January of 2019, Mozilla joined the University of Edinburgh, Charles University, University of Sheffield and University of Tartu as part of a project funded by the European Union called Project Bergamot. The ultimate goal of this consortium was to build a set of neural machine translation tools that would enable Mozilla to develop a website translation add-on that operates locally, i.e. the engines, language models and in-page translation algorithms would need to reside and be executed entirely in the user’s computer, so none of the data would be sent to the cloud, making it entirely private.
In addition to that, two novel features needed to be introduced. The first was translation of forms, to allow users to input text in their own language that is dynamically translated on-the-fly to the page’s language. The second feature was quality estimation of the translations where low confidence translations should be automatically highlighted on the page, in order to notify the user of potential errors.
This set of requirements posed a number of technological challenges to the team: the translation engine was entirely written in programming languages that compile to native code. We needed a way to streamline the distribution of the project in order to avoid the overhead involved in providing builds compatible with all platforms supported by Firefox — that would be impracticable to scale and maintain. Also, the engine needed to perform fast enough on CPUs and not rely on GPUs like is traditionally required by deep learning solutions.
Our solution to that was to develop a high-level API around the machine translation engine, port it to WebAssembly, and optimize the operations for matrix multiplication to run efficiently on CPUs. That enabled us to not only develop the translations add-on but also allowed every web page to integrate local machine translation, like in this website, which lets the user perform free-form translations without using the cloud.
The translations add-on is now available in the Firefox Add-On store for installation on Firefox Nightly, Beta and in General Release. We are looking for users’ feedback and in the add-on, you’ll see a button to fill out a survey that will help Project Bergamot collaborators understand which direction we should take the product.
To empower the community to contribute with new languages we also developed a comprehensive training pipeline to allow enthusiasts to easily train new models, helping expand the add-on reach.
This work aligns with Mozilla’s commitment to keeping the web accessible to everyone regardless of their language while also building open-source projects of value to our community with a focus on privacy. Please join us and send suggestions — we need all of your voices to make this add-on truly accessible for all.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 825303.