Add CoSQL-S2T, SParC-S2T and Spider-S2T test sets and dataset card
Browse filesFiles changed (4)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124---license: cc-by-sa-4.0language:- enpretty_name: SQL2Text Semantic Captioning Benchmarktask_categories:- text-generationtags:- sql- sql2text- semantic-captioning- code- in-context-learningsize_categories:- n<1Kconfigs:- config_name: cosql_s2t data_files: - split: test path: cosql_s2t/test-00000-of-00001.parquet- config_name: sparc_s2t data_files: - split: test path: sparc_s2t/test-00000-of-00001.parquet- config_name: spider_s2t data_files: - split: test path: spider_s2t/test-00000-of-00001.parquet---
# SQL2Text: a semantic captioning benchmark
Test sets for **SQL2Text**, the task of describing a SQL query in natural language (semantic captioning, thereverse of Text2SQL). They were introduced in
> Ali Al-Lawati, Jason Lucas, Prasenjit Mitra.> [Semantic Captioning: Benchmark Dataset and Graph-Aware Few-Shot In-Context Learning for SQL2Text](https://aclanthology.org/2025.coling-main.536/).> COLING 2025.
A SQL query can be described correctly in many ways, so a single reference question, as found in Text2SQLdatasets, is a weak target for the reverse task. Each query here therefore comes with several referencecaptions: three written by GPT-4o through an iterative generate, review and refine prompt, plus the originalhuman-written question from the source dataset where that question passed validation.
## Contents
Three configurations, each with a single `test` split.
| Configuration | Source dataset | Queries | Generated captions | Original questions | Total references || --- | --- | ---: | ---: | ---: | ---: || `cosql_s2t` | CoSQL, dev | 290 | 870 | 280 | 1,150 || `sparc_s2t` | SParC, dev | 289 | 867 | 282 | 1,149 || `spider_s2t` | Spider, dev | 274 | 822 | 273 | 1,095 || Total | | 853 | 2,559 | 835 | 3,394 |
```pythonfrom datasets import load_dataset
ds = load_dataset("aliwister/SQL2Text", "spider_s2t", split="test")print(ds[0])# {'idx': 'spider-0',# 'query': 'SELECT count(*) FROM singer',# 'utterances': ['How many singers are there?',# 'Please provide the total number of singers.',# 'Can you count the total number of singers?',# 'How many singers do we have?'],# 'query_type': 'aggregate'}```
## Fields
| Field | Type | Description || --- | --- | --- || `idx` | string | Identifier of the example, for example `cosql-17`. Identifiers are unique within a configuration and are not contiguous, because some examples were removed during validation. || `query` | string | The SQL query to be captioned. || `utterances` | list of strings | The reference captions. The first three were generated by GPT-4o. When there is a fourth, it is the original question from the source dataset; it is absent where the original question did not pass validation. || `query_type` | string | `simple`, `aggregate` or `nested`, the grouping used for the per-type results in the paper. |
## How the data was built
1. **Source.** Query and question pairs from the development sets of the three source datasets: all 293 examples of CoSQL and random samples of 293 examples each from SParC and Spider. For the conversational datasets CoSQL and SParC, the pair is the final query and utterance of each interaction.2. **Generation.** For every query, GPT-4o followed a three-step prompt: generate three captions, review each one for accuracy, clarity, fluency and relevance to the query, then refine them using that feedback. The three references kept per query were chosen by AlignScore and BERTScore against the original question.3. **Validation.** Three evaluators with NLP and database experience checked every query together with its original question and generated captions for semantic accuracy, preservation of the SQL logic and technical precision (Fleiss' kappa 0.802). Inconsistent queries, original questions and captions were removed, which left the 853 queries above.
The prompt and the full protocol are in the paper.
## Use
The paper evaluates captions produced by a model for each `query` against the references in `utterances`, withBLEU-4, BERTScore and AlignScore. Few-shot demonstrations in the paper are drawn from the training sets of thesource datasets, which are not redistributed here. Code for the experiments, including the graph-awaredemonstration selection (AST-ICL), is at [github.com/aliwister/ast-icl](https://github.com/aliwister/ast-icl).
## Source datasets and licence
The queries and original questions come from [Spider](https://yale-lily.github.io/spider),[SParC](https://yale-lily.github.io/sparc) and [CoSQL](https://yale-lily.github.io/cosql), all distributedunder CC BY-SA 4.0. This dataset is released under the same licence. Please also cite the source datasetswhen using it.
## Citation
```bibtex@inproceedings{al-lawati-etal-2025-semantic, title = "Semantic Captioning: Benchmark Dataset and Graph-Aware Few-Shot In-Context Learning for {SQL}2{T}ext", author = "Al Lawati, Ali and Lucas, Jason and Mitra, Prasenjit", booktitle = "Proceedings of the 31st International Conference on Computational Linguistics", month = jan, year = "2025", address = "Abu Dhabi, UAE", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2025.coling-main.536/", pages = "8026--8042"}```123version https://git-lfs.github.com/spec/v1oid sha256:f832e30401761ad0fa5cf760c26691b604cec50e2188000d64622928543a1b0fsize 49561123version https://git-lfs.github.com/spec/v1oid sha256:0fb6b27e6a26377079295dce6dbdaadd8c718f4f0cd93efcf6d39935d58d58eesize 44995123version https://git-lfs.github.com/spec/v1oid sha256:645d51adddf61a8f62afe24825dae5fd96f55233747c84bcfeb5586ac17ef451size 45879README.mdAdded+124
cosql_s2t/test-00000-of-00001.parquetAdded+3
sparc_s2t/test-00000-of-00001.parquetAdded+3
spider_s2t/test-00000-of-00001.parquetAdded+3