Fine-tuning SDAIA's ALLaM LLM to understand Arabic dialects — identify, translate to MSA, reply in-dialect. ALLaM Challenge finalist; led a 4-person team.
Python
2
1 commits
updated Jun 17, 2026
I led a 4-person team to a finalist finish in SDAIA's ALLaM Challenge (تحدي علّام — selected from 600+ participants), fine-tuning SDAIA's ALLaM LLM to bridge Modern Standard Arabic (MSA) and regional Arabic dialects: identify a dialect, translate it to MSA, and reply in-dialect.
🏆 ALLaM Challenge (تحدي علّام) · SDAIA & Tuwaiq Academy · Sep–Nov 2024 · Finalist (reached the final stage).
Why was base ALLaM weak on dialects? A root cause in its training data. Per the ALLaM paper, its Arabic pretraining used 540B Arabic tokens — but half (270B) are machine-translated Arabic, and only 270B are natural Arabic. Translated, standard-leaning text isn't how dialects are actually spoken — so the model under-learned the rich diversity of Arabic dialects.
We probed base ALLaM across several dialects (Egyptian, Gulf, Levantine, Maghrebi): it held up only on the simplest, closest-to-MSA cases — on most dialects it misread the input. One clear example, in Moroccan Darija:
«واش كاين شي طريقة باش نبردو راسنا فهاد القايلة بلا ما نطيحو فالوهالة؟»
English: "Is there a way to cool ourselves down in this midday heat without collapsing from exhaustion?" MSA: «هل من طريقة لتبريد أنفسنا في هذا الحرّ الشديد دون أن نقع في الإرهاق؟»
— base ALLaM didn't understand the dialect and answered wrong, while a large general model handled it:
| Base ALLaM (at the time) | A large general model |
|---|---|
![]() | ![]() |
| ❌ Misread the dialect — answered wrong | ✅ Understood and answered appropriately |
Closing that gap — teaching ALLaM to understand Arabic dialects — is the whole project. After fine-tuning, it identifies the dialect, translates it to MSA, and replies in it:

The team's chat app with my fine-tuned ALLaM integrated — identifying the dialect (“مصرية”), translating dialect → MSA, and replying in-dialect.
ما هي اللهجة / ترجم للفصحى / رد باللهجة).src/data_pipeline/).src/msa_generation/).src/augmentation/).src/finetuning/), scored with BLEU / F1 / similarity plus a human-eval round
(src/evaluation/), then integrated into the team's chat app.flowchart TD
A[Collect dialect datasets<br/>~17 Arab-country sources] --> B[Clean & normalize<br/>AraBERT + dialect char maps]
B --> C[Fuzzy dedup<br/>MinHash + LSH]
C --> D[Build instruction format<br/>3 tasks: identify / translate / reply]
D --> E[Balance & downsample<br/>to target size]
E --> F[Convert to instruction JSONL]
F --> G[Fine-tune ALLaM-1-13B<br/>IBM watsonx.ai]
G --> H[Evaluate<br/>BLEU · F1 · similarity · human]
H --> I[Deploy + chat-app integration]
K[MSA synthesis<br/>GPT-3.5 + LLaMA + ROVER] -.silver pairs.-> D
J[AraGPT2 augmentation<br/>Najdi dialect] -.extra data.-> D
Built from ~17 country sources and balanced across the four macro-dialects and three tasks — 1,410,265 instruction examples:
Full source catalogue: docs/dataset-catalog.md.
Measured on the project's own evaluation outputs (kept under
src/evaluation/sample_results/):
| Task | Metric | Score | Source file |
|---|---|---|---|
| Dialect → MSA translation | BLEU (sacrebleu) | ≈ 19 | translation_bleu_eval.json (18.996) |
| Dialect classification | Weighted F1 | ≈ 0.95 | classification_f1.json (0.954) |
| Overall quality | Human evaluation | Positive feedback | final presentation / human-eval round |
Honest caveat: the BLEU and F1 numbers come from two separate evaluation runs, not a single unified benchmark, and per-class F1 varied (e.g. Levantine recall was low). Some other runs failed against a since-retired endpoint. The raw outputs are included as-is rather than cherry-picked — see methodology.md.
The model was fine-tuned on IBM watsonx (Nov 2024 — loss converged, tuning complete):

