Instructions to use BeardedMonster/gemma-3-1b-translate-rl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BeardedMonster/gemma-3-1b-translate-rl 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-translate-rl")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BeardedMonster/gemma-3-1b-translate-rl", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 5,209 Bytes
a11ce2a e84b47d a11ce2a e84b47d ab51eaa e84b47d ab51eaa a11ce2a 3a421d1 a11ce2a 3a421d1 a11ce2a ab51eaa a11ce2a ab51eaa a11ce2a 3a421d1 a11ce2a ab51eaa a11ce2a 3a421d1 a11ce2a ab51eaa a11ce2a d2a92f4 ab51eaa a11ce2a 3a421d1 a11ce2a 3a421d1 e84b47d a11ce2a 3a421d1 a11ce2a 3a421d1 a11ce2a ab51eaa a11ce2a ab51eaa a11ce2a ab51eaa a11ce2a a93919a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | ---
library_name: transformers
pipeline_tag: translation
language:
- en
- yor
- hau
- ibo
- pcm
- efi
- twi
- ewe
- fon
- wol
- swh
- kin
- som
- orm
- amh
- tir
- lug
- lin
- zul
- xho
- afr
- sna
- nya
- sot
- tsn
- mlg
- ibb
- urh
- bem
- tum
- run
- ven
- tso
- nso
- ssw
- nbl
- nde
- sag
- tiv
- umb
- kmb
- mos
- kik
- luo
- kam
- bin
- dag
- oke
- shi
- dyu
- bam
- kbp
- bbj
- kon
- kea
- fat
- knc
- gaa
- kab
- nus
- swc
- lua
- kqn
- lun
- iso
- loz
- wal
- ach
- tsc
- vmw
- kua
- seh
- nyn
- her
- yao
- sid
- ndc
- men
- kri
- luy
- ish
- dua
- bas
- wes
- tzm
- ful
- guw
- lue
- tll
- zne
- lub
- crs
- mfe
- rnd
- nyk
- kwn
- ndo
- dje
- ada
- arz
- sop
- mgr
- koo
- cjk
- cop
- dop
- bum
- nba
- nyu
- dik
- cce
- chw
- ttj
- lam
- nup
- taq
- alz
- toi
- ber
- zgh
- aar
- bci
- ary
- aeb
- teo
- adh
base_model: google/gemma-3-1b-it
license: other
tags:
- translation
- african-languages
- gemma3
- en2african
- grpo
- archive
---
**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-translate-rl
**What this is.** An archive of earlier checkpoints of our Gemma-3-1B English to African-language translator. It covers 125 language tags and goes from English into African languages only. Each branch holds one set of weights, and `main` holds only this README.
**For normal use, take the final model instead: [`BeardedMonster/gemma-3-1b-translate-best`](https://huggingface.co/BeardedMonster/gemma-3-1b-translate-best).** Its card has the prompt format, code and full per-language results.
The final model scores chrF++ 35.28 on FLORES+ devtest (54 languages, greedy decoding) and AfriCOMET 0.681 (40 languages).
## Branches
| branch | what it is | status |
|---|---|---|
| `latest-m1` | Later checkpoint of the same RL run as the final model; not separately evaluated | earlier RL checkpoint, superseded by the final model |
| `dpo-trial` | Two models in folders `modelA/` and `modelB/` | experimental preference-tuning trial, not recommended |
| `main` | README only | no weights |
The final model is published as `BeardedMonster/gemma-3-1b-translate-best` and is not copied into a branch here.
## How to load a branch
The prompt is one user turn with two spaces after the colon. Use the language **name**, never the ISO code. The model answers with one language tag, then the translation.
```python
import re, torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "BeardedMonster/gemma-3-1b-translate-rl"
tok = AutoTokenizer.from_pretrained("BeardedMonster/gemma-3-1b-translate-best")
model = AutoModelForCausalLM.from_pretrained(repo, revision="latest-m1", dtype=torch.bfloat16).cuda().eval()
# for the trial models: revision="dpo-trial", subfolder="modelA" (or "modelB")
msgs = [{"role": "user", "content": "Translate the text to Yoruba: Good morning, how are you?"}]
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=256, do_sample=False)
raw = tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True) # "<yor> ..."
print(re.sub(r"^<[a-z]{3}>\s*", "", raw.strip()))
```
## Training summary
1. Base model: `google/gemma-3-1b-it`, with 125 single-token language tags `<iso>` (for example `<yor>`, `<ibo>`, `<nso>`).
2. SFT on English to African-language parallel and instruction data.
3. RL (GRPO) with a reference-free quality-estimation reward.
The card of the final model has the full details.
## Intended use and limitations
This repo is an archive of earlier checkpoints, kept so the runs can be reproduced. Use `BeardedMonster/gemma-3-1b-translate-best` for translation.
* English to African language only. Other source languages and reverse directions are not trained.
* Twenty tags have no SFT data and cannot be translated.
* Some low-resource languages, such as Kanuri, Tamasheq, Dinka and the Arabic dialects, give rough drafts.
* Translate one sentence or a short paragraph at a time. Split long documents into sentences.
* Automatic metrics only, no human evaluation.
* These are machine translations. Have them checked before using them where errors matter, such as 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](https://ai.google.dev/gemma/terms) and Prohibited Use Policy also apply.
|