Announcements

Introducing luso-mt: Open Translation for Chichewa and Tumbuka

We are releasing luso-mt, two small open translation models for English to and from Chichewa and Tumbuka. One model handles all four directions, the smallest fits on any phone, and both are free to use under Apache-2.0.

Byamasu Patrick Paul

7 min read

Introducing luso-mt: Open Translation for Chichewa and Tumbuka

Today we are releasing luso-mt, our first open translation models. They translate between English and Chichewa, and between English and Tumbuka, in both directions, with a single model. luso-mt-tiny has 20 million parameters and fits on any phone; luso-mt-small has 88 million. Both are free to use under the Apache-2.0 licence.

Hugging Face luso-mt-tiny (19.9M)  ·  Hugging Face luso-mt-small (87.7M)  ·  Hugging Face luso-mt-benchmark (all test outputs and scores)

This post explains what the models do, why we built them, how they work and how well they perform. The full method, data and evaluation are in the luso-mt technical report, also available as a PDF.

Why we built it

Chichewa is Malawi's national language, and Tumbuka is the main language of the north. Yet when we tested every open translation model we could find, none served them well enough to put in a product.

  • The open models that may be used commercially reached 41 to 43 chrF++ on Chichewa news and 22 to 27 from Tumbuka into English. None could translate into Tumbuka at all.
  • The strongest open model, Meta's NLLB-200, cannot be used in a commercial product. Its licence is non-commercial.
  • Large general-purpose AI models translate Chichewa reasonably well, but they need a fast connection and cost money for every sentence. Many of the people we build for have neither.

We argued in Malawi Doesn't Need the Biggest AI that the right AI for Malawi is small, open, offline-capable and local-language first. luso-mt is that argument made concrete.

What it does

One model translates in four directions. You choose the language you want with a short tag at the start of the text:

You typeluso-mt writes
<2ny> Where is the nearest clinic?Kodi chipatala chapafupi ndi chakuti?
<2en> Kodi chipatala chapafupi chili kuti?Where is the nearby hospital?
<2tum> The rains came early this year.Mvula yikafika kukwambilira kwa chaka ichi.
<2en> Gandhi nayo akagomezganga mundondomeko ya vyachuma nakulondezga nthowa zambula viwawa.Gandhi also believed in the economic system and followed non-violent methods.

These are real outputs of luso-mt-small. There is no need to say which language the input is in; the model recognises it. Because everything runs on the device, nothing the user types leaves the phone.

How well it works

We scored every model on the same held-out sentences: 500 professionally translated news sentences for Chichewa (NTREX-128) and 500 everyday sentences for Tumbuka (SMOL). These sentences, and anything closely resembling them, were removed from our training data before training began. The score is chrF++, which compares characters and word pairs with a human translation; higher is better.

ModelSizeen→nyny→enen→tumtum→enCommercial use
luso-mt-small88M47.646.935.830.0Yes
luso-mt-tiny20M46.345.534.929.1Yes
NLLB-200 distilled (Meta)615M50.055.238.232.7No
MADLAD-400 (Google)2,940M37.851.3not supported26.8Yes
OPUS-MT (one model per pair)75M each41.042.7not available24.1Yes

luso-mt-small is within 2.4 points of NLLB-200 from English into Chichewa and 2.4 into Tumbuka, at a seventh of its size, and it is the only commercially usable model here that translates into Tumbuka. It beats the small OPUS-MT models by 6.6 points into Chichewa and 5.9 from Tumbuka. The largest remaining gap is Chichewa into English, where NLLB-200 is still 8.3 points ahead. luso-mt-tiny, a quarter of the size, is within 1.4 points of luso-mt-small in every direction. The technical report breaks these numbers down by sentence length, checks how often each model answers in the wrong language, and compares the models sentence by sentence; every model's test outputs are public in the luso-mt benchmark.

How it works

luso-mt is an encoder-decoder Transformer, the same family of model behind most modern translation systems. Each part was chosen for a small model that must run fast on a phone.

Diagram of the luso-mt architecture: a deep encoder on the left and a shallow decoder on the right, connected by cross-attention.
Figure 1. The luso-mt architecture. The encoder (left) reads the whole sentence once. The decoder (right) writes the translation one piece at a time, looking back at the encoder. The numbers mark the design choices described below.

Reading the sentence (1-3). The text, with its language tag, is cut into pieces from a vocabulary shared by English, Chichewa and Tumbuka. Chichewa and Tumbuka build long words from prefixes and stems, so working with word pieces lets the model handle words it has never seen. Each piece becomes a list of numbers (an embedding), and the same table of embeddings is reused at the output, which saves about a fifth of the model's size.

