Instructions to use BeardedMonster/gemma-3-1b-science-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BeardedMonster/gemma-3-1b-science-sft 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-science-sft")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BeardedMonster/gemma-3-1b-science-sft") model = AutoModelForCausalLM.from_pretrained("BeardedMonster/gemma-3-1b-science-sft", 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-science-sft
What this is. The science SFT stage of the 1B science line, and the starting point of the science RL model gemma-3-1b-science-translate-best. It is the general model gemma-3-1b-translate-best (about 1B parameters) fine-tuned on AfriScience-MT windows and whole papers (amh, hau, lug, nso, yor, zul) and then averaged with its start model (theta = 0.5 x start + 0.5 x science-tuned). English to African languages only; 125 single-token language tags <iso> (20 without general SFT data, three of them with a small science top-up).
For translation use BeardedMonster/gemma-3-1b-science-translate-best, which adds the science RL stage (whole papers finish 96% of the time against 89% here on dev). Pick this SFT model as a starting point for further fine-tuning. It was evaluated on the AfriScience-MT dev split and a small general dev set only; FLORES+ devtest, NTREX, MAFAND and AfriScience-MT test were not measured for it.
Headline (dev): AfriScience-MT sentence chrF macro of 6 languages 53.52 (general model 51.07); whole-paper chrF 52.96 (general model 49.21; 89% of papers finished); general dev chrF++ macro (18 languages x 40 sentences) 43.76 (general model 43.90).
Quick start
One user turn, exactly as in training (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 (this is what the model sees):
<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 (e.g.
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). - English to African language only. One sentence or a short paragraph per prompt; for better results, split long documents into sentences.
Whole papers use the same prompt (see the science RL card); on dev 11% of papers did not finish for this model (Amharic 0.68, Luganda 0.88), so check for a missing <end_of_turn>.
Code
Transformers
import re, torch
from transformers import AutoTokenizer, AutoModelForCausalLM # transformers >= 4.56; older versions: torch_dtype=
repo = "BeardedMonster/gemma-3-1b-science-sft"
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-science-sft"
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-science-sft --max-model-len 4096, then send the same user message to /v1/chat/completions with temperature=0.
Per-language performance of this model
Best / weakest on the AfriScience dev sentences: hau 64.1 and zul 63.9 best, yor 41.4 and amh 42.4 weakest. AfriScience-MT dev, greedy, plain chrF (this model = alpha 0.5; other interpolation weights shown for reference only, they are not released here):
| Language (tag) | AfriScience dev sentence chrF: general model (a=0) | this model (a=0.5) | a=0.7 | a=1.0 | whole paper chrF: general model | this model | a=0.7 | a=1.0 | whole papers finished (this model) |
|---|---|---|---|---|---|---|---|---|---|
Amharic (amh) |
40.93 | 42.40 | 42.28 | 41.58 | 30.35 | 27.82 | 28.80 | 21.68 | 0.68 |
Hausa (hau) |
61.26 | 64.08 | 64.91 | 64.92 | 61.70 | 65.56 | 62.16 | 57.54 | 1.00 |
Luganda (lug) |
44.81 | 47.31 | 49.03 | 49.67 | 47.49 | 48.25 | 47.33 | 35.52 | 0.88 |
Sepedi (nso) |
57.23 | 62.08 | 63.30 | 63.79 | 56.30 | 62.80 | 66.06 | 64.59 | 0.92 |
Yoruba (yor) |
39.91 | 41.36 | 42.04 | 41.69 | 37.40 | 45.35 | 41.81 | 36.17 | 0.92 |
Zulu (zul) |
62.27 | 63.88 | 64.37 | 64.88 | 62.02 | 67.99 | 71.39 | 66.43 | 0.96 |
| macro (6) | 51.07 | 53.52 | 54.32 | 54.42 | 49.21 | 52.96 | 52.93 | 46.99 | 0.89 |
General dev (18 languages x 40 sentences of held-out FLORES+ dev text, greedy, chrF++ word_order=2; macro over languages):
| Language (tag) | general dev chrF++: general model (a=0) | this model (a=0.5) | diff | a=1.0 |
|---|---|---|---|---|
Yoruba (yor) |
29.34 | 30.72 | +1.39 | 29.93 |
Hausa (hau) |
50.38 | 51.44 | +1.07 | 51.34 |
Igbo (ibo) |
41.17 | 40.94 | -0.23 | 40.86 |
Twi (twi) |
38.14 | 38.33 | +0.19 | 37.04 |
Ewe (ewe) |
33.21 | 32.64 | -0.57 | 30.39 |
Fon (fon) |
21.73 | 20.94 | -0.79 | 20.71 |
Wolof (wol) |
34.80 | 34.13 | -0.67 | 33.29 |
Swahili (swh) |
59.31 | 58.02 | -1.29 | 58.61 |
Kinyarwanda (kin) |
44.81 | 44.38 | -0.44 | 39.71 |
Somali (som) |
45.39 | 45.39 | +0.00 | 44.54 |
Oromo (orm) |
35.64 | 34.67 | -0.97 | 32.31 |
Zulu (zul) |
55.92 | 55.59 | -0.33 | 53.88 |
Xhosa (xho) |
50.39 | 49.88 | -0.51 | 50.04 |
Afrikaans (afr) |
66.11 | 65.92 | -0.19 | 65.91 |
Shona (sna) |
42.12 | 41.00 | -1.11 | 39.72 |
Chichewa (nya) |
48.86 | 48.47 | -0.38 | 47.23 |
Sesotho (sot) |
45.27 | 46.06 | +0.80 | 44.50 |
Setswana (tsn) |
47.66 | 49.19 | +1.54 | 47.88 |
| macro (18) | 43.90 | 43.76 | -0.14 | 42.66 |
How measured. AfriScience-MT (Apache-2.0) dev: 843 sentences and 25 whole papers per language, greedy, sacreBLEU chrF (word_order=0). The general dev set has only 40 sentences per language, so per-language differences of a point or two are noise.
Comparison with other systems
Not measured against published systems (those are reported on AfriScience-MT test, FLORES+ devtest, NTREX and MAFAND, none of which was run for this model). Within the family (dev, same split):
| model | AfriScience dev sentence chrF | AfriScience dev whole-paper chrF (finished) | general dev chrF++ (18 languages) |
|---|---|---|---|
general model gemma-3-1b-translate-best (a=0) |
51.07 | 49.21 (0.96) | 43.90 |
| this model (SFT, a=0.5) | 53.52 | 52.96 (0.89) | 43.76 |
science RL final (gemma-3-1b-science-translate-best) |
53.54 | 55.93 (0.96) | not measured on this set |
For comparison with NLLB and others use the cards of gemma-3-1b-science-translate-best and gemma-3-1b-translate-best.
Training summary
- Base model.
gemma-3-1b-translate-best(itself fine-tuned fromgoogle/gemma-3-1b-itwith 125 single-token language tags<iso>). - Science SFT. AdamW, learning rate 3e-6, 7,168-token packs so that whole papers train intact.
- Interpolation. Weights averaged with the start model, alpha 0.5 (this repository).
- The next stage, science RL (GRPO), is not part of this model; see
gemma-3-1b-science-translate-best.
Languages
125 tags; the prompt uses the name in the first column. "SFT data: none" means the tag exists in the tokenizer but the model saw no general SFT text for it and cannot translate it. Numbers in the last two columns are of this model on small dev sets, not FLORES+ devtest.
| Name used in the prompt | Tag | Script | SFT data | chrF++ (general dev, 40 sentences) | chrF (AfriScience-MT dev, 843 sentences) |
|---|---|---|---|---|---|
| Yoruba | <yor> |
Latin | yes | 30.72 | 41.36 |
| Hausa | <hau> |
Latin | yes | 51.44 | 64.08 |
| Igbo | <ibo> |
Latin | yes | 40.94 | n/a |
| Pidgin | <pcm> |
Latin | yes | n/a | n/a |
| Efik | <efi> |
Latin | yes | n/a | n/a |
| Twi | <twi> |
Latin | yes | 38.33 | n/a |
| Ewe | <ewe> |
Latin | yes | 32.64 | n/a |
| Fon | <fon> |
Latin | yes | 20.94 | n/a |
| Wolof | <wol> |
Latin | yes | 34.13 | n/a |
| Swahili | <swh> |
Latin | yes | 58.02 | n/a |
| Kinyarwanda | <kin> |
Latin | yes | 44.38 | n/a |
| Somali | <som> |
Latin | yes | 45.39 | n/a |
| Oromo | <orm> |
Latin | yes | 34.67 | n/a |
| Amharic | <amh> |
Ethiopic (Ge'ez) | yes | n/a | 42.40 |
| Tigrinya | <tir> |
Ethiopic (Ge'ez) | yes | n/a | n/a |
| Luganda | <lug> |
Latin | yes | n/a | 47.31 |
| Lingala | <lin> |
Latin | yes | n/a | n/a |
| Zulu | <zul> |
Latin | yes | 55.59 | 63.88 |
| Xhosa | <xho> |
Latin | yes | 49.88 | n/a |
| Afrikaans | <afr> |
Latin | yes | 65.92 | n/a |
| Shona | <sna> |
Latin | yes | 41.00 | n/a |
| Chichewa | <nya> |
Latin | yes | 48.47 | n/a |
| Sesotho | <sot> |
Latin | yes | 46.06 | n/a |
| Setswana | <tsn> |
Latin | yes | 49.19 | n/a |
| Malagasy | <mlg> |
Latin | yes | n/a | n/a |
| Ibibio | <ibb> |
Latin | science top-up only (small) | n/a | n/a |
| Urhobo | <urh> |
Latin | yes | n/a | n/a |
| Bemba | <bem> |
Latin | yes | n/a | n/a |
| Tumbuka | <tum> |
Latin | yes | n/a | n/a |
| Kirundi | <run> |
Latin | yes | n/a | n/a |
| Venda | <ven> |
Latin | yes | n/a | n/a |
| Tsonga | <tso> |
Latin | yes | n/a | n/a |
| Sepedi | <nso> |
Latin | yes | n/a | 62.08 |
| Swati | <ssw> |
Latin | yes | n/a | n/a |
| South Ndebele | <nbl> |
Latin | yes | n/a | n/a |
| North Ndebele | <nde> |
Latin | yes | n/a | n/a |
| Sango | <sag> |
Latin | yes | n/a | n/a |
| Tiv | <tiv> |
Latin | yes | n/a | n/a |
| Umbundu | <umb> |
Latin | yes | n/a | n/a |
| Kimbundu | <kmb> |
Latin | yes | n/a | n/a |
| Mossi | <mos> |
Latin | yes | n/a | n/a |
| Kikuyu | <kik> |
Latin | yes | n/a | n/a |
| Luo | <luo> |
Latin | yes | n/a | n/a |
| Kamba | <kam> |
Latin | yes | n/a | n/a |
| Edo | <bin> |
Latin | none (cannot translate) | n/a | n/a |
| Dagbani | <dag> |
Latin | science top-up only (small) | n/a | n/a |
| Okpe | <oke> |
Latin | yes | n/a | n/a |
| Tachelhit | <shi> |
Latin | yes | n/a | n/a |
| Dyula | <dyu> |
Latin | yes | n/a | n/a |
| Bambara | <bam> |
Latin | yes | n/a | n/a |
| Kabiye | <kbp> |
Latin | yes | n/a | n/a |
| Ghomala | <bbj> |
Latin | none (cannot translate) | n/a | n/a |
| Kongo | <kon> |
Latin | yes | n/a | n/a |
| Kabuverdianu | <kea> |
Latin | yes | n/a | n/a |
| Fante | <fat> |
Latin | none (cannot translate) | n/a | n/a |
| Kanuri | <knc> |
Latin | yes | n/a | n/a |
| Ga | <gaa> |
Latin | none (cannot translate) | n/a | n/a |
| Kabyle | <kab> |
Latin | yes | n/a | n/a |
| Nuer | <nus> |
Latin | yes | n/a | n/a |
| Congo Swahili | <swc> |
Latin | yes | n/a | n/a |
| Luba-Kasai | <lua> |
Latin | yes | n/a | n/a |
| Kaonde | <kqn> |
Latin | yes | n/a | n/a |
| Lunda | <lun> |
Latin | yes | n/a | n/a |
| Isoko | <iso> |
Latin | yes | n/a | n/a |
| Lozi | <loz> |
Latin | yes | n/a | n/a |
| Wolaytta | <wal> |
Latin | yes | n/a | n/a |
| Acholi | <ach> |
Latin | yes | n/a | n/a |
| Tswa | <tsc> |
Latin | yes | n/a | n/a |
| Makhuwa | <vmw> |
Latin | yes | n/a | n/a |
| Kuanyama | <kua> |
Latin | yes | n/a | n/a |
| Sena | <seh> |
Latin | yes | n/a | n/a |
| Nyankore | <nyn> |
Latin | yes | n/a | n/a |
| Herero | <her> |
Latin | science top-up only (small) | n/a | n/a |
| Yao | <yao> |
Latin | yes | n/a | n/a |
| Sidamo | <sid> |
Latin | yes | n/a | n/a |
| Ndau | <ndc> |
Latin | yes | n/a | n/a |
| Mende | <men> |
Latin | none (cannot translate) | n/a | n/a |
| Krio | <kri> |
Latin | yes | n/a | n/a |
| Luyia | <luy> |
Latin | none (cannot translate) | n/a | n/a |
| Esan | <ish> |
Latin | none (cannot translate) | n/a | n/a |
| Duala | <dua> |
Latin | none (cannot translate) | n/a | n/a |
| Basaa | <bas> |
Latin | yes | n/a | n/a |
| Cameroon Pidgin | <wes> |
Latin | none (cannot translate) | n/a | n/a |
| Tamazight | <tzm> |
Latin | yes | n/a | n/a |
| Fulah | <ful> |
Latin | yes | n/a | n/a |
| Gun | <guw> |
Latin | yes | n/a | n/a |
| Luvale | <lue> |
Latin | yes | n/a | n/a |
| Tetela | <tll> |
Latin | yes | n/a | n/a |
| Zande | <zne> |
Latin | yes | n/a | n/a |
| Luba-Katanga | <lub> |
Latin | yes | n/a | n/a |
| Seychellois Creole | <crs> |
Latin | yes | n/a | n/a |
| Mauritian Creole | <mfe> |
Latin | yes | n/a | n/a |
| Ruund | <rnd> |
Latin | yes | n/a | n/a |
| Nyaneka | <nyk> |
Latin | yes | n/a | n/a |
| Kwangali | <kwn> |
Latin | yes | n/a | n/a |
| Ndonga | <ndo> |
Latin | yes | n/a | n/a |
| Zarma | <dje> |
Latin | yes | n/a | n/a |
| Adangme | <ada> |
Latin | yes | n/a | n/a |
| Egyptian Arabic | <arz> |
Arabic | yes | n/a | n/a |
| Songe | <sop> |
Latin | yes | n/a | n/a |
| Mambwe | <mgr> |
Latin | yes | n/a | n/a |
| Konzo | <koo> |
Latin | yes | n/a | n/a |
| Chokwe | <cjk> |
Latin | yes | n/a | n/a |
| Coptic | <cop> |
Coptic | yes | n/a | n/a |
| Lelemi | <dop> |
Latin | yes | n/a | n/a |
| Bulu | <bum> |
Latin | yes | n/a | n/a |
| Nyemba | <nba> |
Latin | yes | n/a | n/a |
| Nyungwe | <nyu> |
Latin | yes | n/a | n/a |
| Dinka | <dik> |
Latin | yes | n/a | n/a |
| Chopi | <cce> |
Latin | yes | n/a | n/a |
| Chuabo | <chw> |
Latin | yes | n/a | n/a |
| Tooro | <ttj> |
Latin | yes | n/a | n/a |
| Lamba | <lam> |
Latin | yes | n/a | n/a |
| Nupe | <nup> |
Latin | yes | n/a | n/a |
| Tamasheq | <taq> |
Latin | yes | n/a | n/a |
| Alur | <alz> |
Latin | yes | n/a | n/a |
| Tonga | <toi> |
Latin | yes | n/a | n/a |
| Berber | <ber> |
Latin | none (cannot translate) | n/a | n/a |
| Standard Moroccan Tamazight | <zgh> |
Tifinagh | none (cannot translate) | n/a | n/a |
| Afar | <aar> |
Latin | none (cannot translate) | n/a | n/a |
| Baoule | <bci> |
Latin | none (cannot translate) | n/a | n/a |
| Moroccan Arabic | <ary> |
Arabic | none (cannot translate) | n/a | n/a |
| Tunisian Arabic | <aeb> |
Arabic | none (cannot translate) | n/a | n/a |
| Teso | <teo> |
Latin | none (cannot translate) | n/a | n/a |
| Adhola | <adh> |
Latin | none (cannot translate) | n/a | n/a |
Intended use and limitations
Use: the science SFT checkpoint, a starting point for science RL or further fine-tuning.
- Science quality is measured for six languages on dev only; whole papers do not always finish; no test-split, FLORES+ devtest, NTREX or MAFAND numbers.
- English to African language only; 20 tags with no general SFT data cannot be translated; weak general languages as in the general card. Automatic metrics only; no human evaluation.
- Machine translations of scientific text may alter numbers, units and terms.
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.
- Downloads last month
- 84
Model tree for BeardedMonster/gemma-3-1b-science-sft
Base model
google/gemma-3-1b-pt