Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
id: string
template: string
family: string
split: string
params: struct<city: string, year: int64, category: string>
  child 0, city: string
  child 1, year: int64
  child 2, category: string
question: string
gold_sql: string
ordered: bool
dbs: list<item: string>
  child 0, item: string
cf_edits: list<item: string>
  child 0, item: string
cf_kinds: list<item: string>
  child 0, item: string
gold: list<item: list<item: list<item: int64>>>
  child 0, item: list<item: list<item: int64>>
      child 0, item: list<item: int64>
          child 0, item: int64
paraphrases: list<item: string>
  child 0, item: string
mutants: struct<count_rows: string, count_orders: string, join_fanout: string, missing_refunds: string, no_st (... 20 chars omitted)
  child 0, count_rows: string
  child 1, count_orders: string
  child 2, join_fanout: string
  child 3, missing_refunds: string
  child 4, no_status_filter: string
mutant_blind: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
  child 0, count_rows: bool
  child 1, count_orders: bool
  child 2, join_fanout: bool
  child 3, missing_refunds: bool
  child 4, no_status_filter: bool
mutant_caught: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
  child 0, count_rows: bool
  child 1, count_orders: bool
  child 2, join_fanout: bool
  child 3, missing_refunds: bool
  child 4, no_status_filter: bool
mutant_catchable: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
  child 0, count_rows: bool
  child 1, count_orders: bool
  child 2, join_fanout: bool
  child 3, missing_refunds: bool
  child 4, no_status_filter: bool
n_errors: int64
items: int64
drops: struct<no_preserving_or_changing_cf: int64, degenerate: int64>
  child 0, no_preserving_or_changing_cf: int64
  child 1, degenerate: int64
errors: list<item: null>
  child 0, item: null
to
{'items': Value('int64'), 'drops': {'no_preserving_or_changing_cf': Value('int64'), 'degenerate': Value('int64')}, 'errors': List(Value('null')), 'n_errors': Value('int64')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 274, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 544, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 3074, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2578, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2603, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 577, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 459, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 373, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2394, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2322, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              id: string
              template: string
              family: string
              split: string
              params: struct<city: string, year: int64, category: string>
                child 0, city: string
                child 1, year: int64
                child 2, category: string
              question: string
              gold_sql: string
              ordered: bool
              dbs: list<item: string>
                child 0, item: string
              cf_edits: list<item: string>
                child 0, item: string
              cf_kinds: list<item: string>
                child 0, item: string
              gold: list<item: list<item: list<item: int64>>>
                child 0, item: list<item: list<item: int64>>
                    child 0, item: list<item: int64>
                        child 0, item: int64
              paraphrases: list<item: string>
                child 0, item: string
              mutants: struct<count_rows: string, count_orders: string, join_fanout: string, missing_refunds: string, no_st (... 20 chars omitted)
                child 0, count_rows: string
                child 1, count_orders: string
                child 2, join_fanout: string
                child 3, missing_refunds: string
                child 4, no_status_filter: string
              mutant_blind: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
                child 0, count_rows: bool
                child 1, count_orders: bool
                child 2, join_fanout: bool
                child 3, missing_refunds: bool
                child 4, no_status_filter: bool
              mutant_caught: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
                child 0, count_rows: bool
                child 1, count_orders: bool
                child 2, join_fanout: bool
                child 3, missing_refunds: bool
                child 4, no_status_filter: bool
              mutant_catchable: struct<count_rows: bool, count_orders: bool, join_fanout: bool, missing_refunds: bool, no_status_fil (... 10 chars omitted)
                child 0, count_rows: bool
                child 1, count_orders: bool
                child 2, join_fanout: bool
                child 3, missing_refunds: bool
                child 4, no_status_filter: bool
              n_errors: int64
              items: int64
              drops: struct<no_preserving_or_changing_cf: int64, degenerate: int64>
                child 0, no_preserving_or_changing_cf: int64
                child 1, degenerate: int64
              errors: list<item: null>
                child 0, item: null
              to
              {'items': Value('int64'), 'drops': {'no_preserving_or_changing_cf': Value('int64'), 'degenerate': Value('int64')}, 'errors': List(Value('null')), 'n_errors': Value('int64')}
              because column names don't match

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

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 · Data · Demo · Adapters: sft · grpo-single-db · 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).

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.

Downloads last month
-

Models trained or fine-tuned on counterfactual-sql/counterfactual-sql-data