File size: 2,558 Bytes
5877747
8bf2b42
 
5877747
 
8bf2b42
 
 
 
 
 
 
 
 
 
 
5877747
8bf2b42
5877747
 
af4c31d
5877747
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bf2b42
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
language:
- en
license: cc-by-nc-4.0
pretty_name: Counterfactual-database rewards for text-to-SQL RL
task_categories:
- text-generation
tags:
- text-to-sql
- reward-modeling
- reward-hacking
- grpo
- counterfactual
- sqlite
- synthetic
- code
---

# Counterfactual-database rewards: data, results and rollouts

Paper: [*Single-Database Rewards Are Hackable: Counterfactual Execution for Trustworthy Text-to-SQL RL*](https://arxiv.org/abs/2611.34363)
(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_<model>.jsonl`), Spider runs, seeds, LeakySQL pilot |
| `runs/grpo_<arm>_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.