File size: 3,667 Bytes
8654bfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
08f8d3d
ebd4b6f
8654bfc
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
license: mit
language:
  - ny
  - en
pretty_name: Chichewa Text-to-SQL
size_categories:
  - n<1K
task_categories:
  - table-question-answering
tags:
  - text-to-sql
  - chichewa
  - low-resource-language
  - semantic-parsing
  - nlp
  - malawi
  - sql
  - qlora
  - few-shot
---

# Chichewa Text-to-SQL

The **first structured Text-to-SQL benchmark for Chichewa**, a low-resource Bantu language spoken by over 12 million people in Malawi and neighboring regions.
The dataset contains **400 manually curated natural language–SQL pairs** in both **Chichewa (Nyanja)** and **English**, grounded in a unified relational SQLite database covering five real-world domains from Malawi.

---

## Dataset Summary

This benchmark was constructed to investigate the adaptation of Large Language Models (LLMs) for Text-to-SQL generation in Chichewa. It supports systematic evaluation of zero-shot, few-shot (random and retrieval-augmented), and parameter-efficient fine-tuning (QLoRA) approaches for low-resource semantic parsing.

Key findings from the accompanying research:
- **English** zero-shot execution accuracy: 20% → 50% (random few-shot) → 70% (RAG few-shot) → **76.7% (QLoRA)**
- **Chichewa** zero-shot execution accuracy: 0% across all models → 41.7% (RAG few-shot) → **41.7% (QLoRA)**

---

## Database Schema

The SQLite database (`database/chichewa_text2sql.db`) contains five tables:

| Table | Description |
|---|---|
| `production` | Agricultural crop yield by district and season |
| `population` | Census data with geographic and demographic breakdowns |
| `mse_daily` | Malawi Stock Exchange daily trading data |
| `commodity_prices` | Commodity price data across markets |
| `food_insecurity` | Food insecurity indicators by region |

---

## Dataset Structure

### Files

| File | Description |
|---|---|
| `data/all.json` | Full dataset (400 examples) |
| `data/train.json` | Training split |
| `data/dev.json` | Development/validation split |
| `data/test.json` | Test split |
| `data/human_translations.csv` | Human-verified translations |
| `data/split_verification.json` | Split integrity verification |
| `database/chichewa_text2sql.db` | SQLite database |
| `database_tables_csv/` | Raw CSV files for each table |

### Data Fields

Each example contains:

```json
{
  "id": 1,
  "question_en": "Which district produced the most Maize",
  "question_ny": "Ndi boma liti komwe anakolola chimanga chambiri?",
  "sql_statement": "SELECT district, MAX(yield) AS max_yield FROM production WHERE crop = 'Maize';",
  "sql_result": "[('Lilongwe', 444440.0)]",
  "difficulty_level": "easy",
  "table": "production"
}
```

### Difficulty Levels

- `easy` — single table, simple SELECT / WHERE / ORDER BY
- `medium` — aggregations, GROUP BY, LIMIT
- `hard` — multi-condition queries, subqueries, JOINs

---

## Splits

| Split | Size |
|---|---|
| Train | ~280 |
| Dev | ~60 |
| Test | ~60 |
| **Total** | **400** |

---

## Usage

```python
import json

with open("data/train.json") as f:
    train = json.load(f)

print(train[0]["question_ny"])    # Chichewa question
print(train[0]["question_en"])    # English question
print(train[0]["sql_statement"])  # Ground-truth SQL
```

---

## Citation

If you use this dataset, please cite:

```bibtex
@dataset{eze2026chichewa,
  author    = {Eze, John Emeka and Matekenya, Dunstan and Matthewe, Evance},
  title     = {Chichewa Text-to-SQL: A Low-Resource Benchmark for Semantic Parsing in Chichewa},
  year      = {2026},
  publisher = {HuggingFace},
  url       = {https://huggingface.co/datasets/johneze/chichewa-text2sql}
}
```

---

## License

[MIT](https://opensource.org/licenses/MIT)