Motarjem v0.1 is a compact 108M-parameter, bidirectional English–Persian translation model based on
Falcon-H1-Tiny-Multilingual-100M-Instruct.
This first release is a research checkpoint trained primarily on aligned English and Iranian Persian Wikipedia articles. It is strongest on Wikipedia-like prose. General-domain translation remains a work in progress; see
Evaluation and
Limitations.
Motarjem uses three special control tokens. The prompt format is:
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "Reza2kn/Motarjem-v0.1"
5device = "cuda" if torch.cuda.is_available() else "cpu"
6dtype = torch.bfloat16 if device == "cuda" else torch.float32
7
8tokenizer = AutoTokenizer.from_pretrained(model_id)
9model = AutoModelForCausalLM.from_pretrained(
10 model_id,
11 dtype=dtype,
12 attn_implementation="sdpa",
13).to(device).eval()
14
15
16def translate(text: str, source_language: str, target_language: str) -> str:
17 if (source_language, target_language) not in {("en", "fa"), ("fa", "en")}:
18 raise ValueError("Supported directions are en->fa and fa->en")
19
20 prompt_ids = [
21 tokenizer.bos_token_id,
22 tokenizer.convert_tokens_to_ids("<|translate|>"),
23 tokenizer.convert_tokens_to_ids(f"<|{source_language}|>"),
24 *tokenizer.encode(text, add_special_tokens=False),
25 tokenizer.convert_tokens_to_ids(f"<|{target_language}|>"),
26 ]
27 input_ids = torch.tensor([prompt_ids], device=device)
28
29 with torch.inference_mode():
30 output_ids = model.generate(
31 input_ids=input_ids,
32 attention_mask=torch.ones_like(input_ids),
33 do_sample=False,
34 max_new_tokens=256,
35 eos_token_id=tokenizer.eos_token_id,
36 pad_token_id=tokenizer.pad_token_id,
37 use_cache=True,
38 )
39
40 return tokenizer.decode(
41 output_ids[0, input_ids.shape[1]:],
42 skip_special_tokens=True,
43 clean_up_tokenization_spaces=False,
44 ).strip()
45
46
47print(translate("The weather is beautiful today.", "en", "fa"))
48print(translate("امروز هوا خیلی خوب است.", "fa", "en"))
Requires a Transformers release with Falcon-H1 support; this checkpoint was trained and evaluated with transformers==4.57.1.
All scores below use greedy decoding, batch size 128, and a maximum of 256 generated tokens.
The frozen evaluation uses the 1,150 cleanly materialized rows from the deterministic 1,178-article holdout allocation.
Compared with the untuned official 100M checkpoint on this project's WMT24++ split, Motarjem v0.1 improved chrF2 from 4.13 to 21.87 for English→Persian and from 10.70 to 32.00 for Persian→English. Results from different model families may use different decoding contracts and should not be treated as a strict architecture comparison.
Always evaluate on your own domain and retain human review for consequential translations.
1@misc{falcon_h1_tiny,
2 title = {Falcon-H1-Tiny: A series of extremely small, yet powerful language models redefining capabilities at small scale},
3 author = {Falcon-LLM Team},
4 year = {2026}
5}