Instructions to use BeardedMonster/gemma-3-1b-rl-translate-best with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BeardedMonster/gemma-3-1b-rl-translate-best with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("translation", model="BeardedMonster/gemma-3-1b-rl-translate-best")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BeardedMonster/gemma-3-1b-rl-translate-best") model = AutoModelForCausalLM.from_pretrained("BeardedMonster/gemma-3-1b-rl-translate-best", device_map="auto") - Notebooks
- Google Colab
- Kaggle
License: Free for commercial use, with required attribution to the author's work. If you use this model, or text it generated, in a product, service or publication, credit "Translation models by Aletheia AI" and cite the accompanying paper. This model is a derivative of Google Gemma 3, so the Gemma Terms of Use and Prohibited Use Policy also apply.
gemma-3-1b-rl-translate-best
What this is. An identical copy (same weights) of BeardedMonster/gemma-3-1b-translate-best, the best general-purpose English to African-language translator of this model family at the 1B scale: Gemma-3-1B-it fine-tuned with SFT and then GRPO reinforcement learning, English to African language only, 125 language tags (105 with SFT data; 20 without). The card of gemma-3-1b-translate-best has the full 125-language table and the longer comparison; this card repeats the quick start and the per-language table so that it works on its own.
Headline (FLORES+ devtest, 54 languages, greedy): chrF++ 35.28, spBLEU 14.03, AfriCOMET 0.681 (40 languages); NTREX-128 40.05 (24 languages), MAFAND-MT 44.21 (15 languages). Against other systems: above NLLB-200-distilled-600M (37.93 against 35.94 on 44 shared FLORES+ languages), below NLLB-200-3.3B (38.09) and below TranslatePsy-AfriSLM-0.8B on its 19 languages (45.18 against 45.27).
Quick start
One user turn (two spaces after the colon):
Translate the text to {Language name}: {English text}
Example: Translate the text to Yoruba: Good morning, how are you?
Rendered with the chat template:
<bos><start_of_turn>user
Translate the text to Yoruba: Good morning, how are you?<end_of_turn>
<start_of_turn>model
The model answers with the language tag as ONE token, then the translation, then <end_of_turn>:
<yor> {Yoruba translation}<end_of_turn>
The tag tokens (<yor>, <hau>, ...) are ordinary (non-special) vocabulary entries, so skip_special_tokens=True keeps them; remove the leading tag yourself (re.sub(r"^<[a-z]{3}>\s*", "", text)).
- Use the language name from the table below in the prompt (
Yoruba), never the ISO code. The tag in the answer is only an output marker. - Decoding: greedy (
do_sample=False/temperature=0),max_new_tokens=256for a sentence or short paragraph (the benchmarks below used 768). Optional in vLLM:frequency_penalty=0.1as a guard against repetition loops on long inputs. - English to African language only. One sentence or a short paragraph per prompt; split long documents into sentences.
Code
Transformers
import re, torch
from transformers import AutoTokenizer, AutoModelForCausalLM # transformers >= 4.56; older versions: torch_dtype=
repo = "BeardedMonster/gemma-3-1b-rl-translate-best"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).cuda().eval()
def translate(text, language, max_new_tokens=256):
msgs = [{"role": "user", "content": f"Translate the text to {language}: {text}"}] # two spaces after the colon
enc = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to("cuda")
with torch.no_grad():
out = model.generate(**enc, max_new_tokens=max_new_tokens, do_sample=False)
raw = tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True) # "<yor> ..."
return re.sub(r"^<[a-z]{3}>\s*", "", raw.strip())
print(translate("Good morning, how are you?", "Yoruba"))
# one sentence into five languages
for language in ["Yoruba", "Hausa", "Igbo", "Swahili", "Zulu"]:
print(language, "->", translate("The meeting starts at nine tomorrow.", language))
vLLM
import re
from vllm import LLM, SamplingParams
repo = "BeardedMonster/gemma-3-1b-rl-translate-best"
llm = LLM(repo, dtype="bfloat16", max_model_len=4096)
tok = llm.get_tokenizer()
def build(language, text):
msgs = [{"role": "user", "content": f"Translate the text to {language}: {text}"}]
return tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)
sentence = "The meeting starts at nine tomorrow."
languages = ["Yoruba", "Hausa", "Igbo", "Swahili", "Zulu"]
params = SamplingParams(temperature=0, max_tokens=256, frequency_penalty=0.1) # greedy; the penalty is optional
outs = llm.generate([build(l, sentence) for l in languages], params) # one batch, five languages
for language, o in zip(languages, outs):
print(language, "->", re.sub(r"^<[a-z]{3}>\s*", "", o.outputs[0].text.strip()))
OpenAI-compatible server: vllm serve BeardedMonster/gemma-3-1b-rl-translate-best --max-model-len 4096, then send the same user message to /v1/chat/completions with temperature=0.
Languages
125 tags exist; 20 have no SFT data and cannot be translated (ibb bin dag bbj fat gaa her men luy ish dua wes ber zgh aar bci ary aeb teo adh). The full table (name, tag, script, training data, chrF++) is in the card of gemma-3-1b-translate-best. The 58 languages with benchmark numbers are listed below.
Per-language performance of this model
Best five FLORES+ languages by chrF++: Afrikaans 65.6, Swahili 62.0, Zulu 52.9, Sepedi 51.7, Hausa 50.2. Weakest five: Kanuri 14.7, Tunisian Arabic 15.9, Standard Moroccan Tamazight 16.1, Tamasheq 16.5, Dinka 18.3. (Languages with no SFT data, aeb, ary, zgh, are among the weakest; the Arabic dialects, Tamazight and Kanuri produce output with the wrong tag.)
Main numbers are greedy, no frequency penalty. The column "freq. pen. 0.1" is the same model decoded with vLLM frequency_penalty=0.1 (macro FLORES+ chrF++ 35.40, AfriCOMET 0.682, against 35.28 and 0.681); the penalty barely matters after RL.
| Language (tag) | FLORES+ chrF++ | FLORES+ chrF++, freq. pen. 0.1 | FLORES+ spBLEU | FLORES+ AfriCOMET | NTREX chrF++ | MAFAND chrF++ | MAFAND rows clean / all |
|---|---|---|---|---|---|---|---|
Afrikaans (afr) |
65.60 | 65.58 | 45.58 | 0.794 | 67.23 | n/a | n/a |
Amharic (amh) |
34.53 | 34.44 | 24.60 | 0.729 | 22.70 | 21.48 | 1,014 / 1,037 |
Bambara (bam) |
30.20 | 30.23 | 8.39 | 0.586 | n/a | n/a | n/a |
Bemba (bem) |
37.81 | 37.91 | 12.35 | 0.637 | 38.20 | n/a | n/a |
Chichewa (nya) |
45.44 | 45.45 | 18.02 | 0.710 | 48.30 | 44.72 | 1,003 / 1,004 |
Chokwe (cjk) |
24.97 | 25.07 | 3.80 | n/a | n/a | n/a | n/a |
Dinka (dik) |
18.26 | 19.36 | 3.73 | n/a | n/a | n/a | n/a |
Dyula (dyu) |
20.62 | 20.62 | 3.44 | n/a | n/a | n/a | n/a |
Egyptian Arabic (arz) |
21.80 | 22.09 | 6.19 | n/a | n/a | n/a | n/a |
Ewe (ewe) |
33.60 | 33.53 | 11.32 | 0.658 | 33.32 | n/a | n/a |
Fon (fon) |
22.95 | 22.90 | 5.70 | 0.621 | n/a | n/a | n/a |
Hausa (hau) |
50.16 | 50.19 | 26.09 | 0.719 | 50.92 | 34.76 | 1,498 / 1,500 |
Igbo (ibo) |
41.92 | 41.94 | 21.24 | 0.702 | 46.20 | 49.35 | 1,458 / 1,500 |
Kabiye (kbp) |
27.23 | 27.34 | 7.93 | 0.697 | n/a | n/a | n/a |
Kabuverdianu (kea) |
38.00 | 38.08 | 16.06 | n/a | n/a | n/a | n/a |
Kabyle (kab) |
30.28 | 30.32 | 10.16 | 0.705 | n/a | n/a | n/a |
Kamba (kam) |
27.15 | 27.19 | 7.09 | 0.537 | n/a | n/a | n/a |
Kanuri (knc) |
14.69 | 15.80 | 2.49 | n/a | n/a | n/a | n/a |
Kikuyu (kik) |
35.05 | 35.11 | 12.41 | 0.698 | n/a | n/a | n/a |
Kimbundu (kmb) |
27.27 | 27.44 | 4.99 | 0.520 | n/a | n/a | n/a |
Kinyarwanda (kin) |
44.62 | 44.67 | 20.16 | 0.732 | 41.70 | 52.00 | 1,005 / 1,006 |
Kirundi (run) |
38.21 | 38.27 | 14.41 | 0.711 | n/a | n/a | n/a |
Lingala (lin) |
48.26 | 48.33 | 19.36 | 0.684 | n/a | n/a | n/a |
Luba-Kasai (lua) |
35.55 | 35.61 | 9.29 | 0.612 | n/a | n/a | n/a |
Luganda (lug) |
35.96 | 35.98 | 10.23 | 0.641 | n/a | 45.68 | 1,500 / 1,500 |
Luo (luo) |
37.35 | 37.40 | 12.87 | 0.712 | n/a | 36.79 | 1,500 / 1,500 |
Makhuwa (vmw) |
27.51 | 27.81 | 6.14 | n/a | n/a | n/a | n/a |
Malagasy (mlg) |
49.05 | 49.05 | 22.64 | 0.724 | 44.92 | n/a | n/a |
Mauritian Creole (mfe) |
43.46 | 43.53 | 17.79 | n/a | n/a | n/a | n/a |
Moroccan Arabic (ary) |
21.27 | 21.35 | 6.55 | n/a | n/a | n/a | n/a |
Mossi (mos) |
24.83 | 24.86 | 5.46 | 0.594 | n/a | n/a | n/a |
North Ndebele (nde) |
n/a | n/a | n/a | n/a | 34.35 | n/a | n/a |
Nuer (nus) |
25.23 | 25.30 | 9.29 | 0.639 | n/a | n/a | n/a |
Oromo (orm) |
35.19 | 35.23 | 9.09 | 0.694 | 30.95 | n/a | n/a |
Pidgin (pcm) |
n/a | n/a | n/a | n/a | n/a | 51.52 | 1,562 / 1,564 |
Sango (sag) |
35.85 | 35.81 | 10.03 | n/a | n/a | n/a | n/a |
Sena (seh) |
30.53 | 30.60 | 5.93 | n/a | n/a | n/a | n/a |
Sepedi (nso) |
51.66 | 51.71 | 26.91 | 0.730 | 34.34 | n/a | n/a |
Sesotho (sot) |
46.14 | 46.16 | 20.57 | 0.694 | n/a | n/a | n/a |
Setswana (tsn) |
48.28 | 48.32 | 24.61 | 0.720 | 52.84 | 55.18 | 1,500 / 1,500 |
Shona (sna) |
42.27 | 42.25 | 17.52 | 0.682 | 43.95 | 36.81 | 1,004 / 1,005 |
Somali (som) |
42.50 | 42.49 | 17.19 | 0.684 | 46.45 | n/a | n/a |
Standard Moroccan Tamazight (zgh) |
16.13 | 16.48 | 4.14 | n/a | n/a | n/a | n/a |
Swahili (swh) |
62.03 | 61.93 | 40.73 | 0.765 | 62.44 | 54.87 | 1,822 / 1,835 |
Swati (ssw) |
40.31 | 40.40 | 15.18 | 0.670 | 41.05 | n/a | n/a |
Tachelhit (shi) |
n/a | n/a | n/a | n/a | 1.19 | n/a | n/a |
Tamasheq (taq) |
16.46 | 17.92 | 2.35 | n/a | n/a | n/a | n/a |
Tigrinya (tir) |
22.25 | 22.29 | 12.58 | 0.733 | 19.93 | n/a | n/a |
Tsonga (tso) |
50.14 | 50.18 | 25.45 | 0.716 | n/a | n/a | n/a |
Tumbuka (tum) |
38.41 | 38.41 | 13.78 | 0.681 | n/a | n/a | n/a |
Tunisian Arabic (aeb) |
15.90 | 16.34 | 4.55 | n/a | n/a | n/a | n/a |
Twi (twi) |
38.46 | 38.54 | 15.12 | 0.688 | n/a | 36.47 | 1,500 / 1,500 |
Umbundu (umb) |
27.49 | 27.46 | 3.79 | 0.595 | n/a | n/a | n/a |
Venda (ven) |
n/a | n/a | n/a | n/a | 42.40 | n/a | n/a |
Wolof (wol) |
32.24 | 32.30 | 12.21 | 0.679 | 32.45 | n/a | n/a |
Xhosa (xho) |
49.30 | 49.34 | 25.11 | 0.687 | 44.87 | 58.33 | 1,001 / 1,002 |
Yoruba (yor) |
31.97 | 31.98 | 15.06 | 0.734 | 33.66 | 35.99 | 1,550 / 1,558 |
Zulu (zul) |
52.88 | 52.90 | 29.92 | 0.734 | 46.84 | 49.20 | 998 / 998 |
How measured. FLORES+ devtest (openlanguagedata/flores_plus, 54 languages), NTREX-128 (24 languages) and MAFAND-MT (15 languages); greedy decoding; sacreBLEU chrF++ (word_order=2) and spBLEU (flores200 tokenizer); AfriCOMET = masakhane/africomet-stl-1.1 (reference-based, held out of the RL reward), available for 40 FLORES+ languages.
Training summary
- Base model.
google/gemma-3-1b-itwith 125 single-token language tags (<yor>,<ibo>,<nso>, ...) in the tokenizer. - SFT on language-stratified 4,096-token packs, 131,072 tokens per step, Muon plus AdamW, fp32 master weights.
- RL (GRPO): group of 16 (15 samples + the greedy member), learning rate 2e-6, KL 0.05, KL guard 0.15, Muon, dynamic sampling, beam guide on 25% of prompts.
Data disclosures
RL data and reward. Prompts: English text from FineWeb-Edu, Wikipedia and news sources (BBC News 2017-2025, a C4-BBC subset, Wikinews, Global Voices, Wikivoyage), used only as model input, never as a training target. Reward: reference-free QE ensemble (masakhane/africomet-qe-stl-1.1, McGill-NLP/ssa-comet-mtl without reference), consensus agreement among samples, language-ID / copy / repetition / length guards, constraint anchors, and (385M recipe, not re-confirmed for the 1B) a chrF++ term against human reference pairs from AfriScience-MT train (Apache-2.0) and IbomMT train for a few languages. The 1B RL used no NLLB-3.3B pseudo-reference signal. No TranslatePsy data and no Gemini output entered this model.
Intended use and limitations
Use: English to African-language translation of short texts (a sentence or a short paragraph). See the card of gemma-3-1b-translate-best for the comparison with NLLB, TranslatePsy and AfriqueLLM.
- English to African language only. Other source languages and reverse directions are not supported.
- Twenty tags have no SFT data (listed above): the model cannot translate them. RL cannot add a language it never saw.
- Weak languages. Kanuri, Tamasheq, Dinka, Standard Moroccan Tamazight, the Arabic dialects, Chokwe, Dyula, Tigrinya, Egyptian Arabic and Fon score chrF++ below 25; Tachelhit (
shi) scores 1.2 on NTREX although the tag has SFT data. Treat output in these as a rough draft at best. - Short inputs. RL prompts were capped at 256 source tokens; long inputs were not RL-trained. Repetition loops and omissions grow with input length. Split documents into sentences.
- Automatic metrics only. No human evaluation was done. AfriCOMET (held out, same model family as one RL reward member) and chrF++ are imperfect, especially for the lowest-resource languages.
- Outputs are machine translations without human verification; review them before use where errors matter (for example medical, legal or safety-critical text).
Citation and licence
Paper in preparation
@misc{Gemma_mt_2026,
title = {English-to-African-language translation with small Gemma-3 models: supervised fine-tuning and reinforcement learning},
author = {{AletheiaAI}},
year = {2026},
}
Licence. license: other (commercial-use-with-attribution). Commercial and non-commercial use, modification and redistribution are allowed, with required attribution: credit "Translation models by Aletheia AI" and cite the accompanying paper. These weights are a derivative of Google Gemma 3, so the Gemma Terms of Use and Prohibited Use Policy also apply. The training data sources are listed under "Data disclosures".
- Downloads last month
- 30