Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
base_model: google/gemma-4-E4B-it
|
| 4 |
+
datasets:
|
| 5 |
+
- UBC-NLP/alexandria
|
| 6 |
+
language:
|
| 7 |
+
- ar
|
| 8 |
+
- en
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
tags:
|
| 11 |
+
- translation
|
| 12 |
+
- dialectal-arabic
|
| 13 |
+
- machine-translation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# alexmt-gemma4-e4b-dpo-bwspbleu-lr5e6
|
| 17 |
+
|
| 18 |
+
Context-aware English ↔ dialectal Arabic translation for conversational turns, trained on
|
| 19 |
+
[Alexandria](https://huggingface.co/datasets/UBC-NLP/alexandria).
|
| 20 |
+
|
| 21 |
+
DPO (beta 0.1, lr 5e-6, 3 epochs, effective batch 32) on top of alexmt-gemma4-e4b-sft.
|
| 22 |
+
|
| 23 |
+
**Preference pairs.** The SFT model generated 5 candidates (1 greedy + 4 sampled) for each source turn of a train fold held out from SFT. Candidates were ranked by sentence spBLEU against the human reference; chosen = best, rejected = worst (both are model outputs; the reference is only the yardstick).
|
| 24 |
+
|
| 25 |
+
**Data.** Alexandria train split, 9 varieties (EG, JO, LB, MR, OM, PS, SA, SY, YE), both
|
| 26 |
+
directions. The train split is divided into 5 conversation-level folds; SFT uses folds 1-4,
|
| 27 |
+
and fold 0's source turns feed the preference pairs. Each example includes up to 3 prior turns
|
| 28 |
+
as context, the domain, the participants, and the speaker/addressee gender direction.
|
| 29 |
+
|
| 30 |
+
## Results
|
| 31 |
+
|
| 32 |
+
Alexandria **public test split**, 9 varieties, macro-average over varieties; greedy decoding,
|
| 33 |
+
max 128 new tokens, our own prompt/decoding setup (not the Alexandria paper's).
|
| 34 |
+
|
| 35 |
+
| model | en→dialect spBLEU | chrF++ | len/ref | dialect→en spBLEU | chrF++ | len/ref |
|
| 36 |
+
|---|---|---|---|---|---|---|
|
| 37 |
+
| alexmt-gemma4-e4b-sft | 29.06 | 44.10 | 0.99 | 50.61 | 65.81 | 0.98 |
|
| 38 |
+
| alexmt-gemma4-e4b-dpo-bwspbleu-lr5e7 | 29.27 | 44.31 | 0.99 | 51.14 | 66.22 | 0.98 |
|
| 39 |
+
| alexmt-gemma4-e4b-dpo-bwspbleu-lr2e6 | 30.12 | 45.24 | 1.01 | 53.14 | 67.55 | 0.99 |
|
| 40 |
+
| alexmt-gemma4-e4b-dpo-bwspbleu-lr5e6 **(this model)** | 31.20 | 46.02 | 1.00 | 54.53 | 68.33 | 0.99 |
|
| 41 |
+
|
| 42 |
+
**Please read these before comparing:** single training seed; one data fold; the DPO learning
|
| 43 |
+
rate was compared on the test split itself (a held-out-dev selection is in progress), so small
|
| 44 |
+
differences between the DPO rows are not established. Scores come from this setup and are not
|
| 45 |
+
directly comparable to the Alexandria paper's tables (zero-shot models, different decoding) or to
|
| 46 |
+
the AlexandriaX shared task (a different, private test set). Only overlap metrics (spBLEU,
|
| 47 |
+
chrF++) have been computed; dialect fidelity has not been evaluated.
|
| 48 |
+
|
| 49 |
+
**Files.** `model-kv-shared-unused.safetensors` holds the k/v projections and k-norms of layers 24-41, which Gemma-4-E4B shares from earlier layers and never uses in the forward pass. transformers omits them on save; they are copied unchanged from the base model so that vLLM (which loads strictly) can load this checkpoint. `processor_config.json` is also copied from the base model for the same reason.
|
| 50 |
+
|
| 51 |
+
## Usage
|
| 52 |
+
|
| 53 |
+
The model expects Alexandria's JSON prompt as a single user turn and answers with
|
| 54 |
+
`{"translation": "..."}`. Apply the tokenizer's chat template with `add_generation_prompt=True`, enable_thinking=False.
|
| 55 |
+
|
| 56 |
+
```text
|
| 57 |
+
Translate the given turn of a conversation from English to Egyptian Arabic (Cairene) Dialect, considering the previous context if provided.
|
| 58 |
+
|
| 59 |
+
Input: {"country": "EG", "domain": "Agriculture and farming", "participants": ["Waterresourcemanager", "Farmer"], "context": [], "current_turn": {"speaker": "Waterresourcemanager", "gender_direction": "male -> male", "text": "Good morning. Is the water reaching your land properly according to the schedule?"}}
|
| 60 |
+
|
| 61 |
+
Guidelines:
|
| 62 |
+
- Return the result strictly in valid JSON.
|
| 63 |
+
- Translate to Egyptian Arabic (Cairene) Dialect using Arabic script.
|
| 64 |
+
- Do not add any code, explanations, comments, or any other extra text.
|
| 65 |
+
- Keep the meaning and tone and respect the gender direction.
|
| 66 |
+
- Consider the country, the domain, the participants, and the speaker in your translation.
|
| 67 |
+
- Only translate the "text" field of the "current_turn".
|
| 68 |
+
- If a context is provided, do not translate it, and use it to inform your translation.
|
| 69 |
+
|
| 70 |
+
Output scheme: { "translation": "translation of the text from the current turn" }
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Licence
|
| 74 |
+
|
| 75 |
+
CC BY-NC 4.0 (non-commercial), because the training data (Alexandria) is CC BY-NC 4.0.
|
| 76 |
+
The base model, Gemma-4-E4B-it is Apache-2.0 ([Gemma 4 terms](https://ai.google.dev/gemma/docs/gemma_4_license)).
|
| 77 |
+
|
| 78 |
+
## Citation
|
| 79 |
+
|
| 80 |
+
If you use this model, please cite the Alexandria dataset:
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@inproceedings{elmekki2026alexandria,
|
| 84 |
+
title = {Alexandria: A Multi-Domain Dialectal Arabic Machine Translation Dataset for Culturally Inclusive and Linguistically Diverse LLMs},
|
| 85 |
+
author = {El Mekki, Abdellah and others},
|
| 86 |
+
booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (ACL)},
|
| 87 |
+
year = {2026},
|
| 88 |
+
url = {https://aclanthology.org/2026.acl-long.1503/}
|
| 89 |
+
}
|
| 90 |
+
```
|