ap-sql-peft / README.md
samrat-kar's picture
Add dataset card
41507ce verified
|
Raw History Blame Contribute Delete
2.69 kB
---
license: apache-2.0
language: [en]
task_categories: [text-generation]
tags: [text-to-sql, oracle, accounts-payable, sql, chat]
pretty_name: AP Text-to-SQL (Oracle) PEFT dataset
size_categories: [1K<n<10K]
configs:
- config_name: default
data_files:
- split: train
path: train.jsonl
- split: validation
path: val.jsonl
- split: test
path: test.jsonl
---
# ap-sql-peft
A chat-format text-to-SQL dataset for Accounts Payable analytics on Oracle. The schema is modelled on Oracle Fusion
AP, Payments and Supplier tables, and the data behind it is synthetic. The dataset was used to train the LoRA adapter
[`samrat-kar/ap-sql-v1`](https://huggingface.co/samrat-kar/ap-sql-v1).
Every gold SQL query was run against the demo database when the dataset was built; `meta.result_rows` records how many rows it returned.
## Format
One JSON object per line:
```json
{"messages": [{"role": "system", "content": "...rules + CREATE TABLE DDL + glossary..."},
{"role": "user", "content": "question (or follow-up / repair request)"},
{"role": "assistant", "content": "```sql\nSELECT ...\n```"}],
"meta": {"id": "...", "tier": "T1-T5", "family": "...", "kind": "ask|followup|repair-exec|repair-parse",
"source": "...", "group": "...", "tables": ["..."], "result_rows": 3, "approx_prompt_tokens": 3089, "split": "..."}}
```
The system prompt is the one the assistant builds at runtime: the rules, then the DDL of the retrieved tables
(wide tables pruned to join keys plus the relevant columns), then the glossary entries. It is capped at about
3,584 tokens so the whole prompt fits a 4,096-token window.
## Splits
| tier | train | validation | test |
|---|---|---|---|
| T1 (single table, simple) | 284 | 17 | 37 |
| T2 | 463 | 28 | 56 |
| T3 | 471 | 34 | 58 |
| T4 | 143 | 10 | 19 |
| T5 (hardest) | 80 | 6 | 9 |
| **total** | **1,441** | **95** | **179** |
- **Split by `meta.group`.** Paraphrases and variants of one question always land in the same split, so no test group
appears in train.
- **Kinds.** `ask` is a plain question. `followup` carries conversation history. `repair-exec` and `repair-parse`
give the model a failed query and its Oracle or parse error, and the target is the corrected query.
- **Sources.** `S2-templated` rows are generated from templates, `S6-repair` rows are repair cases, and
`S1-golden` rows are hand-written (test split only).
## Usage
```python
from datasets import load_dataset
ds = load_dataset("samrat-kar/ap-sql-peft")
```
## Limitations
- Covers one synthetic schema.
- Most rows are templated, so question phrasing is less varied than real user traffic.
- Oracle SQL dialect only.