OPUS - CAT : Desktop NMT with CAT integration and local fine-tuning (2021)

Abstract: OPUS-CAT is a collection of software which enables translators to use neural machine translation in computer-assisted translation tools without exposing themselves to security and confidentiality risks inherent in online machine translation. OPUS-CAT uses the public OPUS-MT machine translation models, which are available for over a thousand language pairs. The generic OPUS-MT models can be fine-tuned with OPUS-CAT on the desktop using data for a specific client or domain.

## introduction neural machine translation (nmt) has brought about a dramatic increase in the quality of machine translation in the past five years. the results of the latest european language industry survey @xcite confirm that nmt is now routinely used in professional translation work. nmt systems used in translation work are developed by specialized machine translation vendors, translation agencies, and organizations that have their own translation departments. translators use nmt either at the request of a client, in which case the client provides the nmt, or independently, in which case they usually rely on web-based services offered by large tech companies (such as google or microsoft) or specialized machine translation vendors. these web-based services are mainly used through machine translation plugins or integrations that are available for all major computer-assisted translation (cat) tools, such as sdl trados and memoq. even though mt has been extensively used in the translation industry for over a decade @xcite , there is still considerable scope for growth: according to fit europe et al. (2020), 78 percent of language service companies plan to increase or start mt use, and most independent translation professionals use mt only occasionally. one of the factors slowing down the adoption of mt are risks related to confidentiality and security. there are well-known risks involved with using web services, which also concern the web-based nmt services available to translators and organizations: data sent to the service may be intercepted en route, or it may be misused or handled carelessly by the service provider. these security and confidentiality risks (even if they are unlikely to actualize) hinder mt use by independent translation professionals, since their clients often specifically forbid or restrict the use of web-based mt (european commission, 2019). even if using web-based mt is not expressly forbidden, translators may consider it unethical or they may fear it might expose them to unexpected legal liabilities @xcite . producing mt directly on the translator's computer without any communication with external services eliminates the confidentiality and security risks associated with web-based mt. this requires an optimized nmt framework which is capable of running on windows computers (as most cat tools are only available for windows), and pre-trained nmt models for all required language pairs. the marian nmt framework @xcite fulfills the first requirement, as it is highly optimized and supports windows builds. pre-trained nmt models are available from the opus-mt project @xcite , which trains and publishes marian-compatible nmt models with the data collected in the opus corpus @xcite . opus-cat is a software collection which contains a local mt engine for windows computers built around the marian framework and opus-mt models, and a selection of plugins for cat tools. opus-cat is aimed at professional translators, which is why it also supports the fine-tuning of the base opus-mt models with opus corpora opus-mt model repository opus-cat mt engine tmx file or parallel text files locally installed marian nmt cat tool integration memoq plugin trados plugin omegat plugin wordfast (as custom mt) train models install models locally translate with models finetune models api extract fine-tuning material project-specific data. ## opus-cat mt engine the main component of opus-cat is the opus-cat mt engine, a locally installed windows application with a graphical user interface. opus-cat mt engine can be used to download nmt models from the opus-mt model repository, which contains models for over a thousand language pairs. once a model has been downloaded, opus-cat mt engine can use it to generate translations by invoking a marian executable included in the installation. before the text is sent to the marian executable, opus-cat mt engine automatically pre-processes the text using the same method that was originally used for pre-processing the training corpus of the model. pre-processing is modelspecific, as the older opus-mt models use subword nmt @xcite for segment-ing the text while newer models use sentencepiece @xcite . both subword nmt and sentencepiece are coded in python, but they are distributed as standalone windows executables with opus-cat mt engine, as requiring the users to install python in windows would complicate the setup process. opus-cat mt engine user interface provides a simple functionality for translating text, but the translations are mainly intended to be generated via an api that the opus-cat mt engine exposes. this api can be used via two protocols: net.tcp and http. net.tcp is used with plugins for the sdl trados and memoq cat tools, while http is used for other plugins and integration. the motivation for using net.tcp is that exposing a net.tcp service on the local windows computer does not require administrator privileges, which makes setting up the opus-cat mt engine much easier for nontechnical users. however, trados and memoq are the only cat tools with sufficiently sophisticated plugin development kits to allow for net.scp connections, so the api can also be used via http with some extra configuration steps, so that it can be used from other tools. the api has three main functionalities: the opus-cat mt engine stores the local nmt models in the user's application data folder in order to avoid file permission issues. local application data folder is used, as saving the models in the roaming application data folder could lead to unwanted copying of the models, if same user profile is used on multiple computers. the user interface of the opus-cat mt engine contains functionalities for managing models installed on the computer, such as deletion of models, packaging of models for migration to other systems, and tagging the models with descriptive tags. the tags can be used to select specific models in cat tool plugins, e.g. a model fine-tuned for a specific customer can be tagged with the name of the customer. ## cat tool plugins and integration opus-cat contains plugins for three cat tools: sdl trados, memoq and omegat. opus-cat can also be used with the wordfast cat tool, which supports fetching translations from services via apis. as sdl trados is the established market leader among cat tools, and it has the most extensive plugin development support, the opus-cat plugin for sdl trados is more feature-rich than the other plugins. the other plugins simply support fetching translations through the translate api method. sdl trados plugin also contains an option to initiate the fine-tuning of a model based on the bilingual material included in a translation project. one difficult aspect of integrating mt services with cat tools is latency. delays in presenting the translation to the user affect the user experience adversely and may even lower productivity significantly. for most mt services the delay is due to web latency, but for opus-cat the generation of translations itself may be so slow that it causes a visible delay, since opus-cat uses a cpu for translation instead of a much faster gpu. in any cat tool, this delay can be eliminated by pre-translating the translation project with the mt service prior to starting the translation. in the opus-cat plugin for sdl trados there is also a feature which can be used to initiate the translation of segments ahead of time. whenever the translator moves to a new segment, the plugin will send the segments following the selected segment (the number of segments can be configured in the plugin settings) to the opus-cat for translation. this means that when the translator moves to the next segment, it has already been translated and can simply be retrieved from the opus-cat translation cache. the method of fine-tuning is simple: the generic opus-mt model for a language pair is duplicated, and marian training of the model is resumed with the model using the domain-specific data as the training set. this particular method of fine-tuning was first described in @xcite , but adaptation of statistical and neural mt models with domain-specific data has been common for over a decade @xcite . the fine-tuning is performed using the same marian executable included with opus-cat mt engine installation, which is also used for generating translations. opus-cat mt engine is a windows program intended to run on mid-tier desktop and laptop computers that translators commonly use, so the finetuning process cannot be computationally intensive. the fine-tuning must rely on cpus, since gpus suitable for neural network training are not available on the translators' computers. this places severe restrictions on the size of the fine-tuning set and the duration of the training. furthermore, the fine-tuning functionality is intended to be used by translators without specialist knowledge about machine translation, so the users cannot be expected to be able to adjust the fine-tuning settings. that is why the fine-tuning functionality has to have a conservative set of default settings that work in almost all environments and circumstances. in a typical translation job, deadlines usually allow for considerably more time for delivery of the translation than the actual translation work requires. this is due to the fact that translators normally have multiple jobs underway or lined up at any given time, and extended deadlines are required so that translators can organize and prioritize their work. this means that there is generally at least a couple of hours of time available for running the fine-tuning process before the actual translation work has to begin. on the basis of this estimate, the fine-tuning process should generally take at most two hours. another consideration in fine-tuning is that the process takes place on a computer that may be used for other tasks during the fine-tuning. this means that the fine-tuning process cannot take advantage of all the resources available on the computer, as doing so would cause performance issues for the user. in order to keep the fine-tuning as non-intrusive as possible, opus-cat mt engine uses only a single thread and a workspace of 2048 mb for fine-tuning. because of the limited amount of processing power available and the target duration of at most two hours, the fine-tuning is stopped after a single epoch by default. the actual duration will vary according to the sentence count and the sentence length distribution of the fine-tuning set. the duration will be approximately two hours when the finetuning set contains the default maximum amount of sentences, which is 10,000. it would be possible to allow the fine-tuning to last for multiple epochs and to adjust the amount of epochs based on the sentence count, but informal testing during development indicated that a single epoch of fine-tuning tends to have a noticeable effect on the mt output even with small finetuning sets. also, some output corruption indicating over-fitting was detected when fine-tuning was continued over many epochs. because of these indications of over-fitting, the learning rate was also lowered to 0.00002 from the default 0.0001. ad-vanced users can change these default settings in the settings tab of the opus-cat mt engine. currently fine-tuning can be initiated directly from the opus-cat mt engine or from the sdl trados plugin. when initiated from the opus-cat mt engine, a .tmx file or a pair of source and target files can be used as fine-tuning material. fine-tuning from the sdl trados plugin allows for much more sophisticated selection of fine-tuning material. the fine-tuning functionality in the sdl trados plugin is implemented as a batch task, which is performed for a given translation project. translation projects usually contain segments which have already been translated (full matches). by default, the fine-tuning task extracts these segments as fine-tuning material. these are assumed to be the most relevant material, since they pertain directly to the translation project. units from the translation memories attached to the translation project. the fine-tuning task uses the fuzzy matching functionality of sdl trados to extract partially matching translation units according to the specified minimum fuzzy percentage. the task can also extract fine-tuning material by performing a concordance search for words or sequences of words in the source segment. finally, if the other methods have not managed to extract a sufficient amount of fine-tuning material, the task can simply bulk up the fine-tuning set by extracting segments from the translation memories, starting with the newest (assumed to be the most relevant). progress of the fine-tuning can be monitored in the opus-cat mt engine. when a fine-tuning job is initiated, part of the fine-tuning set is separated for use as an in-domain validation set. for most language pairs, opus-cat mt engine also contains out-of-domain validation sets, which have been extracted from the tatoeba corpus (tiedemann, 2020). the in-domain and out-of-domain validation sets are combined and evaluated periodically during fine-tuning with sacrebleu @xcite , which is also included in opus-cat as a standalone windows executable. the evaluation results for each set are plotted as a graph in the opus-cat mt engine. opus-cat mt engine also displays an estimate of the remaining duration of the fine-tuning. these visual indications of progress are important, as the users of the finetuning functionality are translators without specialist technical skills. the fine-tuning functionality also has an option to include tags found in the fine-tuning set as generic tag markers. the fine-tuned model will then learn to generate tag markers in the translations, and these can be used to transfer tags from source to target in cat tools (currently only the sdl trados plugin supports tag conversion). placeholder tags and tag pairs are converted separately. this approach to tag handling is similar to the one found in @xcite ), but simpler. the main difference is that the same textual tag marker is used for every tag, so the tag handling assumes that the tag order is identical in both source and target. ## related work desktop mt systems have been available at least since the 1990s @xcite , when desktop computers became powerful enough to run rulebased mt systems. in the smt era, the higher computational requirements made desktop mt difficult, but there were still some examples of desktop smt, such as (slate rocks!, 2021). unlike opus-cat, these earlier desktop mt programs were commercial products. as for nmt, the currently active bergamot project @xcite aims to make client-side mt available in web browsers, and also uses marian as its nmt framework. however, bergamot is aimed at the common public, while opus-cat is intended for professional translators. to our knowledge, there is no other software that is free to use and offers a local nmt fine-tuning functionality (commercial mt providers do provide local mt engine installations, which may support local fine-tuning). ## conclusion opus-cat is collection of software that makes it possible to use nmt locally on desktop computers