The hard part wasn't the idea — it was working out how to fine-tune ALLaM so it actually understands Arabic dialects. I researched the best approaches to Arabic dialect fine-tuning — data, methods, and evaluation — tested options, and ruled out dead-ends (encoder models can't generate; off-the-shelf classifiers only separate 1–2 dialects) before settling the design. The full story — what I read, every decision and why — is in docs/research-journey.md.
Every paper, model, dataset, and technique I drew from is credited in docs/research-references.md — annotated with what I used each for.
| Area | Tools actually used |
|---|---|
| Base model | sdaia/allam-1-13b-instruct (ALLaM, © SDAIA) |
| Other models | AraGPT2, QARiB, MARBERT, CAMeLBERT, GPT-3.5 (Azure OpenAI), LLaMA (Groq) |
| Platforms | IBM watsonx.ai, Azure ML, Azure OpenAI, Groq |
| NLP / ML | transformers, torch, arabert, datasketch (MinHash), sacrebleu, scikit-learn, nltk |
| Data | pandas, numpy |
| Arabic display | arabic-reshaper, python-bidi (RTL) |
| Language | Python |
src/
data_pipeline/ clean → dedup → format → balance → downsample → convert
msa_generation/ GPT-3.5 / LLaMA translate-then-correct + ROVER ensemble
augmentation/ AraGPT2 fine-tune for Najdi dialect (+ sample output)
finetuning/ watsonx fine-tuning notebook + config
inference/ ALLaM inference (Azure ML / watsonx)
evaluation/ BLEU / F1 / similarity scripts + real sample results
docs/
research-journey.md how the research shaped the fine-tune (with visuals)
research-references.md annotated bibliography — what I read & used
dataset-catalog.md the dataset catalogue + composition chart
methodology.md the pipeline, step by step
presentation.pdf final challenge presentation
assets/ diagrams + demo / comparison / training screenshots
About model access: during the challenge, ALLaM was served on a private watsonx deployment provisioned only for participants — that endpoint is no longer available. ALLaM has since been released publicly on Hugging Face, so the model-facing code can be pointed at your own ALLaM deployment. The data-pipeline scripts run standalone on any JSON/CSV — no model needed.
# clone + install
git clone https://github.com/Omar0042/allam-arabic-dialects.git
cd allam-arabic-dialects
python -m venv .venv && . .venv/bin/activate # (Windows: .venv\Scripts\activate)
pip install -r requirements.txt
# run a data-pipeline step on your own data — no model required
python "src/data_pipeline/fuzzy_deduplication.py"
# model-facing code (inference / evaluation) needs your own ALLaM endpoint:
cp .env.example .env # fill in your keys/endpoints
python "src/evaluation/eval_f1.py"
Each src/data_pipeline/ script is standalone, with an if __name__ == "__main__"
example you can point at your own JSON/CSV.
This repository is a curated, partial release of a team competition project:
.env.example).What's shown instead: the data + fine-tuning + evaluation + inference code I wrote, the dataset catalogue, the methodology, the research write-up, the final presentation, and real evaluation outputs.
I led a 4-person team for the ~6-week challenge. I:
datasketch — see dataset-catalog.md.Source code: MIT. Does not cover the ALLaM model, third-party
datasets, or team-produced presentation materials — see the note in LICENSE.
Fine-tuning SDAIA's ALLaM LLM to understand Arabic dialects — identify, translate to MSA, reply in-dialect. ALLaM Challenge finalist; led a 4-person team.
Python
2
1 commits
updated Jun 17, 2026
I led a 4-person team to a finalist finish in SDAIA's ALLaM Challenge (تحدي علّام — selected from 600+ participants), fine-tuning SDAIA's ALLaM LLM to bridge Modern Standard Arabic (MSA) and regional Arabic dialects: identify a dialect, translate it to MSA, and reply in-dialect.
🏆 ALLaM Challenge (تحدي علّام) · SDAIA & Tuwaiq Academy · Sep–Nov 2024 · Finalist (reached the final stage).
Why was base ALLaM weak on dialects? A root cause in its training data. Per the ALLaM paper, its Arabic pretraining used 540B Arabic tokens — but half (270B) are machine-translated Arabic, and only 270B are natural Arabic. Translated, standard-leaning text isn't how dialects are actually spoken — so the model under-learned the rich diversity of Arabic dialects.
We probed base ALLaM across several dialects (Egyptian, Gulf, Levantine, Maghrebi): it held up only on the simplest, closest-to-MSA cases — on most dialects it misread the input. One clear example, in Moroccan Darija:
«واش كاين شي طريقة باش نبردو راسنا فهاد القايلة بلا ما نطيحو فالوهالة؟»
English: "Is there a way to cool ourselves down in this midday heat without collapsing from exhaustion?" MSA: «هل من طريقة لتبريد أنفسنا في هذا الحرّ الشديد دون أن نقع في الإرهاق؟»
— base ALLaM didn't understand the dialect and answered wrong, while a large general model handled it:
| Base ALLaM (at the time) | A large general model |
|---|---|
![]() | ![]() |
| ❌ Misread the dialect — answered wrong | ✅ Understood and answered appropriately |
Closing that gap — teaching ALLaM to understand Arabic dialects — is the whole project. After fine-tuning, it identifies the dialect, translates it to MSA, and replies in it:

