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 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-sql
|
| 7 |
+
- bird
|
| 8 |
+
- spider
|
| 9 |
+
- finer-sql
|
| 10 |
+
- training-data
|
| 11 |
+
size_categories:
|
| 12 |
+
- 10K<n<100K
|
| 13 |
+
configs:
|
| 14 |
+
- config_name: default
|
| 15 |
+
data_files:
|
| 16 |
+
- split: train
|
| 17 |
+
path: bird_train_no_gen_table.tar.gz
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# FINER-SQL — Training Resources Bundle
|
| 21 |
+
|
| 22 |
+
Convenience bundle of all the data assets needed to **train and evaluate**
|
| 23 |
+
[FINER-SQL](https://github.com/thanhdath/finer-sql) on BIRD-bench. Companion to
|
| 24 |
+
the [`thanhdath/FINER-SQL-3B-BIRD`](https://huggingface.co/thanhdath/FINER-SQL-3B-BIRD)
|
| 25 |
+
and [`thanhdath/FINER-SQL-3B-BIRD-no-gen`](https://huggingface.co/thanhdath/FINER-SQL-3B-BIRD-no-gen)
|
| 26 |
+
model cards.
|
| 27 |
+
|
| 28 |
+
> ⚠️ The training pipeline — single-GPU continual GRPO from
|
| 29 |
+
> `FINER-SQL-3B-BIRD` to a no-gen specialist — is documented in
|
| 30 |
+
> [`TRAIN_3B_BIRD_NO_GEN.md`](https://github.com/thanhdath/finer-sql/blob/dev/TRAIN_3B_BIRD_NO_GEN.md).
|
| 31 |
+
> This dataset gives you everything in §4 of that guide in one place.
|
| 32 |
+
|
| 33 |
+
## Files
|
| 34 |
+
|
| 35 |
+
| File | Size (compressed) | Size (extracted) | What is it |
|
| 36 |
+
|---|---|---|---|
|
| 37 |
+
| `bird_dev.tar.gz` | ~1.0 GB | ~3.5 GB | BIRD dev release: `dev_databases/`, `dev_gold.sql`, `dev.json`. Required by the official BIRD evaluator (`evaluation_bird_ex.py`) and by the SQL execution sandbox. |
|
| 38 |
+
| `bird_train.tar.gz` | ~10 GB | ~40 GB | BIRD train databases (`train_databases/`). Required for GRPO reward — the trainer executes both candidate and gold SQLs against these SQLites. |
|
| 39 |
+
| `bird_train_no_gen_table.tar.gz` | 3.4 MB | 60 MB | HuggingFace `Dataset` arrow file with **9 428 BIRD train prompts in vanilla / no-gen-table format** (top-30 GRAST columns + raw schema, no LLM-generated meanings). The training set used for the no-gen specialist. |
|
| 40 |
+
| `gt_rows_cache.pkl.gz` | 17 MB | 76 MB | Pickled `{(dataset, db_id, gold_sql): rows}` cache of executed gold SQLs for both BIRD train and dev. Speeds up the first 1–2 epochs of GRPO reward computation by 5–10× (no need to re-execute every gold). |
|
| 41 |
+
|
| 42 |
+
## Quick download (everything)
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
# Bulk download
|
| 46 |
+
huggingface-cli download thanhdath/finer-sql-training-bundle \
|
| 47 |
+
--repo-type dataset \
|
| 48 |
+
--local-dir ~/finer-sql-data --local-dir-use-symlinks False
|
| 49 |
+
|
| 50 |
+
# Layout it into the paths the training scripts expect
|
| 51 |
+
cd ~/finer-sql-data
|
| 52 |
+
mkdir -p ~/data/bird ~/data/grast-sql-data/data-train
|
| 53 |
+
|
| 54 |
+
tar xf bird_dev.tar.gz -C ~/data/bird/ # → dev/dev_databases, dev_gold.sql, dev.json
|
| 55 |
+
mkdir -p ~/data/bird/dev && mv ~/data/bird/dev_* ~/data/bird/dev/ 2>/dev/null || true
|
| 56 |
+
mkdir -p ~/data/bird/train && tar xf bird_train.tar.gz -C ~/data/bird/train/
|
| 57 |
+
tar xf bird_train_no_gen_table.tar.gz -C ~/data/grast-sql-data/data-train/
|
| 58 |
+
|
| 59 |
+
gunzip -c gt_rows_cache.pkl.gz > ~/data/gt_rows_cache.pkl
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
After this, the canonical paths used by `train_bird_no_gen_table_v2.sh`,
|
| 63 |
+
`eval_final_3b_bird.sh`, and `reproduce.py` are populated:
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
~/data/bird/dev/dev_databases/ ← BIRD_DB_ROOT
|
| 67 |
+
~/data/bird/dev/dev_gold.sql ← BIRD_GOLD
|
| 68 |
+
~/data/bird/dev/dev.json ← BIRD_DIFF
|
| 69 |
+
~/data/bird/train/train_databases/ ← used by db_execution/api.py
|
| 70 |
+
~/data/grast-sql-data/data-train/grpo_sql_writer_bird_train_no_gen_table/
|
| 71 |
+
~/data/gt_rows_cache.pkl
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Selective download (just what you need)
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
from huggingface_hub import hf_hub_download
|
| 78 |
+
|
| 79 |
+
# Only the no-gen training arrow (60 MB extracted) — for re-running GRPO
|
| 80 |
+
hf_hub_download("thanhdath/finer-sql-training-bundle",
|
| 81 |
+
"bird_train_no_gen_table.tar.gz", repo_type="dataset",
|
| 82 |
+
local_dir="~/finer-sql-data")
|
| 83 |
+
|
| 84 |
+
# Only the GT cache (76 MB extracted) — speeds up reward calc
|
| 85 |
+
hf_hub_download("thanhdath/finer-sql-training-bundle",
|
| 86 |
+
"gt_rows_cache.pkl.gz", repo_type="dataset",
|
| 87 |
+
local_dir="~/finer-sql-data")
|
| 88 |
+
|
| 89 |
+
# Only the BIRD dev (3.5 GB extracted) — for evaluation
|
| 90 |
+
hf_hub_download("thanhdath/finer-sql-training-bundle",
|
| 91 |
+
"bird_dev.tar.gz", repo_type="dataset",
|
| 92 |
+
local_dir="~/finer-sql-data")
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## Provenance
|
| 96 |
+
|
| 97 |
+
- **`bird_dev.tar.gz`** and **`bird_train.tar.gz`** are repackaged from the
|
| 98 |
+
public [BIRD-bench](https://bird-bench.github.io/) dev/train releases. The
|
| 99 |
+
archives are byte-identical to extracting the upstream zips. Original license
|
| 100 |
+
applies.
|
| 101 |
+
- **`bird_train_no_gen_table.tar.gz`** is generated by the [GRAST-SQL](https://github.com/thanhdath/grast-sql)
|
| 102 |
+
schema-linker pipeline on top of the BIRD train split. The `messages`
|
| 103 |
+
column renders the chat template; `groundtruth_sqls` carries the (multiple)
|
| 104 |
+
acceptable golds per question.
|
| 105 |
+
- **`gt_rows_cache.pkl.gz`** is built from BIRD train + dev gold SQLs by
|
| 106 |
+
[`build_gt_cache.py`](https://github.com/thanhdath/finer-sql/blob/dev/build_gt_cache.py)
|
| 107 |
+
(no human labour beyond the upstream gold SQLs).
|
| 108 |
+
|
| 109 |
+
## Reproducing FINER-SQL with this bundle
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
git clone https://github.com/thanhdath/finer-sql.git && cd finer-sql
|
| 113 |
+
|
| 114 |
+
export BIRD_DB_ROOT=~/data/bird/dev/dev_databases/
|
| 115 |
+
export BIRD_GOLD=~/data/bird/dev/dev_gold.sql
|
| 116 |
+
export BIRD_DIFF=~/data/bird/dev/dev.json
|
| 117 |
+
|
| 118 |
+
# Stand up the SQL executor sandbox (point it at ~/data/bird/{train,dev})
|
| 119 |
+
cd db_execution && uvicorn api:app --host 0.0.0.0 --port 8001 --workers 8 &
|
| 120 |
+
cd ..
|
| 121 |
+
|
| 122 |
+
# Continual GRPO from the joint BIRD+Spider checkpoint → no-gen specialist
|
| 123 |
+
bash train_bird_no_gen_table_v2.sh
|
| 124 |
+
|
| 125 |
+
# Evaluate every saved checkpoint
|
| 126 |
+
for s in 20 40 60 80 100; do
|
| 127 |
+
bash eval_final_3b_bird.sh \
|
| 128 |
+
output/grpo_bird_3b_no_gen_table_v2/checkpoint-$s \
|
| 129 |
+
~/data/grast-sql-data/data-train/.../bird_dev_top30_prompts_v2_no_gen_table \
|
| 130 |
+
no_gen_step_$s 0
|
| 131 |
+
done
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
## Citation
|
| 135 |
+
|
| 136 |
+
```bibtex
|
| 137 |
+
@article{finer-sql-2026,
|
| 138 |
+
title = {FINER-SQL: Fine-grained reasoning rewards for small Text-to-SQL models},
|
| 139 |
+
author = {Thanh Dat and others},
|
| 140 |
+
year = {2026},
|
| 141 |
+
}
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
BIRD-bench:
|
| 145 |
+
|
| 146 |
+
```bibtex
|
| 147 |
+
@inproceedings{li2023bird,
|
| 148 |
+
title = {{Can LLM Already Serve as a Database Interface? A {BIG} Bench for Large-Scale Database Grounded Text-to-SQLs}},
|
| 149 |
+
author = {Li, Jinyang and Hui, Binyuan and Qu, Ge and Yang, Jiaxi and Li, Binhua and Li, Bowen and Wang, Bailin and Qin, Bowen and Cao, Ruiying and others},
|
| 150 |
+
booktitle = {NeurIPS},
|
| 151 |
+
year = {2023}
|
| 152 |
+
}
|
| 153 |
+
```
|