--- license: cc-by-nc-4.0 language: [en] tags: [text-to-sql, reward-modeling, reward-hacking, grpo, counterfactual, sqlite] pretty_name: Counterfactual-database rewards for text-to-SQL RL --- # Counterfactual-database rewards: data, results and rollouts Paper: *Single-Database Rewards Are Hackable: Counterfactual Execution for Trustworthy Text-to-SQL RL* (Shreshth Rai, Rishii Kumar Singh, Aksh Aggarwal; AIMS-DTU, Delhi Technological University). [Code and paper](https://github.com/RishiiGamer2201/counterfactual-sql-rewards) · [Data](https://huggingface.co/datasets/counterfactual-sql/counterfactual-sql-data) · [Demo](https://huggingface.co/spaces/counterfactual-sql/counterfactual-sql-demo) · Adapters: [sft](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-sft) · [grpo-single-db](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-grpo-single-db) · [grpo-cf](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-grpo-cf) Every number in the paper is re-derived from these files (`verify_all.py` and `paper/scripts/check_numbers.py` in the code repo). ```python import tarfile from huggingface_hub import snapshot_download d = snapshot_download("counterfactual-sql/counterfactual-sql-data", repo_type="dataset") for split in ("audit", "train", "test"): tarfile.open(f"{d}/{split}/dbs.tar.gz").extractall(f"{d}/{split}") # SQLite DBs next to items.jsonl ``` | Path | What | |---|---| | `{audit,train,test}/items.jsonl` | Questions, reference SQL, database paths, reference results on the original and the copies | | `{audit,train,test}/dbs.tar.gz` | SQLite databases: originals and counterfactual copies | | `sft*.jsonl`, `dpo_*.jsonl` | SFT trajectories and DPO pairs | | `results/` | Every result file of the paper: reward audits, test trajectories (`traj_.jsonl`), Spider runs, seeds, LeakySQL pilot | | `runs/grpo__rewards.jsonl` | Every GRPO rollout with its final SQL, reward and per-database pass vector (seeds 0-2, curriculum, LeakySQL) | | `runs/traj_sft_ho_grpoprompts.jsonl` | SFT rollouts on the GRPO prompts, replayed by the partial-credit and period-copy analyses | Synthetic retail data from a seeded generator; no personal data. Rollouts contain outputs of Tiny Aya Global (CC-BY-NC-4.0) and Cohere Command A, hence the non-commercial licence. `results/spider_*.jsonl` hold rows from Spider databases (Yu et al. 2018; test-suite DBs from Zhong et al. 2020) and are CC BY-SA 4.0.