nkya_base: A translation model between English and 5 Ugandan languages
2 min readupdated
nkya_base is a compact 242-million-parameter machine translation model developed by Amanyire Daniel. It translates directly between any two of six languages: English (eng), Luganda (lug), Runyankole (nyn), Acholi (ach), Lugbara (lgg), and Ateso (teo)—covering 30 translation directions in a single model. This is a pretrained base model trained exclusively on synthetic translations without human text fine-tuning, so for ready-to-use tasks the author recommends the separate fine-tuned version, nkya_finetuned. It is well-suited for researchers, local service creators, and developers who need direct translation between low-resource African languages without pivoting through English.
Key features
- Custom architecture: Built on a pre-LN Transformer encoder-decoder base (6+6 layers, d_model 1024, 16 attention heads) with a shared 64,000-token SentencePiece tokenizer.
- Direct translation across 30 directions: The target language is set using a prefix like
<2lug>, and in code the direction is specified with strings such asnyn2lggoreng2teo. - Sentence-level processing: Context is limited to 256 positions, with training texts truncated to 128 tokens.
- Open MIT license: Weights in
safetensorsformat, tokenizer, and a standalone launch script are available with no usage restrictions.
What you can do
- Use as a base for fine-tuning: Further train the model on human-verified parallel corpora to correct synthetic data errors.
- Integrate into an offline translator or bot: Deploy this lightweight model (242M parameters) for batch translation of short messages between Ugandan languages.
Example
import sys
from huggingface_hub import snapshot_download
folder = snapshot_download("amDANIEL2024/nkya_base")
sys.path.insert(0, folder)
from nkya import Translator
t = Translator(folder)
print(t.translate("", "nyn2lgg"))Read more
DetailsMetrics at step 15,133: validation loss of 1.725 (perplexity 5.6) on tulati and loss of 3.273 (perplexity 26.4) on SALT dev.
Training: trained on the tulati dataset (1,531,304 lines of machine translation from Sunbird/translate-nllb-1.3b-salt), stopped early at step 15,133 out of 8 planned epochs on a single Kaggle T4 GPU.
Limitations: does not support
AutoModel from transformers (requires the nkya.py script); unsuitable for long texts (>128 tokens) or medical and legal documents without human review.









Comments