YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
pairset/ — a million (gold, neighbour) SQL pairs over the whole BIRD+Spider training set
What this is, in one paragraph
A pair is a gold SQL query from the training corpus and a neighbour: another query that is close to it but means something else. The point of a pair is what happens when you run both on a database. If the two give the same answer, the execution reward that trains a text-to-SQL model pays full marks for the wrong query — that is spurious correctness, the problem this campaign exists to fix. A better environment database is one where the two give different answers, so the reward stops paying for the wrong query. This directory builds the pairs, runs them on the original training databases, records which ones the original databases cannot tell apart, and gives you one script that asks any candidate database tree how many of those it can tell apart.
Where the pairs come from
Everything starts from the training corpus the released FINER-SQL 0.5B reads,
data/train/grpo_sql_writer_origdata_joint_oldprompt_full: 18,087 training samples
(9,428 BIRD train + 8,659 Spider train) over 215 training databases (69 BIRD + 146
Spider), holding 14,045 distinct golds. No dev question and no dev database is read
anywhere in this directory.
Two generators write the neighbours:
| generator | what it is | pairs |
|---|---|---|
finer_sql_enrichment |
FINER-SQL's own training-SQL enrichment — the reference SQLs the corpus already carries next to each gold (groundtruth_sqls[1:]), written by a model. These are the pairs the valuefill inventory counts. |
135,454 |
mutant_grammar |
The campaign's own near-miss generator, mining_v2/v7/coredb/mutant_grammar.py, used unchanged: one AST edit at a time (drop a conjunct, swap < for <=, toggle DISTINCT, swap an aggregate, change the join type, move the limit, …) and then pairs of those edits. Its operator families come from Tuya et al. 2007's SQL mutation operators and the Zhong et al. 2020 test-suite neighbourhood. |
911,878 |
| total | 1,047,332 |
A neighbour is kept only if it parses and its normalised form differs from the
gold's, and only once per gold — duplicates are removed on the normalised SQL that
valuefill_agents/src/enrichment_pipeline/grouping.py computes (names lower-cased, table
aliases resolved, AND/OR members sorted, literal values abstracted). Every pair records
which generator wrote it, which operator, which training samples its gold serves, and what
kind of difference it is (grouping.classify_mutation: join_changed,
comparison_changed, distinct_changed, aggregate_changed, …).
What a pair row carries
Enough to check a pair by hand without opening the corpus:
| column | what it is |
|---|---|
pair_id |
sha256 of [dataset, db_id, gold_sql, neighbor_sql]; stable across rebuilds, and the key the execution results join on |
gold_id, gold_sql, neighbor_sql |
the pair itself |
question |
the training question the gold answers |
evidence |
BIRD's external knowledge for that question, read out of prompt_raw; empty for Spider |
dataset, db_id |
bird/spider and the training database |
source_sample_ids |
every training sample whose gold this is |
reference_index |
the neighbour's position in that sample's groundtruth_sqls (-1 for a generated mutant) |
neighbor_origin |
where the neighbour came from, in words: the sample and list, or the gold it was mutated from |
prompt_sha256 |
sha256 of the rendered prompt the trainer sees |
operator, parent_sql |
for mutant_grammar: the AST edit and the SQL it was applied to |
provenance_check, provenance_note |
ok / misaligned_in_corpus / builder_error, and the evidence — see below |
mutation_class, mutation_aspects, gold_family, neighbor_family, strategy_family, gold_l1, neighbor_l1 |
grouping.py's classification |
label, gold_row_count, neighbor_row_count, exec_flags |
added by execute_pairs.py label |
Provenance audit — the neighbour that answers a different question
The owner flagged a pair on 2026-09-20: pair
068d7468e1556296b74cf0b6fade5a6d8c535315fbb26beb421b15ac17ad963f, bird / airline,
gold "…COUNT(T1.Code) … WHERE T2.FL_DATE = '2018/8/15' AND T1.Description = 'Lake
Charles, LA: Lake Charles Regional'", neighbour "SELECT SUM(CASE WHEN dep_delay <= 0 …)
FROM airlines WHERE fl_date = '2018/8/1'". The neighbour answers a different question.
The fault is in the corpus, not in this builder. verify_extraction.py re-derives
every finer_sql_enrichment pair straight from the corpus and reports 0 builder
errors: datasets.load_from_disk opens only the data-00000-of-00001.arrow that
state.json declares (never one of the six cache-*.arrow map caches beside it), every
pair stands verbatim in the corpus as a (groundtruth_sqls[0], groundtruth_sqls[j])
occurrence of the sample it names, and every pair_id is the digest of its own fields.
The corpus row itself — row 16702, sample_id 5849 — carries eleven dep_delay
references at indices 1..11 and its own Lake Charles references at 12..27. Those eleven
belong to sample_id 5854, "How many flights departed on time on 8/1/2018?", five
sample ids later in the same database. The shift is systematic: a block of a LATER
sample's references sits at the head of an EARLIER sample's list, one to ten sample ids
away, always inside the same database.
provenance.py names it. A pair is misaligned_in_corpus when both hold, so a
reference is never accused just for being phrased differently:
- another gold of the same database is strictly closer to the neighbour than the gold it is attached to (closeness = Jaccard over tables, columns and string values), and
- the neighbour mentions a string value or a table the gold never mentions.
Numeric literals are ignored on purpose — a legitimate rewrite invents numbers all the
time (COALESCE(DEP_DELAY, 999), LIMIT 1, CASE WHEN … THEN 1 ELSE 0 END) without
changing the question. A double-quoted token counts as a value, because SQLite reads
WHERE city_name = "boulder" as a string and Spider's golds are written that way.
| generator | pairs | ok |
misaligned_in_corpus |
builder_error |
|---|---|---|---|---|
finer_sql_enrichment |
135,454 | 103,721 | 31,733 (23.4 %) | 0 |
mutant_grammar |
911,878 | 911,878 | 0 | 0 |
The owner's pair now reads
provenance_check = misaligned_in_corpus, provenance_note = "belongs to sample 5854 of the same database (closeness 1.00 vs 0.20); string values not in the gold: 2018/8/1".
Mis-attached pairs are kept and marked, never silently dropped: the pair_id and the
execution result of every pair are unchanged, so every earlier join still works. A tree
comparison must filter to provenance_check == "ok" — a database that separates a
neighbour answering a different question has proved nothing.
The corrected corpus
The same defect is a live training bug, because the trainer reads the whole list:
grpo_writer.py:1264 binds groundtruth_sqls, the binary execution match at
grpo_writer.py:1346 uses entry 0 only, but the atomic-ops shaping bonus at
grpo_writer.py:1410 / :1448 calls atomic_ops/reward.py:score_against_list, which
takes the maximum similarity over every entry. A reference belonging to another
question pays a shaping bonus to a prediction that answers that other question.
fix_corpus.py rebuilds the corpus into a new directory (the input is never touched),
putting every reference through four gates against the gold it is attached to — it
parses; it returns the gold's answer on the original database (through the
db_execution API, canonical comparator, at the trainer's own 60 s ceiling); no other gold
of the database is a better owner; and it is not a duplicate of the gold or of a
reference the sample already keeps — and then offering every removed reference back to
the samples of its own database, which is how the shifted blocks reach their real owner.
The tables a reference reads are not a gate: FINER-SQL's reward asks for the gold's
answer, not its tables, so an alternative SQL that joins an extra table and still
returns the gold's answer is kept (11,953 of them do); the check survives as the
informational reads_extra_tables field in reference_audit.jsonl.
References 239,338 → 122,450, of which 15,830 are re-attached to a different
sample. Every one of the 132,718 removed occurrences is listed with its reason in
removed_references.jsonl, and the per-reason, per-dataset table is in FIX_REPORT.md
(also committed as CORPUS_FIX_REPORT.md). diff_corpus.py proves that row count, row
order, every other column and every benchmark gold are identical.
What running the pairs tells you
execute_pairs.py runs every gold and every neighbour on the original training
databases and labels each pair:
tied— both ran and gave the same answer. The original database cannot tell them apart, so the reward would pay for the neighbour. These are the pairs that matter.separated— both ran and the answers differ.gold_error/neighbor_error/both_error— one or both did not run.
"The same answer" is asked with the campaign's canonical comparator (md5
264515cd3aecc5870706ff8a4945267b): list equality when the gold has an ORDER BY,
multiset equality otherwise. verify_comparator.py re-runs the real comparator on a sample
and asserts the stored digests decide identically.
The tied count is the denominator of record. Every tree is scored against that same
fixed set — a tree never gets to shrink it by failing to execute something.
Comparing databases
evaluate_trees.py takes the tied pairs and one or more database trees and reports, per
dataset and per kind of difference, how many of them the tree separates — plus how many
golds come back empty on that tree, which the method forbids and which is therefore
reported beside the catch rate and never folded into it.
That is the owner's question: does the new agent-filled CoRE-DB separate these pairs better
than the shared frozen tree 305f5047, which is the tree the released FINER-SQL 0.5B was
trained on (34.94 % BIRD / 65.47 % Spider)?
Rules this directory keeps
- All SQL goes through the
db_executionHTTP API. Nosqlite3handle is opened anywhere underpairset/. The endpoints are inendpoints.json, transcribed from the ops session'svaluefill_agents/PAIRSET_API_ENDPOINTS.md. - Training databases only. Dev questions and dev databases are never read.
- CPU only, at most 32 local workers, no GPU.
The files
| file | what it does |
|---|---|
sources.py |
names the corpus and counts it; opens no database |
build_pairs.py |
builds the pair set (about 6 minutes on 24 cores) |
provenance.py |
the one definition of "does this neighbour belong to this gold?" |
verify_extraction.py |
proves the builder did not mis-pair anything |
provenance_audit.py |
counts the provenance verdicts over the whole pair set |
fix_corpus.py |
rebuilds the corpus with every reference re-attached to its own sample |
diff_corpus.py |
proves the corrected corpus differs only in its references |
exec_api.py |
the only door to a database, and the tie test |
execute_pairs.py |
run executes; label writes the tie labels |
verify_comparator.py |
proves the stored digests agree with the canonical comparator |
evaluate_trees.py |
scores any tree against the tied pairs |
endpoints.json |
the API endpoints of record |
MANIFEST.md |
every count, every sha256, and the exact commands |
Dumps live under data/ and are not committed (.gitignore); MANIFEST.md carries
their counts and digests.
Hugging Face
Pair shards, the original-DB execution results, summary.json, MANIFEST.md, and a
dataset card are published at
https://huggingface.co/datasets/thanhdath/finer-sql-gold-neighbour-pairs (public, gated
with manual approval). The corrected training corpus is published separately at
https://huggingface.co/datasets/thanhdath/finer-sql-train-joint-fixed.
- Downloads last month
- 18