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<join_fanout: string, no_status_filter: string, shipped_only: string, missing_refunds: string, (... 86 chars omitted)
  child 0, join_fanout: string
  child 1, no_status_filter: string
  child 2, shipped_only: string
  child 3, missing_refunds: string
  child 4, no_distinct: string
  child 5, count_rows: string
  child 6, count_orders: string
  child 7, all_customers: string
mutant_blind: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
  child 0, join_fanout: bool
  child 1, no_status_filter: bool
  child 2, shipped_only: bool
  child 3, missing_refunds: bool
  child 4, no_distinct: bool
  child 5, count_rows: bool
  child 6, count_orders: bool
  child 7, all_customers: bool
mutant_caught: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
  child 0, join_fanout: bool
  child 1, no_status_filter: bool
  child 2, shipped_only: bool
  child 3, missing_refunds: bool
  child 4, no_distinct: bool
  child 5, count_rows: bool
  child 6, count_orders: bool
  child 7, all_customers: bool
mutant_catchable: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
  child 0, join_fanout: bool
  child 1, no_status_filter: bool
  child 2, shipped_only: bool
  child 3, missing_refunds: bool
  child 4, no_distinct: bool
  child 5, count_rows: bool
  child 6, count_orders: bool
  child 7, all_customers: bool
items: int64
errors: list<item: null>
  child 0, item: null
n_errors: int64
drops: struct<no_preserving_or_changing_cf: int64, degenerate: int64>
  child 0, no_preserving_or_changing_cf: int64
  child 1, degenerate: int64
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 272, 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 3052, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2559, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2584, 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 558, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 440, 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 361, 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 2381, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2309, 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<join_fanout: string, no_status_filter: string, shipped_only: string, missing_refunds: string, (... 86 chars omitted)
                child 0, join_fanout: string
                child 1, no_status_filter: string
                child 2, shipped_only: string
                child 3, missing_refunds: string
                child 4, no_distinct: string
                child 5, count_rows: string
                child 6, count_orders: string
                child 7, all_customers: string
              mutant_blind: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
                child 0, join_fanout: bool
                child 1, no_status_filter: bool
                child 2, shipped_only: bool
                child 3, missing_refunds: bool
                child 4, no_distinct: bool
                child 5, count_rows: bool
                child 6, count_orders: bool
                child 7, all_customers: bool
              mutant_caught: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
                child 0, join_fanout: bool
                child 1, no_status_filter: bool
                child 2, shipped_only: bool
                child 3, missing_refunds: bool
                child 4, no_distinct: bool
                child 5, count_rows: bool
                child 6, count_orders: bool
                child 7, all_customers: bool
              mutant_catchable: struct<join_fanout: bool, no_status_filter: bool, shipped_only: bool, missing_refunds: bool, no_dist (... 70 chars omitted)
                child 0, join_fanout: bool
                child 1, no_status_filter: bool
                child 2, shipped_only: bool
                child 3, missing_refunds: bool
                child 4, no_distinct: bool
                child 5, count_rows: bool
                child 6, count_orders: bool
                child 7, all_customers: bool
              items: int64
              errors: list<item: null>
                child 0, item: null
              n_errors: int64
              drops: struct<no_preserving_or_changing_cf: int64, degenerate: int64>
                child 0, no_preserving_or_changing_cf: int64
                child 1, degenerate: int64
              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-DB rewards for SQL agents: data, results and rollout logs

Lexsi Labs AI Safety & Alignment Hackathon, Track 3 (PS #6 data and database agents + #9 reward design and reward-hacking defences), team Teen_khapeetars: Shreshth Rai (lead, @hi-phi-r25i), Rishii Kumar Singh (@LogicPalette), Aksh Aggarwal (@AkshAgg).

Collections: models, data · Demo · Data · Adapters: SFT, GRPO-B, GRPO-C · Code · Write-up

Every number in the write-up is re-derived from these files by python verify_all.py in the code repo.

import tarfile
from huggingface_hub import snapshot_download

d = snapshot_download("sqlcf-lexsi/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, gold SQL, per-item DB paths and gold results on the original + counterfactual DBs
{audit,train,test}/dbs.tar.gz The SQLite DBs (original and counterfactual copies); extract in place
train/grpo_items.jsonl GRPO prompts (SFT pass rate in (0,1); 3 templates held out of SFT)
sft.jsonl, sft_all_templates.jsonl Scripted oracle trajectories for the SFT warm start
results/e0_*.json, results/e1_*.json, figure*.png Reward audit (FP/FN per reward) and blind rate vs DB size
results/traj_<model>.jsonl Test trajectories: base, sft, sft_ho, GRPO B, GRPO C, Command A, sft_distil (E9), dpo_std / dpo_cf (E10)
results/e4_eval.json Verified / single-DB accuracy, silent error, smuggling, pass^k, McNemar, bootstrap
results/a2_spider_lucky.json E6: Spider-dev lucky passes of 8 published systems (question indices only; predictions from bossben/ESMp, DBs from Zhong et al. 2020)
results/a3_skyrl_audit.json E7: SkyRL-SQL reward audit on the E0 candidates
results/a4_selfconsistency.json E8: gold-free majority vote and shaky-answer flag on the test trajectories
results/teacher_command_a.jsonl, results/d1_teacher_filter.json E9: Command A plan + SQL on the 353 SFT train items; lucky answers a single-DB filter would keep
sft_distil.jsonl E9: the SFT trajectories with the 211 counterfactual-verified teacher endings swapped in (traj_sft_distil is the resulting model)
runs/traj_sft_ho_grpoprompts.jsonl sft_ho's 2670 rollouts on the 445 GRPO prompts (G = 6, T = 1.0): the source of the E10 DPO pairs, replayed by E11 and E12
dpo_std.jsonl, dpo_cf.jsonl, results/dpo_pairs.json E10: DPO pairs from those rollouts, single-DB vs counterfactual labels (traj_dpo_<std,cf> are the resulting models)
results/e11_partial_credit.json E11: partial-credit rewards audited like E0 and replayed on the GRPO rollouts
results/e12_period_copies.json E12: period-edge copies vs date-filter bugs, and replayed on real answers (the copies are in <split>/dbs/*/period/)
runs/grpo_<B,C>_rewards.jsonl Every GRPO rollout: final SQL, reward, per-DB pass vector
runs/grpo_<B,C>/ lexsi_provenance.json, training config and stats

Synthetic e-commerce 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.

Downloads last month
3

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

Space using sqlcf-lexsi/counterfactual-sql-data 1

Collection including sqlcf-lexsi/counterfactual-sql-data