Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DziriNames

Arabic ↔ Latin transliteration of Maghrebi names — Algerian-first, retrieval-first, measured.

One name goes in (Arabic or Latin script); a scored list of plausible spellings comes out in the other script. Built for identity matching and compliance screening on Maghrebi — especially Algerian — names, where generic Arabic transliterators quietly fail.

▶ Try it live: https://huggingface.co/spaces/yacinebenak/dzirinames-demo

زين الدين      →  Zineddine   (rank 1)
عبد القادر     →  Abdelkader  — not "Abdul Al-Qadir"
ياسين بن أقموم →  Yacine Benakmoume

Why this exists

Sanctions-screening and KYC tools transliterate Arabic names using Mashreq (Middle-Eastern) conventions: عبد القادر becomes Abdul Al-Qadir. But Algerian civil status — shaped by a century of French administrative orthography — writes Abdelkader. شريف is Cherif, not Sharif. زين الدين is Zineddine, not Zayn Al-Din. Screening systems trained on Mashreq data mismatch millions of Maghrebi identities.

No public benchmark existed for this problem. This project ships one — 1,941 Arabic keys with civil-status Latin references from real Algerian data — plus a small model and a production-grade service that solve it measurably.

How it works

Retrieval first, generation as fallback. The service queries an index of 369,230 attested Arabic keys (440,644 Latin spellings) built from openly licensed Algerian and world name corpora. Only names absent from the index fall through to a 5.5M-parameter seq2seq transformer.

This design is the project's central measured finding: on this task, looking up attested spellings beats generating them — the index path is ×1.9 better in quality and serves a known name in 0.03 ms versus 322 ms (median, p95 528 ms) for the model path, on CPU. On the 1,941-key benchmark, the index covers 98.7 % of keys.

The model itself is deliberately small: 5.55M parameters, 22 MB, fp32, CPU-only (d_model 256, 3 layers, ff 1024). No GPU anywhere in production.

Results

Model-only recall on the DZ benchmark (1,941 Algerian keys, Arabic→Latin, composed references, French convention, @10 — σ ≈ 1.1 pt), and on a 2,400-key world test set:

Model DZ ar→lat @10 World ar→lat @10 Notes
mag_ft_lr1e-4 79.5 % 63.1 % default — pure Maghrebi fine-tune; best on target (+3.4 pts vs mix50, McNemar p = 2.7e-09)
mag_mix50 76.1 % 72.9 % fallback when world coverage matters — only fine-tune above the world floors
rebal_f2 68.5 % 73.8 % pre-fine-tune baseline

Through the full service (index + model), the numbers stop depending on the model at all: the index serves 98.7 % of benchmark keys, and all evaluated models return identical results on the covered keys. The frozen non-regression suite passes 26/27 via the service. A stdlib-only reranker adds +5.3 pts @10 on the generated path (77.5 → 82.8, McNemar p = 1.05e-11) at 1.6 ms per name.

Quickstart

pip install -r requirements.txt
python download_weights.py        # fetches weights + index (~95 MB) from Hugging Face
python src/api.py --port 8000     # service + demo page at http://localhost:8000/

Or straight from the command line:

python src/nmt_generate.py "ياسين بن أقموم" --model models/mag_ft_lr1e-4/best.pt   # Arabic → Latin
python src/nmt_generate.py "Yacine Benakmoume" --model models/mag_ft_lr1e-4/best.pt # Latin → Arabic

HTTP API: POST /variants (single name), POST /variants/batch (up to 256), GET /sante (health). FastAPI + uvicorn if installed, pure-stdlib fallback otherwise. Runs in ~1.3 GB RSS.

To reproduce the frozen suite: python tools/non_regression_service.py — expected 26/27 (the known miss is a Mohamed/Mahmoud separation case), and the script exits non-zero on any miss by design.

Note: CLI flags and internal docs are in French (--modele, /sante) — the project grew up bilingual. The demo page and this README are the English surface.

The benchmark

benchmark/eval_dz.jsonl — 1,941 distinct Arabic keys, 3,480 accepted Latin references (per-word composition for 595 compound names), drawn exclusively from two openly licensed corpora of real Algerian names and hand-reviewed (295 couples adjudicated; reference error rate of the source measured at 0.20 %). No spelling was invented: every reference is attested in the source data. Full lineage in benchmark/PROVENANCE.md; the build is deterministic (fixed seed, byte-identical rebuilds).

{"ar": "آدم نسيم", "refs": ["adem nassim"], "refs_mots": [["adem"], ["nassim", "nassime", "noussim"]], ...}

These are registers of onomastic forms only — no birth dates, no addresses, no identifying attributes.

What we measured so you don't have to

Negative results, all obtained on this task and kept because they save others the compute:

  • Bigger models don't help. 5.6M / 16.6M / 44.2M parameters give the same recall; the large one is 4.3× slower for nothing.
  • ByT5-small (300M) loses by 33 points to the 5.6M in-house model (45 % vs 78 % @20). A model 54× smaller wins.
  • bf16 diverges on this architecture (validation loss 2.5 → 46). fp32 required.
  • Large batches degrade at constant epoch budget.
  • Fine-tuning on Maghrebi data without world replay costs −10.7 pts on world recall; 50 % replay is the setting that holds both, pure fine-tune wins on a Maghreb-only target.
  • Generation loses to retrieval (×1.9 quality, ×500 speed) — hence the architecture.

Known limits

The open problem is vocalization: Arabic omits short vowels, so out-of-index names force the model to guess them (أحلام → Ahlam / Ahlem, both attested). Vowel errors account for 59 % of remaining failures (235/397); fusing them entirely would be worth ~+12 pts. This is the current research target.

License & attribution

Code, model weights and index: MIT © 2026 Yacine BENAKMOUME.

The benchmark derives exclusively from two openly licensed datasets, both permitting commercial use — please carry this attribution forward:

Algerian names and surnames dataset — Youcef Amoura (rykerdz), Kaggle, 2024, MIT. https://www.kaggle.com/datasets/rykerdz/algerian-names-and-surnames-dataset

Algerian Name Transcription Corpus — Taha Zerrouki (linuxscout), CC0-1.0. https://github.com/linuxscout/algerian-name-transcription-corpus

World-coverage training data derive from Wikidata-based corpora (CC0).

Citation

@misc{benakmoume2026dzirinames,
  author = {Benakmoume, Yacine},
  title  = {DziriNames: a benchmark and retrieval-first system for Arabic--Latin transliteration of Maghrebi names},
  year   = {2026},
  url    = {https://github.com/ElphenomenoCoding/DziriNames}
}

Live demo: https://huggingface.co/spaces/yacinebenak/dzirinames-demo · Weights & index: https://huggingface.co/yacinebenak/DziriNames · Benchmark: https://huggingface.co/datasets/yacinebenak/dzirinames-benchmark

About

Arabic <-> Latin transliteration of Maghrebi names - Algerian-first, retrieval-first, measured. Ships a 1,941-key benchmark from real Algerian civil-status data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages