Elamur Research⌕
☰
home / papers / 2025 / Dialect2SQL: A Novel Text-to-SQL Dataset for Arabic Dialects with a Focus on Moroccan Darija

Dialect2SQL: A Novel Text-to-SQL Dataset for Arabic Dialects with a Focus on Moroccan Darija

Paper · 2025 · Salmane Chafik, Saad Ezzini and Ismail Berrada

Summary

Text-to-SQL resources exist mostly for English and Chinese, so dialect speakers have almost no benchmark for querying databases in their own language. This work builds Dialect2SQL, which the authors describe as the first large-scale, cross-domain text-to-SQL dataset in an Arabic dialect: Moroccan Darija. Darija mixes Arabic, Berber, French and Spanish elements, which makes it hard for NLP systems. The authors took the BIRD training split and had GPT-4 produce draft Darija versions of its questions. Three native-speaker computer science students who know SQL then corrected the drafts under explicit conventions, and one of them did a final consistency pass. The resource keeps BIRD's hard properties, including long schemas, dirty values and multi-table queries. Code LLMs were tested on a random Darija sample, and StarCoder2-7b scored best on all metrics. Absolute scores were low, which shows the task is far from solved. The dataset gives a starting point for dialect-aware SQL assistants and for wider low-resource work.

Key points

  • Dialect2SQL has 9,428 NLQ-SQL pairs over 69 databases. It is derived from BIRD's train set (BIRD itself has 12,751 pairs, 95 databases and 37 domains).
  • Each database has on average 137 examples and 8 tables, with a range of 2 to 60 tables. Each record holds db_id, the English question, darija_question, the SQL and the full CREATE TABLE schema.
  • The annotation conventions were:
    • Darija is written in Arabic script.
    • Names, places, companies and titles stay in English.
    • Numbers use Western Arabic digits.
    • Schemas are left untranslated.
  • Turning the GPT-4 drafts into the final versions required about 23.30% edits as measured by TER.
  • The baselines were run on 697 random Darija questions. StarCoder2-7b scored BLEU 0.171, SQAM 0.403 and TSED 0.224, ahead of CodeLlama-7b, StarCoder2-3b and CodeT5-2b.

Interesting ideas

  • I1. An LLM writes the first draft, native experts post-edit it, and TER between draft and final measures how much the machine got wrong; this turns a vague "LLM-assisted" claim into a measurable correction rate.
  • I2. Entity values such as person or company names are kept verbatim instead of transliterated, because a one-letter change would break exact matching against database values.
  • I3. Script and numeral conventions are fixed before annotation, which removes spurious variation that has nothing to do with meaning.
  • I4. TSED scores predictions by edit distance between syntax trees rather than by surface n-gram overlap like BLEU, giving partial credit for structurally close outputs.
  • I5. The original English question is stored next to its dialect version in every record, giving aligned pairs for free.

For Mova

How these ideas could serve Mova, our small open language model — its files, stages and tests:

  • I1 (learn): compute an edit rate between LLM-teacher annotations and their corrected silver versions, and use it to rank how far each teacher tier can be trusted.
  • I2 (back): when translating through the meta-world, carry entity names as opaque literal anchors copied from the source rather than regenerating them, so round trips cannot corrupt them.
  • I3 (tokens): normalize digit systems and similar surface variants in a documented pre-tagging step, so the tagger and lemmatizer see one canonical form.
  • I4 (frames): compare predicted and gold frame graphs with a tree or graph edit distance, so evaluation shows how close a wrong frame analysis came instead of only counting exact matches.
  • I5 (back): aligned question pairs like these could test whether two phrasings map to the same meaning graph, a check on translation through the meta-world.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Salmane Chafik, Saad Ezzini and Ismail Berrada. 2025. Dialect2SQL: A Novel Text-to-SQL Dataset for Arabic Dialects with a Focus on Moroccan Darija. Proceedings of the 4th Workshop on Arabic Corpus Linguistics (WACL-4).

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{chafik2025dialect2sql,
  title = {{Dialect2SQL: A Novel Text-to-SQL Dataset for Arabic Dialects with a Focus on Moroccan Darija}},
  author = {Salmane Chafik, Saad Ezzini and Ismail Berrada},
  booktitle = {Proceedings of the 4th Workshop on Arabic Corpus Linguistics (WACL-4)},
  year = {2025},
  url = {https://aclanthology.org/2025.wacl-1.10/}
}

References

14 references, 10 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Saleh Almohaimeed, Saad Almohaimeed, Mansour Al Ghanim, and Liqiang Wang. 2024. Ar-spider: Text-to-sql in arabic. In Proceedings of the 39th ACM/SI-GAPP Symposium on Applied Computing, page 1024–1030. ArXiv:2402.15012 [cs]. ↗
  2. Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Rongyu Cao, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin C. C. Chang, Fei Huang, Reynold Cheng, and Yongbin Li. 2023. Can llm already serve as a database interface? a big bench for large-scale database grounded text-to-sqls. (arXiv:2305.03111). ArXiv:2305.03111. ↗
  3. Daria Bakshandaeva, Oleg Somov, Ekaterina Dmitrieva, Vera Davydova, and Elena Tutubalina. 2022. Pauq: Text-to-sql in russian. In Findings of the Association for Computational Linguistics: EMNLP 2022, page 2355–2376, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics. find
  4. Xi Victoria Lin, Richard Socher, and Caiming Xiong. 2020. Bridging textual and tabular data for cross-domain text-to-sql semantic parsing. arXiv preprint arXiv:2012.12627. ↗
  5. Ruisheng Cao, Lu Chen, Zhi Chen, Yanbin Zhao, Su Zhu, and Kai Yu. 2021. Lgesql: line graph enhanced text-to-sql model with mixed local and non-local relations. arXiv preprint arXiv:2106.01093. ↗
  6. Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, et al. 2024. Starcoder 2 and the stack v2: The next generation. arXiv preprint arXiv:2402.19173. ↗
  7. A Conneau. 2019. Unsupervised cross-lingual representation learning at scale. arXiv preprint arXiv:1911.02116. ↗
  8. T Pires. 2019. How multilingual is multilingual bert. arXiv preprint arXiv:1906.01502. ↗
  9. Bowen Qin, Binyuan Hui, Lihan Wang, Min Yang, Jinyang Li, Binhua Li, Ruiying Geng, Rongyu Cao, Jian Sun, Luo Si, Fei Huang, and Yongbin Li. 2022. A survey on text-to-sql parsing: Concepts, methods, and future directions. (arXiv:2208.13629). ArXiv:2208.13629 [cs]. ↗
  10. Baptiste Roziere, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Romain Sauvestre, Tal Remez, et al. 2023. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950. ↗
  11. Bailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov, and Matthew Richardson. 2019. Rat-sql: Relation-aware schema encoding and linking for text-to-sql parsers. arXiv preprint arXiv:1911.04942. ↗
  12. Yue Wang, Weishi Wang, Shafiq Joty, and Steven CH Hoi. 2021. Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation. arXiv preprint arXiv:2109.00859. ↗
  13. Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir Radev. 2019. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. (arXiv:1809.08887). ArXiv:1809.08887. ↗
  14. Victor Zhong, Caiming Xiong, and Richard Socher. 2017. Seq2sql: Generating structured queries from natural language using reinforcement learning. (arXiv:1709.00103). ArXiv:1709.00103. ↗

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/chafik-2025-dialect2sql-novel-text-sql-dataset/