Hyukkyu commited on
Commit
b8486e7
·
verified ·
1 Parent(s): 6782680

Gretel Synthetic Text-to-SQL: the unified schema (domain-v1, miner scores)

Browse files
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: Training · Gretel Synthetic Text-to-SQL
3
+ license: apache-2.0
4
+ language:
5
+ - en
6
+ multilinguality:
7
+ - monolingual
8
+ task_categories:
9
+ - text-retrieval
10
+ task_ids:
11
+ - document-retrieval
12
+ tags:
13
+ - train
14
+ - retrieval
15
+ - code
16
+ configs:
17
+ - config_name: corpus
18
+ data_files:
19
+ - split: train
20
+ path: corpus/train-*.parquet
21
+ - config_name: hard-negatives
22
+ data_files:
23
+ - split: train
24
+ path: hard-negatives/train-*.parquet
25
+ - config_name: qrels
26
+ data_files:
27
+ - split: train
28
+ path: qrels/train-*.parquet
29
+ - config_name: queries
30
+ data_files:
31
+ - split: train
32
+ path: queries/train-*.parquet
33
+ - config_name: teacher-scores
34
+ data_files:
35
+ - split: train
36
+ path: teacher-scores/train-*.parquet
37
+ ---
38
+ # Gretel Synthetic Text-to-SQL — Training, unified schema
39
+
40
+ A seeded sample of [`gretelai/synthetic_text_to_sql`](https://huggingface.co/datasets/gretelai/synthetic_text_to_sql/tree/740ab236e64503fba51be1101df7a1be83bf455d), made into retrieval **training** pairs and reshaped into the strict schema shared by every dataset in this collection. One of the 15 domain sources (code, medical, science, finance, legal) added to the collection's general sources.
41
+
42
+ | | |
43
+ |---|---|
44
+ | Source | [`gretelai/synthetic_text_to_sql`](https://huggingface.co/datasets/gretelai/synthetic_text_to_sql/tree/740ab236e64503fba51be1101df7a1be83bf455d) @ `740ab236e645` |
45
+ | Task | question → schema and SQL |
46
+ | Domain · languages | code · eng |
47
+ | Queries / documents / qrels | 30,000 / 29,987 / 30,000 |
48
+ | Qrels per query | min 1 · mean 1.0 · max 1 |
49
+ | Score values | 2 ×30,000 (2: the first positive, 1: any other) |
50
+ | Layout | `queries` · `corpus` · `qrels` · `hard-negatives` · `teacher-scores`, split `train` |
51
+ | Splits | `corpus`: train · `hard-negatives`: train · `qrels`: train · `queries`: train · `teacher-scores`: train |
52
+ | Hard negatives | sources: `dense` · 1,769,501 rows |
53
+ | Teacher scores | `jinaai/jina-embeddings-v5-text-small` (the miner's cosine, not a reranker) · 1,799,501 rows (positives included) |
54
+ | Ids | `sha1(text)[:20]`; identical texts collapse to one document / query |
55
+ | License | `apache-2.0` |
56
+
57
+ ## Schema
58
+
59
+ | config | columns | rules |
60
+ |---|---|---|
61
+ | `queries` | `id: string`, `text: string` | ids unique and non-empty; every query has ≥ 1 qrel |
62
+ | `corpus` | `id: string`, `title: string`, `text: string` | `title` is always present (`""` when the source has none) |
63
+ | `qrels` | `query-id: string`, `corpus-id: string`, `score: int32` | referential integrity to both tables; no duplicate pairs; no floats |
64
+ | `hard-negatives` | `query-id: string`, `corpus-id: string`, `rank: int32`, `source: string` | one row per negative; `(query-id, corpus-id, source)` unique; never a labelled positive of the same query |
65
+ | `teacher-scores` | `query-id: string`, `corpus-id: string`, `teacher: string`, `score: float32` | one row per scored pair (positives included); a row *means* scored — never a placeholder |
66
+
67
+ Files are Parquet, sorted by id, zstd-compressed, sharded at 500 MB. Every rule above is checked before publishing; `provenance.json` records the source revision, what changed, and the output file hashes.
68
+
69
+ ## What changed from the source
70
+
71
+ - **sampled**: a seeded random sample (seed 1) of up to 30,000 pairs
72
+ - **reshaped**: the question (`sql_prompt`) is the query; the document is the schema (`sql_context`), a newline and the SQL (`sql`)
73
+ - **decontaminated (exact)**: a pair was dropped when its normalised query equals any evaluation query, or a positive equals a document of a test or dev corpus; a repeated query keeps its first pair
74
+ - **decontaminated (near-duplicates)**: 0 passages and 0 queries that nearly copy a text of an evaluation set (word 13-grams for passages, 8-grams for queries; at least half shared with one text of the 23 test corpora (BEIR, RTEB, LitSearch) and the 3 dev corpora) were removed, and with them 0 queries in total
75
+ - **text**: leading and trailing whitespace stripped; otherwise as converted above
76
+ - **ids** re-keyed to `sha1(text)[:20]`: 13 documents and 0 queries collapsed into identical texts
77
+ - added a `title` column filled with `""` (the source has none)
78
+
79
+ ## Hard negatives and teacher scores
80
+
81
+ Filled by the owner's domain pipeline (`convert_domain.py`, `mine_domain.py`), not yet by the annotation pipeline of the other repositories in this collection:
82
+
83
+ - **Corpus**: the source's own passages (its positives and the negatives it provides), not a larger collection.
84
+ - **Candidates**: dense retrieval with `jinaai/jina-embeddings-v5-text-small` (full length) over that corpus to depth 300; 60 candidates per query drawn from the rank windows 1–30 (30), 31–100 (20), 101–300 (10), the query's positives excluded. `rank` is the dense rank; `source` is `dense` for a mined row and `dataset` for a negative the source labels itself (ranked after the mined ones).
85
+ - **Teacher scores**: the miner's cosine between the query and passage embeddings, one row per (query, positive) and per (query, candidate), `teacher` = `jinaai/jina-embeddings-v5-text-small`. **Not a reranker**: the other repositories carry `jinaai/jina-reranker-v3.5` scores. Re-mining with the collection's plan (100 candidates to depth 1,000) and re-scoring with that reranker are under way; they will replace these two tables, and this section will say so.
86
+
87
+ | configs | queries | hard negatives | teacher scores |
88
+ |---|---:|---:|---:|
89
+ | `hard-negatives` · `teacher-scores` | 30,000 (all) | 1,769,501 (1,769,501 dense) | 1,799,501 |
90
+
91
+ ## Load it
92
+
93
+ ```python
94
+ from datasets import load_dataset
95
+ queries = load_dataset("Hyukkyu/train-text2sql", "queries", split="train")
96
+ corpus = load_dataset("Hyukkyu/train-text2sql", "corpus", split="train")
97
+ qrels = load_dataset("Hyukkyu/train-text2sql", "qrels", split="train")
98
+ negatives = load_dataset("Hyukkyu/train-text2sql", "hard-negatives", split="train")
99
+ scores = load_dataset("Hyukkyu/train-text2sql", "teacher-scores", split="train")
100
+ ```
101
+
102
+ ## License and attribution
103
+
104
+ The data is redistributed under the source's terms — `apache-2.0`. All credit belongs to the original authors; see the source repository (https://huggingface.co/datasets/gretelai/synthetic_text_to_sql). This repository is an independent repackaging.
corpus/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2bc5bf14c4baf0a3094bf15f97bc30d47af598e81b26e0d6773fc20abc447cf
3
+ size 3768645
hard-negatives/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73687cdf78d6269dde3db6bead258239d22539715190f670bc973c0838679d33
3
+ size 6259488
provenance.json ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "task": "Gretel Synthetic Text-to-SQL",
3
+ "benchmark": "train",
4
+ "repo": "train-text2sql",
5
+ "conversion": "2026-09-29",
6
+ "source": {
7
+ "path": "gretelai/synthetic_text_to_sql",
8
+ "revision": "740ab236e64503fba51be1101df7a1be83bf455d",
9
+ "url": "https://huggingface.co/datasets/gretelai/synthetic_text_to_sql/tree/740ab236e64503fba51be1101df7a1be83bf455d",
10
+ "configs": [],
11
+ "file": null
12
+ },
13
+ "license": {
14
+ "card": "apache-2.0",
15
+ "upstream_checked": true
16
+ },
17
+ "languages": [
18
+ "eng"
19
+ ],
20
+ "domain": "code",
21
+ "byte_preserving_text": false,
22
+ "symmetric": false,
23
+ "layout": {
24
+ "subsets": null,
25
+ "splits": [
26
+ "train"
27
+ ],
28
+ "split_map": null
29
+ },
30
+ "id_scheme": "sha1(text)[:20]",
31
+ "sampling": {
32
+ "cap": 30000,
33
+ "seed": 1,
34
+ "shuffle_buffer": null
35
+ },
36
+ "inputs": {
37
+ "queries": 30000,
38
+ "corpus": 30000,
39
+ "qrels": 30000,
40
+ "hard_negatives": 1770047,
41
+ "teacher_scores": 1800047
42
+ },
43
+ "decontamination": {
44
+ "exact": "the normalised query equals an evaluation query, or a positive equals a test / dev corpus document (convert_domain.py)",
45
+ "near_duplicate": "word 13-gram shingles of passages, 8-grams of queries, a fixed 1/4 sample; flagged at >= half (and >= 4) shared with one text of the 23 test corpora and the 3 dev corpora (data/tmp/domain_overlap_flagged.py)",
46
+ "flagged_passages": 0,
47
+ "flagged_queries": 0,
48
+ "queries_dropped": 0
49
+ },
50
+ "normalize": {
51
+ "title_added": true,
52
+ "collapsed_queries": 0,
53
+ "collapsed_documents": 13,
54
+ "collapsed_with_other_titles": 0,
55
+ "negatives_that_were_positives_dropped": 26,
56
+ "score_spread_max": 0.0
57
+ },
58
+ "stats": {
59
+ "n_queries": 30000,
60
+ "n_corpus": 29987,
61
+ "n_qrels": 30000,
62
+ "qrels_per_query": {
63
+ "min": 1,
64
+ "mean": 1.0,
65
+ "max": 1
66
+ },
67
+ "score_values": {
68
+ "2": 30000
69
+ },
70
+ "corpus_with_title": 0,
71
+ "n_hard_negatives": 1769501,
72
+ "sources": {
73
+ "dense": 1769501
74
+ },
75
+ "negatives_per_query": 59.0,
76
+ "n_teacher_scores": 1799501,
77
+ "teachers": [
78
+ "jinaai/jina-embeddings-v5-text-small"
79
+ ],
80
+ "avg_query_chars": 83.2,
81
+ "avg_doc_chars": 402.7
82
+ },
83
+ "files": {
84
+ "queries": {
85
+ "train": [
86
+ {
87
+ "path": "queries/train-00000-of-00001.parquet",
88
+ "rows": 30000,
89
+ "bytes": 1204557,
90
+ "sha256": "b4c65e9e94d63ab89f7b45e5b6166a9fd505e20c436fbf4c7b7e4bd52059515b"
91
+ }
92
+ ]
93
+ },
94
+ "corpus": {
95
+ "train": [
96
+ {
97
+ "path": "corpus/train-00000-of-00001.parquet",
98
+ "rows": 29987,
99
+ "bytes": 3768645,
100
+ "sha256": "c2bc5bf14c4baf0a3094bf15f97bc30d47af598e81b26e0d6773fc20abc447cf"
101
+ }
102
+ ]
103
+ },
104
+ "qrels": {
105
+ "train": [
106
+ {
107
+ "path": "qrels/train-00000-of-00001.parquet",
108
+ "rows": 30000,
109
+ "bytes": 762903,
110
+ "sha256": "cc9fb2001d18919a81086f56978de577a0fd8b36a81198e72493c93bd23bc890"
111
+ }
112
+ ]
113
+ },
114
+ "hard-negatives": {
115
+ "train": [
116
+ {
117
+ "path": "hard-negatives/train-00000-of-00001.parquet",
118
+ "rows": 1769501,
119
+ "bytes": 6259488,
120
+ "sha256": "73687cdf78d6269dde3db6bead258239d22539715190f670bc973c0838679d33"
121
+ }
122
+ ]
123
+ },
124
+ "teacher-scores": {
125
+ "train": [
126
+ {
127
+ "path": "teacher-scores/train-00000-of-00001.parquet",
128
+ "rows": 1799501,
129
+ "bytes": 11828501,
130
+ "sha256": "9a3e81b3c6d9c9b143e4de4c3d083fc8dbff48a8dab81e2b52bbe6792a2785d7"
131
+ }
132
+ ]
133
+ }
134
+ }
135
+ }
qrels/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc9fb2001d18919a81086f56978de577a0fd8b36a81198e72493c93bd23bc890
3
+ size 762903
queries/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4c65e9e94d63ab89f7b45e5b6166a9fd505e20c436fbf4c7b7e4bd52059515b
3
+ size 1204557
teacher-scores/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a3e81b3c6d9c9b143e4de4c3d083fc8dbff48a8dab81e2b52bbe6792a2785d7
3
+ size 11828501