The team's chat app with my fine-tuned ALLaM integrated — identifying the dialect (“مصرية”), translating dialect → MSA, and replying in-dialect.
ما هي اللهجة / ترجم للفصحى / رد باللهجة).src/data_pipeline/).src/msa_generation/).src/augmentation/).src/finetuning/), scored with BLEU / F1 / similarity plus a human-eval round
(src/evaluation/), then integrated into the team's chat app.flowchart TD
A[Collect dialect datasets<br/>~17 Arab-country sources] --> B[Clean & normalize<br/>AraBERT + dialect char maps]
B --> C[Fuzzy dedup<br/>MinHash + LSH]
C --> D[Build instruction format<br/>3 tasks: identify / translate / reply]
D --> E[Balance & downsample<br/>to target size]
E --> F[Convert to instruction JSONL]
F --> G[Fine-tune ALLaM-1-13B<br/>IBM watsonx.ai]
G --> H[Evaluate<br/>BLEU · F1 · similarity · human]
H --> I[Deploy + chat-app integration]
K[MSA synthesis<br/>GPT-3.5 + LLaMA + ROVER] -.silver pairs.-> D
J[AraGPT2 augmentation<br/>Najdi dialect] -.extra data.-> D
Built from ~17 country sources and balanced across the four macro-dialects and three tasks — 1,410,265 instruction examples:
Full source catalogue: docs/dataset-catalog.md.
Measured on the project's own evaluation outputs (kept under
src/evaluation/sample_results/):
| Task | Metric | Score | Source file |
|---|---|---|---|
| Dialect → MSA translation | BLEU (sacrebleu) | ≈ 19 | translation_bleu_eval.json (18.996) |
| Dialect classification | Weighted F1 | ≈ 0.95 | classification_f1.json (0.954) |
| Overall quality | Human evaluation | Positive feedback | final presentation / human-eval round |
Honest caveat: the BLEU and F1 numbers come from two separate evaluation runs, not a single unified benchmark, and per-class F1 varied (e.g. Levantine recall was low). Some other runs failed against a since-retired endpoint. The raw outputs are included as-is rather than cherry-picked — see methodology.md.
The model was fine-tuned on IBM watsonx (Nov 2024 — loss converged, tuning complete):

The hard part wasn't the idea — it was working out how to fine-tune ALLaM so it actually understands Arabic dialects. I researched the best approaches to Arabic dialect fine-tuning — data, methods, and evaluation — tested options, and ruled out dead-ends (encoder models can't generate; off-the-shelf classifiers only separate 1–2 dialects) before settling the design. The full story — what I read, every decision and why — is in docs/research-journey.md.
Every paper, model, dataset, and technique I drew from is credited in docs/research-references.md — annotated with what I used each for.
| Area | Tools actually used |
|---|---|
| Base model | sdaia/allam-1-13b-instruct (ALLaM, © SDAIA) |
| Other models | AraGPT2, QARiB, MARBERT, CAMeLBERT, GPT-3.5 (Azure OpenAI), LLaMA (Groq) |
| Platforms | IBM watsonx.ai, Azure ML, Azure OpenAI, Groq |
| NLP / ML | transformers, torch, arabert, datasketch (MinHash), sacrebleu, scikit-learn, nltk |
| Data | pandas, numpy |
| Arabic display | arabic-reshaper, python-bidi (RTL) |
| Language | Python |
src/
data_pipeline/ clean → dedup → format → balance → downsample → convert
msa_generation/ GPT-3.5 / LLaMA translate-then-correct + ROVER ensemble
augmentation/ AraGPT2 fine-tune for Najdi dialect (+ sample output)
finetuning/ watsonx fine-tuning notebook + config
inference/ ALLaM inference (Azure ML / watsonx)
evaluation/ BLEU / F1 / similarity scripts + real sample results
docs/
research-journey.md how the research shaped the fine-tune (with visuals)
research-references.md annotated bibliography — what I read & used
dataset-catalog.md the dataset catalogue + composition chart
methodology.md the pipeline, step by step
presentation.pdf final challenge presentation
assets/ diagrams + demo / comparison / training screenshots
About model access: during the challenge, ALLaM was served on a private watsonx deployment provisioned only for participants — that endpoint is no longer available. ALLaM has since been released publicly on Hugging Face, so the model-facing code can be pointed at your own ALLaM deployment. The data-pipeline scripts run standalone on any JSON/CSV — no model needed.
# clone + install
git clone https://github.com/Omar0042/allam-arabic-dialects.git
cd allam-arabic-dialects
python -m venv .venv && . .venv/bin/activate # (Windows: .venv\Scripts\activate)
pip install -r requirements.txt
# run a data-pipeline step on your own data — no model required
python "src/data_pipeline/fuzzy_deduplication.py"
# model-facing code (inference / evaluation) needs your own ALLaM endpoint:
cp .env.example .env # fill in your keys/endpoints
python "src/evaluation/eval_f1.py"
Each src/data_pipeline/ script is standalone, with an if __name__ == "__main__"
example you can point at your own JSON/CSV.
This repository is a curated, partial release of a team competition project:
.env.example).What's shown instead: the data + fine-tuning + evaluation + inference code I wrote, the dataset catalogue, the methodology, the research write-up, the final presentation, and real evaluation outputs.
I led a 4-person team for the ~6-week challenge. I:
datasketch — see dataset-catalog.md.Source code: MIT. Does not cover the ALLaM model, third-party
datasets, or team-produced presentation materials — see the note in LICENSE.