Qwen2.5-1.5B-Arabizi-MSA-Transliterator (v1.0)
A compact phonetic transliteration model fine-tuned from Qwen/Qwen2.5-1.5B-Instruct to convert Latin-script Arabic (Arabizi / Franco-Arabic) and phonetic Modern Standard Arabic (MSA) into native Arabic script (salam -> سلام).
Designed for typing Arabic on standard QWERTY keyboards without an Arabic layout, as well as preprocessing noisy chat or social media text for downstream Arabic NLP pipelines.
Key Capabilities
- Unified MSA + Multi-Dialect Coverage: Handles Modern Standard Arabic alongside Maghrebi (Moroccan/Tunisian/Algerian), Egyptian, Levantine, and Gulf dialects.
- Context-Aware Orthography: Resolves phonetic digits (
3->ع,7->ح,9/q->ق), ta marbuta (ة), and hamza placement using sentence context. - Zero-Filler Output: Returns native Arabic script directly without conversational preamble.
Evaluation Results (v1.0)
Evaluated on the held-out stratified multi-dialect test split of medievalo/arabizi-msa-transliteration (covering MSA, Egyptian, Levantine, Maghrebi, and Gulf):
| Model | Character Error Rate (CER) | chrF++ |
|---|---|---|
Qwen/Qwen2.5-1.5B-Instruct (Zero-Shot) | 0.7206 | 16.25 |
medievalo/Qwen2.5-1.5B-Arabizi-MSA-Transliterator (v1.0) | 0.2947 | 40.74 |
Quickstart Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "medievalo/Qwen2.5-1.5B-Arabizi-MSA-Transliterator"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
messages = [
{
"role": "system",
"content": (
"Transliterate the following Latin/Arabizi text into natural Arabic script. "
"Preserve Modern Standard Arabic or the speaker's regional dialect accurately, "
"and output only the Arabic text."
),
},
{"role": "user", "content": "3afak sift liya l'adresse dyal dar"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
# Output: عافاك سيفت ليا الAdresse ديال دار
Training Details
- Base Model:
Qwen/Qwen2.5-1.5B-Instruct - Training Data: ~36,000 parallel Latin-to-Arabic pairs (
medievalo/arabizi-msa-transliteration) combining public multi-dialect Arabizi corpora and synthetic phonetic MSA pairs. - Method: LoRA (
r=16,lora_alpha=32, all linear projection layers) trained for 1 epoch (lr=2e-4, cosine schedule, effective batch size 32) and merged into FP16 weights. - Final Validation Loss:
0.8018(84.54%mean token accuracy).
Known Limitations (v1.0)
- MSA Short-Vowel Over-Insertion: Because the v1.0 synthetic MSA training split stripped short vowel marks (tashkeel) prior to Latin conversion, typing explicit short vowels in formal MSA (
kayfa 7aluka,uridu) can occasionally insert extra long vowels (كيفا حلوك,اوردي). Planned for v1.1 using vocalized MSA training pairs. - Outputs unvocalized Arabic script.