Arabic Dialect Identification and Sentiment Classification using Transformer-based Models
Paper · 2022 · Joseph Attieh and Fadi Hassan
Summary
The authors (team Pythoneers) describe two AraBERT-based systems for the NADI 2022 shared task. The first sub-task is country-level identification of Arabic dialects in tweets. The second is sentiment classification of dialectal tweets. For dialects, they derive two coarser labels from each country: a binary Western/Eastern region and one of four areas. They then train one shared encoder with three classification heads, cycling through the losses one batch at a time. They also oversample so that every country contributes the same number of examples. For sentiment, where training data is tiny, they fine-tune ten AraBERT models in a K-fold scheme and average their logits. That averaged ensemble then serves as a teacher for a single student model. The systems ranked 6th and 9th on the two dialect test sets and 4th on sentiment. Country-level dialect identification remains hard, with macro-F1 in the low thirties. The distilled sentiment model scored better on the test set than on dev, which the authors take as a sign of good generalization.
Key points
- Backbone for both systems:
bert-large-arabertv02-twitter, which builds on AraBERTv0.2-large and is pretrained with MLM on 60M multi-dialect tweets. Pre-processing strips non-Arabic words, emojis and URLs. - Data sizes:
- Subtask 1 has ~20,398 training tweets across 18 countries and 4,871 dev tweets. TEST-A has 4,758 tweets covering all 18 countries. TEST-B has 1,474 tweets covering an undisclosed subset of k countries.
- Subtask 2 has 1,500 training tweets, 500 dev tweets and 3,000 test tweets, labelled positive, negative or neutral.
- Multi-task setup:
- Each head is a dropout layer (0.1) plus a linear layer over the CLS embedding, giving 2, 4 or 18 outputs.
- Training uses 500 tweets sampled with replacement per country, Adam with lr 1e-5, batch size 64 and 5 epochs.
- Distillation:
- The loss is (1−α)·CE against gold labels plus α·MSE between student and teacher logits, with α = 0.95 and K = 10.
- Training uses lr 5e-6, batch size 32 and 6 epochs.
- Macro-F1 results:
- On dev, region scores 74.64, area 60.65 and country 27.57.
- Country scores 32.63 on TEST-A and 15.61 on TEST-B.
- Sentiment on the test set reaches 73.40, scored over positive and negative classes only.
- Most errors are Levantine vs. Peninsular Gulf, and confusions stay mostly within the same area.
Interesting ideas
- I1. Derive coarser auxiliary labels (region, area) automatically from the fine label and train them as extra heads on one shared encoder, so the label hierarchy acts as free supervision.
- I2. Instead of summing several task losses, update on just one head's loss per batch and rotate between them, sidestepping the problem of weighting losses that measure different things.
- I3. Resample the training set to a fixed count per class, with replacement, so rare classes are seen as often as frequent ones.
- I4. Train K models on K−1 folds each, average their logits into a teacher, then distill into one student. This is most useful when labelled data is very small.
- I5. Read the confusion matrix along the label hierarchy, i.e. whether errors stay inside the same family, to judge whether the hierarchy was actually learned.
For Mova
How these ideas could serve Mova, our small open language model — its files, stages and tests:
- I1 (tree): gparse could add auxiliary heads that predict coarse relation families (e.g. core argument vs. modifier vs. function word) derived from the full UD deprel. This would inject the label hierarchy at no annotation cost.
- I2 (learn): when training jointly on tagging, lemmas and parsing, alternating objectives per batch avoids hand-tuning loss weights. That makes each objective's contribution easier to attribute.
- I3 (tokens): rare morphological features or POS tags in the en tagger could be balanced this way during training. The effect should be checked against an unbalanced baseline.
- I4 (learn): silver data agreed by several witness parsers could be turned into soft averaged scores. A single fast student parser would then be distilled from them rather than trained on hard votes alone.
- I5 (learn): evaluation reports could group parser or frame-role errors by family. This would show whether mistakes are near-misses or structural failures, making errors more explainable.
Institutions
Fields, topics and concepts
📚 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 16,667 worksArtificial Intelligence · 16,194 worksArts and Humanities · 16,039 worksLanguage and Linguistics · 15,891 works
🧭 Topics 2Research subjects and languages the work is about.Sentiment & emotion · 972 worksSemitic languages · 2,908 works
Cite
Cite as Joseph Attieh and Fadi Hassan. 2022. Arabic Dialect Identification and Sentiment Classification using Transformer-based Models. Proceedings of the Seventh Arabic Natural Language Processing Workshop (WANLP).
@inproceedings{attieh2022arabic,
title = {{Arabic Dialect Identification and Sentiment Classification using Transformer-based Models}},
author = {Joseph Attieh and Fadi Hassan},
booktitle = {Proceedings of the Seventh Arabic Natural Language Processing Workshop (WANLP)},
year = {2022},
doi = {10.18653/v1/2022.wanlp-1.54},
url = {https://doi.org/10.18653/v1/2022.wanlp-1.54}
}References
- Muhammad Abdul-Mageed, AbdelRahim Elmadany, and El Moatez Billah Nagoudi. 2021a. ARBERT & MARBERT: Deep bidirectional transformers for Arabic. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 7088–7105, Online. Association for Computational Linguistics. ↗
- Muhammad Abdul-Mageed, Chiyu Zhang, Houda Bouamor, and Nizar Habash. 2020. NADI 2020: The First Nuanced Arabic Dialect Identification Shared Task. In Proceedings of the Fifth Arabic Natural Language Processing Workshop (WANLP 2020), Barcelona, Spain. ↗
- Muhammad Abdul-Mageed, Chiyu Zhang, AbdelRahim Elmadany, Houda Bouamor, and Nizar Habash. 2021b. NADI 2021: The Second Nuanced Arabic Dialect Identification Shared Task. In Proceedings of the Sixth Arabic Natural Language Processing Workshop (WANLP 2021). ↗
- Muhammad Abdul-Mageed, Chiyu Zhang, AbdelRahim Elmadany, Houda Bouamor, and Nizar Habash. 2022. NADI 2022: The Third Nuanced Arabic Dialect Identification Shared Task. In Proceedings of the Seven Arabic Natural Language Processing Workshop (WANLP 2022).
- Wissam Antoun, Fady Baly, and Hazem Hajj. Arabert: Transformer-based model for arabic language understanding. In LREC 2020 Workshop Language Resources and Evaluation Conference 11–16 May 2020, page 9. ↗
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics. ↗
- Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings. ↗
- Moataz Mansour, Moustafa Tohamy, Zeyad Ezzat, and Marwan Torki. 2020. Arabic dialect identification using BERT fine-tuning. In Proceedings of the Fifth Arabic Natural Language Processing Workshop, pages 308–312, Barcelona, Spain (Online). Association for Computational Linguistics.
- Ali Safaya, Moutasem Abdullatif, and Deniz Yuret. 2020. KUISAIL at SemEval-2020 task 12: BERT-CNN for offensive speech identification in social media. In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 2054–2059, Barcelona (online). International Committee for Computational Linguistics.
- Rawan Tahssin, Youssef Kishk, and Marwan Torki. 2020. Identifying nuanced dialect for Arabic tweets with deep learning and reverse translation corpus extension system. In Proceedings of the Fifth Arabic Natural Language Processing Workshop, pages 288–294, Barcelona, Spain (Online). Association for Computational Linguistics. ↗
- Abdellah El Mekki, Ahmed Alami, Hamza Alami, Ahmed Khoumsi, and Ismail Berrada. 2020. Weighted combination of BERT and n-GRAM features for nuanced Arabic dialect identification. In Proceedings of the Fifth Arabic Natural Language Processing Workshop, pages 268–274, Barcelona, Spain (Online). Association for Computational Linguistics.
- Abdellah El Mekki, Abdelkader El Mahdaouy, Kabil Essefar, Nabil El Mamoun, Ismail Berrada, and Ahmed Khoumsi. 2021. BERT-based multi-task model for country and province level MSA and dialectal Arabic identification. In Proceedings of the Sixth Arabic Natural Language Processing Workshop, pages 271–275, Kyiv, Ukraine (Virtual). Association for Computational Linguistics.
- Kamel Gaanoun and Imade Benelallam. 2020. Arabic dialect identification: An Arabic-BERT model with data augmentation and ensembling strategy. In Proceedings of the Fifth Arabic Natural Language Processing Workshop, pages 275–281, Barcelona, Spain (Online). Association for Computational Linguistics. ↗
- Imane Guellil, Houda Saâdane, Faical Azouaou, Billel Gueni, and Damien Nouvel. 2021. Arabic natural language processing: An overview. Journal of King Saud University - Computer and Information Sciences, 33(5):497–507.
Updated
This page in Markdown → https://md.research.elamur.ai/free/en/papers/attieh-2022-arabic-dialect-identification-sentiment-classification/