Understanding it (4-7). The encoder is a stack of identical layers. In each, every word looks at every other word to work out what it means in context (self-attention), then passes through a small network that refines it (the feed-forward layer). We use the modern form of these layers: normalisation before each step for stable training, gated feed-forward layers, and word-order information that does not limit sentence length. The encoder is deep: 12 layers in luso-mt-small.

Writing the translation (8-10). The decoder writes one piece at a time. At each step it looks at what it has written so far, and at the encoder's understanding of the source (cross-attention), then picks the next piece. It keeps the four best partial translations as it goes (beam search) so one early mistake cannot ruin the sentence.

Why the decoder is shallow. The encoder runs once per sentence, but the decoder runs once for every word it writes. On a phone, the decoder is where the waiting happens. So we put most of the layers in the encoder and only four in the decoder. For a 20-piece sentence, luso-mt-small does about 92 layer passes, where a conventional 12 + 12 design would do 252. Research by Kasai and colleagues showed this trade costs very little quality.

Diagram of the luso-mt training pipeline: data, a fine-tuned teacher, and small students trained from it.
Figure 2. How luso-mt is trained: transfer from a large model, then compress into small ones. Test sentences are kept apart and only used for scoring.

Training in two steps. Small models learn best from a good teacher. First, we took MADLAD-400, a 3-billion-parameter model from Google that has seen text in more than 400 languages, and fine-tuned it on our data until it translated Chichewa and Tumbuka well. Then that teacher translated our entire training set, and we trained the small luso-mt models on the teacher's translations together with the original sentence pairs. This is called knowledge distillation; it is how Firefox's offline translation models are made.

What we trained on

We built the training data ourselves: about 90,000 Chichewa sentences from Malawian news sites, blogs and Wikipedia, about 50,000 Tumbuka sentences from Tumbuka Wikipedia and news sites, and a few thousand sentences translated by professionals (Google's SMOL). Most of the English side was produced with machine translation and is labelled as such, so the model can tell it apart from human writing. Every sentence was checked by language identification, and Zambian and Mozambican varieties were filtered out so the models learn the language as it is spoken in Malawi.

The public models were trained only on text we are allowed to release. We are not releasing the dataset itself at this time. We also designed a larger model, luso-mt-base (209 million parameters); it did not finish training within this release's compute budget and will come in a later round.

Limitations

  • The models learnt mostly from news and web text. Everyday conversation, medicine and law will be weaker.
  • Small models sometimes drop or change names, numbers and dates. Check them.
  • Very short sentences, especially instructions, are sometimes returned untranslated or with a phrase repeated.
  • Tumbuka has far less data than Chichewa, and its quality is lower.
  • These models are not a replacement for a professional translator where accuracy matters: health, legal or safety information should be reviewed by a person.

Try it

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

tok = AutoTokenizer.from_pretrained("suru8-ai/luso-mt-small")
model = AutoModelForSeq2SeqLM.from_pretrained("suru8-ai/luso-mt-small")

batch = tok("<2ny> Where is the nearest clinic?", return_tensors="pt")
print(tok.decode(model.generate(**batch, num_beams=4)[0], skip_special_tokens=True))

The models are standard Hugging Face models: they load with the transformers library, with no custom code. On an 8-core CPU, luso-mt-tiny translates about 8.32 sentences per second and luso-mt-small about 2.96 (greedy decoding, one sentence at a time). With int8 quantisation luso-mt-tiny is 40.5 MB.

What comes next

luso-mt is the first release of our Luso models. Speech recognition and speech synthesis for Chichewa are in training on recordings from our own contributors, and we will release them the same way: open models, a model card, and a technical report that shows how they were made and how they perform.

If you build with luso-mt, or find a sentence it gets badly wrong, tell us at research@rexplore.ai. Bad translations are how the next version gets better.

References

  • Vaswani et al. (2017). Attention Is All You Need.
  • Raffel et al. (2020). Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer.
  • Kasai et al. (2021). Deep Encoder, Shallow Decoder: Reevaluating Non-autoregressive Machine Translation.
  • Kim and Rush (2016). Sequence-Level Knowledge Distillation.
  • Kudugunta et al. (2023). MADLAD-400: A Multilingual and Document-Level Large Audited Dataset.
  • NLLB Team (2022). No Language Left Behind: Scaling Human-Centered Machine Translation.