Handoff: Improve Selector Agent to reach BIRD-dev EX ≥ 67%
TL;DR
The MATS-SQL pipeline is stuck at ~60% selector EX on BIRD-dev. The validators are saturated (3 regimes — SFT, ORPO COLLAB, ORPO INDEP — all produce identical end-to-end EX within noise). The current selector picks the right SQL ~83% of the time when the right SQL is in the K=8 candidates (oracle@8 ≈ 71-72%, selector EX ≈ 60%).
Your job: lift selector EX from ~60% to ≥67%. Two main levers:
- Stronger selector model that picks the correct candidate more often given K=8 rollouts (need ~93% pick-rate to hit 67%).
- Higher oracle@8 ceiling via better/more diverse K=8 sampling, stronger planner, or stronger fixer (so selector has better candidates to choose from).
This doc describes the current state, all paths/files needed, what's been tried, and concrete experiment ideas.
1. Current numbers on full BIRD-dev (1534 questions, 1524 with usable db_path)
| Config | greedy@1 | oracle@8 | rule-based maj | trained selector EX |
|---|---|---|---|---|
| PLANNER-only | 51.54% | 70.80% | — | — |
| SFT-VF (paper validators) | 52.20% | 71.65% | 56.30% | 59.91% |
| ORPO COLLAB (paper) | 51.81% | 71.19% | 56.69% | 59.97% |
| ORPO INDEP (paper) | 52.59% | 71.95% | 56.64% | 60.31% |
Selector recall vs oracle: 60 / 72 ≈ 83%. To hit 67% EX with the same oracle ceiling, we'd need 93% pick-rate. To hit 67% with a stable 83% pick-rate, we'd need oracle@8 ≈ 80%.
Selector currently used: sft-selector-3B-griffith-v5 (Qwen2.5-Coder-3B SFT on griffith data). Hyperparameters are documented in AGENTS_REPORT.md.
2. Absolute paths to all checkpoints and data
Selector models
/weka/s225250685/mats-tist/alignment-handbook/output/sft-selector-3B-griffith-v5 ← current "v1" used in eval above
A second selector ("v2") was previously trained on 45k pairs built from iter1 rollouts:
/weka/s225250685/mats-tist/data/hf_selector_v2_from_orpo1 ← 32193 train + 1695 test pairs
The trained v2 model: was tried in earlier iter1 eval and gave the same ~60% as v1 (no improvement). Output dir may need to be checked at alignment-handbook/output/sft-selector-3B-v2-* if it exists, otherwise can be retrained from hf_selector_v2_from_orpo1.
Planner + Validator + Fixer checkpoints (used by pipeline; freeze for selector work)
/weka/s225250685/mats-tist/alignment-handbook/output/sft-planner-3B-griffith-v4 # Qwen2.5-Coder-3B, planner
/weka/s225250685/mats-tist/alignment-handbook/output/sft-validator-sel-llama1b-paper-v1 # paper-format val-sel SFT
/weka/s225250685/mats-tist/alignment-handbook/output/sft-validator-cond-llama1b-paper-v1 # paper-format val-cond SFT
/weka/s225250685/mats-tist/alignment-handbook/output/orpo-val-sel-collab-paper # paper-format val-sel ORPO collab
/weka/s225250685/mats-tist/alignment-handbook/output/orpo-val-sel-indep-paper # paper-format val-sel ORPO indep
/weka/s225250685/mats-tist/alignment-handbook/output/orpo-val-cond-collab-paper # paper-format val-cond ORPO collab
/weka/s225250685/mats-tist/alignment-handbook/output/orpo-val-cond-indep-paper # paper-format val-cond ORPO indep
/weka/s225250685/mats-tist/alignment-handbook/output/sft-fixer-llama1b-griffith-v5 # fixer
Pre-computed K=8 rollouts on BIRD-dev (use these to train + eval selectors offline — no GPU pipeline replay needed)
Each JSONL has 1469-1524 rows; each row = 1 question × 8 trajectories. Field per traj: planner_sql, planner_exec_ok, is_planner_correct, fixed_sql, is_fixed_correct, validator outputs (fb_select, fb_condition, fb_join, fb_order), full prompts.
/weka/s225250685/mats-tist/eval_results/paper_SFT_VF_passAt8_bird_dev.jsonl # 1524 rows
/weka/s225250685/mats-tist/eval_results/paper_COLLAB_par_passAt8_bird_dev.jsonl # 1524 rows
/weka/s225250685/mats-tist/eval_results/paper_INDEP_par_passAt8_bird_dev.jsonl # 1469 rows
Greedy (T=0, K=1) rollouts on BIRD-dev (for planner@1 / pipeline@1 sanity)
/weka/s225250685/mats-tist/eval_results/paper_greedy_PLANNER_ONLY_passAt1_bird_dev.jsonl # 1524 rows
/weka/s225250685/mats-tist/eval_results/paper_greedy_SFT_VF_passAt1_bird_dev.jsonl # 1524 rows
/weka/s225250685/mats-tist/eval_results/paper_greedy_COLLAB_passAt1_bird_dev.jsonl # 1524 rows
/weka/s225250685/mats-tist/eval_results/paper_greedy_INDEP_passAt1_bird_dev.jsonl # 1524 rows
BIRD-train rollouts (for selector training data)
/weka/s225250685/mats-tist/data/planner_3B_greedy_bird_train.jsonl # 9360 planner-3B greedy preds on BIRD-train; 5388 correct (57.6%)
You'll likely want K=8 BIRD-train rollouts too — generation script is scripts/run_pipeline_rollouts.py (used with --max_questions -1 and BIRD-train json).
Data builders for selector training
/weka/s225250685/mats-tist/scripts/build_selector_sft_data.py # selector v1 builder
/weka/s225250685/mats-tist/scripts/build_selector_v2_fast.py # selector v2 builder (used hf_selector_v2_from_orpo1)
/weka/s225250685/mats-tist/scripts/build_selector_v3_pairwise.py # exists but not used in v1/v2
/weka/s225250685/mats-tist/scripts/build_selector_v3_rich.py # ditto
/weka/s225250685/mats-tist/scripts/build_selector_v4_pairwise.py # ditto
/weka/s225250685/mats-tist/scripts/rich_schema.py # helper
Selector trainer
/weka/s225250685/mats-tist/scripts/train_sft_completion_only.py # used for all SFT (incl. selector v1)
Selector evaluator (read-only, no GPU pipeline needed)
/weka/s225250685/mats-tist/scripts/compute_bestofn_with_selector.py
Usage:
python scripts/compute_bestofn_with_selector.py \
eval_results/paper_SFT_VF_passAt8_bird_dev.jsonl \
paper_SFT_VF_selectorEX \
--selector_host http://localhost:PORT \
--row_preview
Where the selector host is a vLLM server hosting the selector model:
vllm serve <PATH_TO_SELECTOR> --served-model-name selector --port PORT \
--dtype bfloat16 --gpu-memory-utilization 0.85 \
--enforce-eager --max-model-len 4096
3. What's been tried (don't repeat)
- Selector v1 (
sft-selector-3B-griffith-v5): trained on griffith binary YES/NO labels (~9k pairs from griffith dataset). EX ≈ 59-60% across all pipeline configs. - Selector v2 (
hf_selector_v2_from_orpo1): trained on 45k pairs built from wrapper-tag iter1 rollouts (COLLAB, INDEP, SFT-VF). EX ≈ 60% — no improvement over v1. - Validator regime ablations: SFT, ORPO COLLAB, ORPO INDEP — all give same ~60% EX. The selector's bottleneck is not the validator quality.
- Schema format: switched from CodeS-style to griffith rich-NL, and from wrapper-tag to paper-format. No change in selector EX.
4. Bottleneck analysis (numbers, not opinions)
- planner@1 (greedy T=0): 51.54% — limited by the planner SFT
- oracle@8 (K=8 T=1.0): 71.95% — upper bound for selector
- selector picks 60/72 = 83% of available correct from K=8
- fixer adds < 1pp over planner-only (paper-format)
Gap to close = 67 − 60 = 7pp. Two paths (additive):
| Path | Mechanism | What it requires |
|---|---|---|
| A. Better selector | Pick-rate 83% → 93% with same K=8 candidates | More/better selector training data and/or stronger architecture |
| B. Better oracle ceiling | oracle@8 71% → 80% via more diverse K=8 or stronger planner/fixer | Re-sample K=8 with higher T / better-distilled planner / fixer that actually rescues wrong SQL |
A 5pp selector lift OR a 5pp oracle lift both move us to ~65%. Combined gets us past 67%.
5. Concrete experiment ideas (ranked by expected ROI)
E1. Train selector on pairwise preference data built from existing K=8 rollouts (highest leverage, fastest)
Each of the 3 K=8 rollout files has 1524 questions × 8 candidates = ~12k candidates per file. For each question:
- Pair (correct, wrong) candidates → preference pairs
- Train a Bradley-Terry-style selector or a binary "is this SQL correct?" classifier
Across 3 files = ~36k+ candidate sets. Use both is_planner_correct and is_fixed_correct for labels.
Build script template: scripts/build_selector_v3_pairwise.py (exists, not been used).
E2. Train selector on execution-result-aware features (instead of just SQL text)
Currently the selector sees (question, schema, SQL) and outputs YES/NO. It does NOT see the execution result. A selector that sees rows returned by each candidate SQL can directly compare exec outputs against the question, which is much higher-signal than syntactic matching.
Field already available in JSONL: per-trajectory exec result is implicitly captured in is_planner_correct / is_fixed_correct but not stored as serialized rows. Would need a rollout re-run that includes exec_rows_preview in each trajectory.
E3. Re-sample K=8 with higher T or top_p to lift oracle@8
Current K=8 at T=1.0, top_p=0.9. Try K=8 at T=1.2/top_p=0.95, or mix temperatures: 4 samples at T=0.8 + 4 at T=1.2. Higher diversity → higher oracle@8 ceiling → more headroom.
E4. Train a 1B selector instead of 3B
The current selector is Qwen2.5-Coder-3B — relatively heavy. A 1B may train faster and be tuned more aggressively. Compare same data, smaller model — see if data is the bottleneck.
E5. Distill the planner (riskiest, biggest upside)
Planner is the dominant bottleneck. Re-distill from a stronger teacher (Qwen2.5-72B already cached locally at /weka/s225250685/Huggingface/hub/models--Qwen--Qwen2.5-72B-Instruct/). New planner with greedy@1 > 55% would lift everything downstream.
This is outside "selector work" but worth flagging — selector improvements above a ceiling won't matter if planner stays at 51.5%.
6. Reproducing current numbers
To re-derive the table in §1 from existing rollouts (no GPU needed for the calc itself, just to host the selector):
# planner@1 / pipeline@1 from greedy file:
import json
for path in ["paper_greedy_PLANNER_ONLY_passAt1_bird_dev.jsonl",
"paper_greedy_SFT_VF_passAt1_bird_dev.jsonl",
"paper_greedy_COLLAB_passAt1_bird_dev.jsonl",
"paper_greedy_INDEP_passAt1_bird_dev.jsonl"]:
rows = [json.loads(l) for l in open(f"/weka/s225250685/mats-tist/eval_results/{path}")]
n = len(rows)
pg = sum(1 for r in rows if r["trajectories"][0]["is_planner_correct"])
def fin(t): return t["is_fixed_correct"] if not t["planner_exec_ok"] else t["is_planner_correct"]
pl = sum(1 for r in rows if fin(r["trajectories"][0]))
print(path, f"planner@1={100*pg/n:.2f}% pipeline@1={100*pl/n:.2f}%")
# oracle@8 from K=8 file:
for path in ["paper_SFT_VF_passAt8_bird_dev.jsonl",
"paper_COLLAB_par_passAt8_bird_dev.jsonl",
"paper_INDEP_par_passAt8_bird_dev.jsonl"]:
rows = [json.loads(l) for l in open(f"/weka/s225250685/mats-tist/eval_results/{path}")]
n = len(rows)
o = sum(1 for r in rows if any(
t["is_fixed_correct"] if not t["planner_exec_ok"] else t["is_planner_correct"]
for t in r["trajectories"]))
print(path, f"n={n} oracle@8={100*o/n:.2f}%")
Selector EX numbers are produced by scripts/compute_bestofn_with_selector.py against a vLLM-served selector.
7. Environment + constraints
- K=8 is fixed (user constraint) — don't try K=16 etc.
- Temperature = 1.0 for the K=8 rollouts — don't change unless you're testing E3.
- Conda env:
/weka/s225250685/conda-envs/handbook/bin/python - HF_TOKEN at
/weka/s225250685/mats-tist/.env(source withset -a; source .env; set +a) - SLURM partition
gpu-large, QoSbatch-long, job name MUST bevl(ALL CAPS not allowed; lowercasevlis required). PYTHONNOUSERSITE=1is required to avoid user-site contamination.- Don't touch
/weka/s225250685/mats-tist/data/_archived_wrong_format/— those are the old wrapper-tag datasets, kept for reference.
Helper: free_gpus command on the login node shows current GPU availability.
8. Definition of done
Final eval: selector v_next on paper_SFT_VF_passAt8_bird_dev.jsonl (or any of the 3 paper-format K=8 rollouts) achieves ≥ 67% EX.
Run with:
python scripts/compute_bestofn_with_selector.py \
/weka/s225250685/mats-tist/eval_results/paper_SFT_VF_passAt8_bird_dev.jsonl \
final_selector_run \
--selector_host http://localhost:8103 --row_preview
And report:
- selector EX
- pick-rate over oracle (EX / oracle@8)
- any K=8 re-sampling used