Arabic dialect identification (5 regions): frozen Omnilingual wav2vec2-300M + LoRA
Speech-based classifier that labels an utterance as one of five Arabic varieties: EGY (Egyptian/Sudanese), GLF (Gulf, Iraqi, Yemeni), LEV (Levantine: Palestinian, Jordanian, Lebanese, Syrian), MAG (Maghrebi) or MSA (Modern Standard Arabic).
It keeps the omniASR_W2V_300M encoder frozen and trains only 4.3 M parameters: LoRA (rank 16) on every attention
block (3.15 M) and an attentive-statistics-pooling classification head (1.19 M). Training took 2 epochs
(~1.7 GPU-hours on one RTX 5090) on 873.9 h of audio.
Results
Numbers of record, from the training-time evaluation path: untrimmed audio, centre 30 s crop, macro-F1 over the classes present.
Full per-class tables and confusion matrices are in eval/v2s1_results.json.
| set | clips | accuracy | macro-F1 | LEV precision | LEV recall |
|---|---|---|---|---|---|
| ADI-20 test | 14,072 | 0.9450 | 0.9346 | 0.903 | 0.957 |
| NADI test (no MSA class) | 3,817 | 0.9374 | 0.9346 | 0.909 | 0.958 |
| ADI-20 val | 10,345 | 0.9387 | 0.9105 | 0.832 | 0.968 |
| NADI val | 3,828 | 0.9287 | 0.9248 | 0.884 | 0.961 |
| ADI-5 (MGB-3) dev | 1,566 | 0.7957 | 0.7972 | 0.910 | 0.724 |
Epoch 2 was selected on the mean validation macro-F1 of the three validation sets (0.8633 after epoch 1, 0.8775 after epoch 2).
Per class, ADI-20 test (precision / recall / F1): EGY .921/.895/.908, GLF .960/.951/.956, LEV .903/.957/.929, MAG .964/.949/.956, MSA .944/.905/.924.
Comparison with Whisper-large-v3 (Elyadata/ADI-whisper-ADI20)
The released 20-country model was scored on exactly the same clips and audio and its 20 outputs were collapsed to the
same 5 regions. Paired exact McNemar tests and a cluster bootstrap over source videos / source groups
(B = 2000) are in eval/ely_vs_did5.json.
| set | n | this model: acc / macro-F1 | Whisper-large-v3: acc / macro-F1 | acc difference [95 % CI] |
|---|---|---|---|---|
| ADI-20 test | 14,072 | .9450 / .9346 | .9441 / .8595 | +.0009 [-.0087, +.0116], McNemar p = .74 (tie) |
| ADI-20 val | 10,345 | .9387 / .9105 | .9552 / .8117 | -.0165 [-.0328, +.0027] |
| NADI test | 3,817 | .9376 / .9350 | .7781 / .7993 | +.1595 [+.1453, +.1736] |
How to read this:
- On ADI-20 test the two models tie on accuracy. The macro-F1 gap comes almost entirely from MSA: collapsed to regions, Whisper predicts MSA for 331 non-MSA clips (MSA precision .378 vs .924 here). Weighted F1 is about equal (.9451 vs .9482). Whisper is more precise on LEV (.975 vs .903) but recalls less of it (.908 vs .957).
- The NADI gap is not an architecture comparison. This model was trained on NADI training data (source groups kept disjoint from its test set); Whisper saw NADI zero-shot.
- Whisper was trained for 20 countries and is scored here after collapsing; this model was trained directly on the 5 regions.
- This model trains 4.3 M parameters on 873.9 h; the Whisper-large-v3 encoder is about 637 M parameters fine-tuned on 53 h per country.
Usage
pip install -r requirements.txt # torch 2.8, fairseq2 0.6, omnilingual-asr 0.1.0 (CUDA 12.8 build)
huggingface-cli download Mohammed-nabulsi/omniasr-w2v300m-lora-arabic-did5-v2 --local-dir did5
cd did5 && python did_model.py clip1.wav clip2.wav
from did_model import DialectID
m = DialectID() # downloads the frozen omniASR_W2V_300M encoder on first use
m.predict_file("clip.wav") # {'EGY': 0.01, 'GLF': 0.02, 'LEV': 0.94, 'MAG': 0.02, 'MSA': 0.01}
Input must be 16 kHz mono (the loader does not resample). Clips longer than 30 s are centre-cropped. The model was
trained on untrimmed audio with no VAD and no augmentation. Labels are in adapters/labels.json
(EGY 0, GLF 1, LEV 2, MAG 3, MSA 4).
did_model.py was checked against these weights: on the 348 Levantine clips of ADI-5 dev it gives LEV recall .727
(253/348) against the recorded .724 (252/348); the one-clip difference is the documented bf16 batch-composition effect.
Files
| path | content |
|---|---|
adapters/lora_ep2.pt |
LoRA weights, 192 tensors (96 projections x A, B), 3,145,728 params. md5 6e091074fee8e1c23d1892c74a8c9788 |
adapters/head_ep2.pt |
pooling + classifier head, 10 tensors, 1,187,078 params. md5 04f89ecb430266be4874877c5b92a4ee |
adapters/labels.json |
label order |
did_model.py |
self-contained inference code |
configs/ |
the resolved training configuration (every value sourced) and the verbatim launch line |
training_code/ |
the training scripts that produced the weights |
eval/ |
the training run's own results, and the paired comparison with Whisper |
Training
- Architecture. Frozen
omniASR_W2V_300M(24 layers, d = 1024). LoRA r = 16, alpha = 32, dropout 0.05 on q/k/v/output projections of all 24 attention blocks. Head: attentive statistics pooling (1024 -> 128 -> tanh -> 1, softmax over valid frames, weighted mean + std = 2048) -> LayerNorm -> Linear 2048->512 -> GELU -> Dropout 0.2 -> Linear 512->5. - Optimisation. AdamW (weight decay 0.01), learning rate 5e-4 (head) and 2e-4 (LoRA), 150-step linear warm-up, batch 72, 5,400 steps per epoch, 2 epochs, bf16 autocast, gradient clipping 1.0, seed 13. Class-weighted cross-entropy (inverse frequency) with label smoothing 0.05. Random 8 s training crops, per-clip waveform z-normalisation.
- Launch line:
python train_multi.py --max-epochs 2 --patience 3 --rep "" --lr-head 5e-4 --lr-lora 2e-4 --workers 24 --seed 13 --test-ckpt last - Hardware/time. One RTX 5090 (32 GB), 0.55 s per step, about 51 minutes per epoch.
Training data (dataset v2): 388,806 clips, 873.9 h
| source | clips / hours (train) |
|---|---|
| ADI-20, "ely40" selection (about 40 h per country, video round-robin) | 356,470 / 800.3 h |
| ADI-5 (MGB-3) | 14,420 / 53.2 h |
| NADI 2025 subtask 1 (Algeria, Egypt, Jordan, Mauritania, Morocco, Palestine, UAE, Yemen) | 17,916 / 20.4 h |
Training clips per region: EGY 95.4 h, GLF 338.1 h, LEV 177.4 h, MAG 218.3 h, MSA 44.6 h. Country -> region map: LEV = PAL, JOR, LEB, SYR; GLF = KSA, KUW, QAT, UAE, OMA, YEM, IRA, BAH; MAG = ALG, MOR, LIB, MAU, TUN; EGY = EGY, SUD; MSA = MSA.
Leakage controls, applied before training:
- An ADI-20 clip byte-identical to an ADI-5 clip was removed from ADI-20; other exact duplicates keep their first copy.
- NADI train + validation were pooled and re-split 70/15/15 by source group (same-country sources with ECAPA cosine >= 0.85 share a group).
- An ADI-20 evaluation clip whose source video is in the training set was dropped, and so was any evaluation clip with ECAPA speaker-embedding cosine >= 0.95 to a kept training clip.
Limitations
- Out of domain it is much weaker. LEV recall with corpus-level labels: CASA-JOR .935, CASA-PAL .974, but Layla .416 and Omnilingual .515. Broadcast MSA is often called LEV: on a sealed 506-clip set, 38.5 % of MSA clips were predicted LEV.
- Regions, not countries. It separates Palestinian from the other Levantine countries only weakly, and has no country output.
- Held-out videos are not held-out voices. One Palestinian voice spans 255 of 499 ADI-17 PAL videos, and 3.9 % of ADI-20 test clips have speaker cosine >= 0.8 to a training clip. Test scores may be somewhat optimistic for unseen speakers.
- Class imbalance. MSA is only 44.6 h of training audio and ADI-20 val holds just 60 MSA clips, so MSA scores there are noisy.
- Trained and evaluated on untrimmed audio; behaviour on very short or heavily noisy clips was not studied.
- Retraining reproduces within a tolerance (CUDA and bf16 kernels are not bit-exact); that band was not measured.
License and attribution
The adapters and code in this repository are released under Apache-2.0. The frozen base encoder
facebook/omniASR-W2V-300M is Apache-2.0. The training datasets state
no license on their Hub pages (ADI-20, ADI-17, NADI 2025 subtask 1 is gated); check their terms before reusing the data. No audio is redistributed here.
Datasets and prior work: H. Elleuch, S. Mdhaffar, Y. Estève, F. Bougares, "ADI-20: Arabic Dialect Identification dataset and models", Interspeech 2025 (arXiv:2511.10070); ADI-5 / MGB-3 (Ali et al., 2017); NADI 2025 shared task.
Citation
@misc{nabulsi2026did5,
title = {Arabic dialect identification with a frozen Omnilingual wav2vec2-300M encoder and LoRA},
author = {Nabulsi, Mohammed},
year = {2026},
url = {https://huggingface.co/Mohammed-nabulsi/omniasr-w2v300m-lora-arabic-did5-v2}
}