CoolFace
Datasetpublic

replysadiq/qatar-customs-nl2sql

Qatar Customs NL2SQL โ€” Arabic Natural Language to SAP HANA SQL Fine-tuning dataset for converting Arabic natural language questions into SAP HANA SQL queries for the Qatar General Directorate of Customs (GDC) database. Dataset Overview Metric Value Total question sets 99 Training examples 320 (3 fuzz levels ร— 80 questions + 80 follow-ups) Test examples 76 (3 fuzz levels ร— 19 questions + 19 follow-ups) Language Arabic ๐Ÿ‡ถ๐Ÿ‡ฆ (formal + dialectal)โ€ฆ See the full description on the dataset page: https://huggingface.co/datasets/replysadiq/qatar-customs-nl2sql.

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes2downloads
Dataset Card

Qatar Customs NL2SQL โ€” Arabic Natural Language to SAP HANA SQL

Fine-tuning dataset for converting Arabic natural language questions into SAP HANA SQL queries for the Qatar General Directorate of Customs (GDC) database.

Dataset Overview

MetricValue
Total question sets99
Training examples320 (3 fuzz levels ร— 80 questions + 80 follow-ups)
Test examples76 (3 fuzz levels ร— 19 questions + 19 follow-ups)
LanguageArabic ๐Ÿ‡ถ๐Ÿ‡ฆ (formal + dialectal)
SQL dialectSAP HANA
DomainCustoms declarations, payments, offences, e-declarations
FormatChatML messages (system/user/assistant)

3 Fuzz Levels

Each question has 3 difficulty variants to train robustness:

LevelStyleExample
CleanFormal Arabicุฎู„ุงู„ ุขุฎุฑ 30 ูŠูˆู…ุŒ ู…ุง ุฅุฌู…ุงู„ูŠ ุงู„ู…ุจุงู„ุบ ุงู„ู…ุญุตู„ุฉ ุนุจุฑ ุงู„ุฏูุน ุงู„ุฅู„ูƒุชุฑูˆู†ูŠุŸ
MediumCasual dialectุฃุจุบู‰ ุชุญุตูŠู„ุงุช ุงู„ุฏูุน ุงู„ุงู„ูƒุชุฑูˆู†ูŠ ุขุฎุฑ 30 ูŠูˆู…
HardVery colloquial, abbreviatedูƒู… ู…ุฌู…ูˆุน ุงู„ุชุญุตูŠู„ ุงู„ูƒุชุฑูˆู†ูŠ ุขุฎุฑ ุดู‡ุฑุŸ

Database Schema (7 Main Tables + 31 Lookup Tables)

TableDomain
PBI_VW_FACT_DECLARATIONCustoms declarations
PBI_VW_FACT_ITEMDeclaration line items (HS codes, duty)
PBI_VW_FACT_PARTYImporters, exporters, clearing agents
PBI_VW_FACT_PAYMENTPayment/collection records
PBI_VW_FACT_OFFENCECustoms offences/violations
PBI_VW_FACT_E_DECLARATIONTraveler e-declarations
PBI_VW_FACT_OGAOther Government Agency checks

Full DDL in eval/schema.sql.

Training

bash
pip install transformers trl torch datasets trackio accelerate peft bitsandbytes

python scripts/train.py

Hardware: Single GPU with 24GB VRAM (A10G, A100, RTX 4090) โ€” QLoRA 4-bit Time: ~2-3 hours Output: LoRA adapter pushed to replysadiq/qatar-customs-nl2sql-qwen7b

Evaluation

bash
python scripts/evaluate.py <model_path>

Metrics: exact match, table accuracy, column accuracy, structural similarity, HANA function accuracy, fuzz degradation.

Files

โ”œโ”€โ”€ train.jsonl              # 320 training examples
โ”œโ”€โ”€ test.jsonl               # 76 test examples (held out)
โ”œโ”€โ”€ eval/
โ”‚   โ”œโ”€โ”€ test_with_meta.jsonl # Test data with metadata (question_num, fuzz_level)
โ”‚   โ””โ”€โ”€ schema.sql           # Full HANA DDL for all tables
โ””โ”€โ”€ scripts/
    โ”œโ”€โ”€ train.py             # QLoRA training script
    โ”œโ”€โ”€ evaluate.py          # Evaluation framework
    โ””โ”€โ”€ build_dataset.py     # Dataset construction from Excel