| # MATS-SQL Bundle β Progress Snapshot |
|
|
| **Bundle**: `thanhdath/mats-sql-bundle` (HuggingFace) |
| **Snapshot date**: 2026-05-13 |
|
|
| --- |
|
|
| ## Original Task |
|
|
| Multi-agent Text2SQL pipeline reaching **pass@8 β₯ 67%** (BIRD-dev, EX). Hard constraints from project owner: |
|
|
| - Planner β€ 3B params |
| - Selection β€ 3B params |
| - Validator(s) and Fixer β€ 1B params each (prefer 0.5B) |
| - Max ORPO iter-2 (no iter-3+) |
| - **No commercial APIs (no GPT teacher)** β collaborative training must be structurally necessary |
| - V+F (validators + fixer) must **not hurt** final accuracy and **should contribute** to acc increase |
| - Results tables must include per-agent parameter counts |
| - Two specialized validators per paper Β§Combined Validator: **v_s (selection)** and **v_c (condition)** |
|
|
| --- |
|
|
| ## Current Progress (latest) |
|
|
| ### Best result so far (BIRD-dev, K=8) |
|
|
| | Config | N | pass@8 (recall, oracle) | Trained selector (real, no leak) | Notes | |
| |---|---|---|---|---| |
| | 1-stage iter-2 uniform-temp | 1524 | 64.96% | β | leak-pre-patch number was 64.96 | |
| | 1-stage iter-2 mixed-temp (0.5/0.7/0.9/1.1) | 1525 | **65.38%** | β | best recall | |
| | 3-stage iter-2 + 0.6B v_s/v_c + ORPO fixer iter-1 | 1525 | 65.05% | β | V+F neutral (0 rescues) | |
| | 3-stage iter-2 + 0.5B v_s + 0.6B v_c + 0.5B **replanner**-fixer iter-2 | 1525 | 65.11% | **54.30%** | leak-free selector measurement; **fixer iter-2 +0.06pp vs iter-1** | |
|
|
| **Critical finding (2026-05-13):** `compute_bestofn_with_selector.py` had `exec_response = "OK" if is_planner_correct else "Error / no rows"` β passed the gold-graded label to the selector β trivially matched oracle. **Patched** to use actual SQL execution result. Real trained-selector accuracy is **54.30%, NOT 65%**. Selector β oracle gap = 10.81pp. |
|
|
| ### Two headline gaps to close (target = headline EX β₯ 67%) |
|
|
| | Gap | Current | Target | Gap | Lever | |
| |---|---|---|---|---| |
| | **Oracle pass@8** (recall) | 65.38% (mixed-temp) | β₯70% | +4.6pp | More diverse sampling / better fixer rescues | |
| | **Selector β oracle** | 57.25 / 65.38 = 87.6% | β₯95% | +8.13pp | Selector v3 (more data / different arch) | |
|
|
| ### Selector v2 results (2026-05-13 β row preview added to prompt) |
|
|
| Retrained 3B selector with `OK. Rows preview: <rows>` instead of bare `OK`. Closes ~3-4pp of the ~11pp gap. |
|
|
| | Config (BIRD-dev K=8 iter-2 planner) | Oracle | Selector v1 (no rows) | **Selector v2 (rows)** | v2 gain | |
| |---|---|---|---|---| |
| | 1-stage uniform-temp | 64.96% | 53.94% | 56.43% | +2.49pp | |
| | **1-stage mixed-temp** | **65.38%** | 53.64% | **57.25%** β headline | +3.61pp | |
| | 2-stage + ORPO fixer-iter1 | 63.04% | 52.72% | 56.02% | +3.30pp | |
| | 3-stage + 0.6B V/V + ORPO fixer-iter1 | 65.05% | 53.11% | 56.98% | +3.87pp | |
| | 3-stage + 0.5B V/V + 0.5B replanner-fixer | 65.11% | 53.51% | 56.66% | +3.15pp | |
|
|
| **Headline pass@8 post-selector = 57.25%** (1-stage mixed-temp + v2 selector). Still β9.75pp from 67%. |
|
|
| ### Per-model status |
|
|
| | Agent | Model | Params | Status | |
| |---|---|---|---| |
| | Planner | Qwen2.5-Coder-3B-Instruct + ORPO iter-2 (collab) | 3B | trained β | |
| | Selector | Qwen2.5-Coder-3B-Instruct + SFT (YES/NO binary) | 3B | trained β | |
| | Validator-Selection (v_s) | Qwen2.5-Coder-0.5B-Instruct + SFT v3 | 0.5B | trained β | |
| | Validator-Condition (v_c) | Qwen3-0.6B-Instruct + SFT v3 | 0.6B | trained β (0.5B variant truncated, retrain pending) | |
| | Fixer (re-planner) | Qwen2.5-Coder-0.5B + ORPO iter-2 (replanner data) | 0.5B | trained β | |
|
|
| ### V+F contribution diagnostic (mixed-temp iter-2 K=8, 1525 q) |
|
|
| - Validators critique 91.6% of trajectories; old fixer ignored 98.6% β 0 rescues at pass@8 |
| - Replanner fixer (iter-2) currently flipping ~40% of trajectories (winloss=605 at 1360/1534) β net effect being measured |
|
|
| ### Key findings |
|
|
| - ORPO planner: SFT 64.11% β iter-1 64.26% β iter-2 64.96% (+0.70pp, diminishing returns) |
| - Mixed-temp sampling adds +0.42pp over uniform-temp at K=8 |
| - v3 validator data rebalanced from 8% all-OK (over-critique) to 34.5%/61% all-OK |
| - Fixer dataset re-built as "re-planner" objective (1833 pairs): given a failed planner trajectory, produce a correct alternative from same question's K=4 trajectories |
| - pass@8 (true recall) is the *upper bound* for trained-selector accuracy; need recall β₯70% to land headline β₯67% after selector picks |
|
|
| --- |
|
|
| ## What's Next (in priority order) |
|
|
| 1. **Phase4 K=8 3-stage eval finishes** (currently 89% done, ETA 30 min) β get pass@8 with replanner-fixer. |
| 2. **Apply patched (leak-free) selector** to all K=8 JSONLs β get true selector accuracy (not oracle). |
| 3. **If pass@8 selector β₯67%: DONE.** Write results table with per-agent sizes. |
| 4. **If pass@8 selector <67%:** |
| - Re-mine fixer ORPO data on **iter-2 planner** BIRD-train rollouts (current data was from iter-1 planner β distribution shift). |
| - Re-train fixer ORPO iter-2 on fresh data. |
| - Consider planner sampling tricks: wider mixed-temp (0.3-1.3), nucleus variation. |
| 5. **Make V+F contribute (currently neutral):** the 0.5B replanner fixer's `winloss` is now high (~40%) β need to check if those flips are net+ or net-. If net-, gate fixer to only run on `planner_exec_ok=False` cases. |
|
|
| --- |
|
|
| ## Repo contents |
|
|
| ``` |
| mats-sql-bundle/ |
| βββ PROGRESS.md # this file |
| βββ models/ |
| β βββ planner-iter2-collab-3B/ # 3B ORPO iter-2 planner |
| β βββ selector-3B-sft/ # 3B trained selector |
| β βββ validator-selection-0.5B-v3/ # v_s SFT |
| β βββ validator-condition-0.6B-v3/ # v_c SFT |
| β βββ fixer-replanner-0.5B-iter2-orpo/ # ORPO iter-2 re-planner fixer |
| βββ data/ |
| β βββ sft-validator-selection-v3/ # SFT data for v_s |
| β βββ sft-validator-condition-v3/ # SFT data for v_c |
| β βββ hf_fixer_replanner/ # ORPO data for fixer iter-2 |
| β βββ hf_planner_collaborative_iter2/ # ORPO data for planner iter-2 |
| βββ recipes/ |
| β βββ orpo-planner-collab-iter2.yaml |
| β βββ orpo-fixer-replanner-0.5b-iter2.yaml |
| β βββ validator-selection-fft-0.5b-v3.yaml |
| β βββ validator-condition-fft-0.5b-v3.yaml |
| βββ scripts/ |
| βββ run_pipeline_rollouts.py # rollout / 3-stage runner |
| βββ compute_bestofn_with_selector.py # selector apply (patched) |
| βββ compute_bestofn_metrics.py # oracle/greedy metrics |
| βββ build_validator_2agents_v3.py # v_s/v_c data builder |
| βββ build_fixer_replanner_iter2.py # fixer re-planner data builder |
| ``` |
|
|
| ## How to continue from this bundle |
|
|
| ```bash |
| # 1. Clone the bundle (~16 GB) |
| git clone https://huggingface.co/datasets/thanhdath/mats-sql-bundle |
| cd mats-sql-bundle |
| |
| # 2. Symlink to alignment-handbook layout |
| ln -s $(pwd)/models /path/to/alignment-handbook/output |
| ln -s $(pwd)/data /path/to/mats-sql-tist/data/llm_alignment_imported |
| |
| # 3. Continue from where we left off: BIRD-dev K=8 3-stage with iter-2 planner + 0.5B agents |
| bash scripts/run_pipeline_rollouts.py --K 8 --mixed_temp "0.5,0.7,0.9,1.1" ... |
| |
| # 4. To do iter-3 (if needed), re-mine fixer data on iter-2 planner BIRD-train rollouts first. |
| ``` |
|
|
| --- |
|
|
| **Maintainer**: thanhdath@gmail.com / thanhdath97@gmail.com |
| **Source repo**: /home/datht/mats-sql-tist (private dev machine) |
|
|