Abstract
Pre-trained Language Models (PLMs) are integral to many modern natural language processing (NLP) systems. Although multilingual models cover a wide range of languages, they often grapple with challenges like high inference costs and a lack of diverse non-English training data. Arabic-specific PLMs are trained predominantly on modern standard Arabic, which compromises their performance on regional dialects. To tackle this, we construct an Arabic dialectal corpus comprising 3.4M sentences gathered from social media platforms. We utilize this corpus to expand the vocabulary and retrain a BERT-based model from scratch. Named AlcLaM, our model was trained using only 13 GB of text, which represents a fraction of the data used by existing models such as CAMeL, MARBERT, and ArBERT, compared to 7.8%, 10.2%, and 21.3%, respectively. Remarkably, AlcLaM demonstrates superior performance on a variety of Arabic NLP tasks despite the limited training data.
1. Introduction
Most Arabic Pre-trained Language Models (PLMs) suffer from a "formal bias," being predominantly trained on Modern Standard Arabic (MSA)—the language of news, literature, and official documents. However, the vast majority of Arabic speakers communicate daily using regional dialects that differ significantly from MSA in morphology, syntax, and vocabulary.
When MSA-heavy models encounter social media text or casual conversation, they often fail to recognize dialect-specific tokens or apply biased weights that do not reflect natural usage. To bridge this gap, we introduce AlcLaM (Arabic Dialectal Language Model). Despite being trained on just 13 GB of data—a fraction of what its predecessors used—AlcLaM achieves state-of-the-art results across dialect identification, sentiment analysis, and hate speech detection.
2. Methodology
AlcLaM follows a "quality over quantity" approach to model training, focusing on the relevance of the training corpus to everyday dialectal usage.
2.1 Corpus Construction
We developed a massive, meticulously filtered dialectal corpus. Since social media often contains a mix of MSA and dialects, we trained a binary classifier to filter out MSA text with 98% accuracy, resulting in a dataset of approximately 3,372,744 dialectal sentences (approx. 54.5 million tokens) scraped from YouTube and Facebook comments.
2.2 Architecture and Training
AlcLaM utilizes the BERT-base architecture (12 layers, 768 hidden units, 12 attention heads, ~125M parameters). Key training strategies include:
- Whole Word Masking: Masking entire words instead of random sub-tokens to force the model to learn better context.
- No Next Sentence Prediction (NSP): Following the RoBERTa approach, we excluded NSP loss as it provides limited benefit for downstream tasks.
- Data Efficiency: The model was trained on only 13 GB of text for 5 epochs, significantly less than competitors like MARBERT (128 GB) or ArBERT (61 GB).
3. Experimental Setup
The model was evaluated on 13 different datasets across three primary categories:
- Dialect Identification (DID): MADAR (2, 6, 9, 26) and NADI.
- Sentiment Analysis (SA): SemEval 2017, ASAD, AJGT, ASTD, LABR, and ArSAS.
- Hate Speech & Offensive Language (HSOD): Adult, Offensive, and HateSpeech datasets.
4. Results and Discussion
AlcLaM achieved state-of-the-art (SOTA) performance on the majority of the tested datasets, demonstrating that data specificity can outweigh sheer data volume.
As shown in the experimental results, AlcLaM consistently outperforms larger models. In Dialect Identification, specifically on the MADAR-2 dataset, AlcLaM reached a Macro-F1 score of 98.2, significantly outperforming MARBERT (85.3) and CAMeL (87.5). In Sentiment Analysis, it achieved a 69.2 F1 on SemEval 2017 and 95.0 F1 on AJGT. For Hate Speech Detection, the model hit an 89.3 F1 on the Adult dataset.
4.1 Key Insights
- Relevance over Volume: Using only ~10% of the data compared to models like MARBERT, AlcLaM's superior performance suggests that for dialect-heavy tasks, the relevance of training data is more important than the sheer number of gigabytes.
- The Tokenization Gap: Standard Arabic models often treat dialectal words as "unknown" or break them into nonsensical sub-words. By building a vocabulary from a dialectal corpus, AlcLaM captures the linguistic nuances of everyday usage.
- Cross-Dialectal Synergy: The model's strong performance across various regional datasets suggests that Arabic dialects share enough underlying structure for a unified dialectal model to generalize effectively.
5. Conclusion
AlcLaM demonstrates that targeted, high-quality dialectal data can produce highly effective language models with significantly lower computational costs. While its generative performance may be limited by the 13 GB training set, its discriminative capabilities are exceptional. Future work will explore optimizing inference costs and continued pre-training to further refine its capabilities.
Paper Link: arXiv:2407.13097
Code & Model: GitHub | HuggingFace
Summary updated