mats-sql-bundle / code /PROGRESS.md
thanhdath's picture
Push code: scripts, slurm sbatch, recipes, utils (v3 + selector series)
778d47d verified
|
Raw
History Blame Contribute Delete
20 kB

MATS-TIST Rebuttal — Progress Tracker

Last updated: 2026-04-24 — rebuttal plan + full contributor handoff


Rebuttal goal and stakeholder requests (summary)

Publication: IEEE TIST journal rebuttal for MATS (multi-agent Text2SQL with small language models and execution feedback).

Requests captured across the project (themes, not verbatim):

  1. Rebuttal package: Correct Overleaf/IEEE-style rebuttal workflow; read reviewers in overleaf-journal-TIST/review.txt; plan answers, extra experiments, and missing checkpoints; keep rebuttal assets under MATS-rebuttal/.
  2. Recent baselines: Compare to FINER-SQL, Arctic-Text2SQL-R1, ExCoT SQL, Alpha-SQL (some use execution feedback). Baseline accuracies are entered manually in the paper — no mandatory eval harness for those models in this repo.
  3. Accuracy: Use BIRD database_description/*.csv (column_description, value_description) and CHESS-style DDL schema text in prompts for SFT and ORPO data prep.
  4. BM25 wording: Reviewer asked about fallback vs “representative example from V_ci”. Behavior stays (first indexed doc as fixed representative); paper + code comment clarify — no score filter change required.
  5. Training code: Keep alignment-handbook (custom ORPO in scripts/run_orpo.py); do not replace with TRL-only SFT as the sole stack.
  6. Repos: All edits in mats-sql-tist/ fork only — not /home/datht/mats. Do not use sql_writer/ for MATS (FINER-SQL area).
  7. Compute: Local dev + ssh gf-henry for GPU; edit locally, rsync to remote (scripts/sync_code.sh). Build BM25 indexes locally; sync mats/data to remote as needed.
  8. Tracked tasks: Run build_all_bm25_indexes.py (done); enriched SFT generation (scripts/build_sft_data.py / prepare_sft_datasets.py); validator–fixer synthetic data (scripts/generate_val_fix_sft_data.py); 1.5B Qwen recipe for gf-henry; maintain PROGRESS.md.
  9. Ops on gf-henry: Moved mats/data (106 GB) and mats/alignment-handbook/output (26 GB) to /hdd/datht/mats/... with symlinks; fixed Java 11, faiss-cpu, scipy (GLIBC), duplicate accelerate dist-info, fp16 for Turing GPUs.

Handoff for another contributor (read this first)

Item Where / what
Paper + review mats-sql-tist/overleaf-journal-TIST/ (review.txt, main .tex)
Point-by-point rebuttal draft mats-sql-tist/MATS-rebuttal/response_to_reviewers.md (numbers still placeholders until eval)
Checkpoint plan mats-sql-tist/MATS-rebuttal/checkpoint_tracking.md
Command cheatsheet mats-sql-tist/MATS-rebuttal/scripts/training_commands.sh
Remote runbook mats-sql-tist/WORKFLOW_GF_HENRY.md
Staged remote script mats-sql-tist/scripts/run_training_gf_henry.sh
Code edits Only mats-sql-tist/ — sync with scripts/sync_code.sh to gf-henry
Data (local) Symlink mats-sql-tist/data/home/datht/mats/data
Data (gf-henry) /home/datht/mats/data/hdd/datht/mats/data (symlink); keep chain intact
Models (gf-henry) ~/huggingface/hdd/datht/huggingface/
Conda conda activate mats (see Conda Environment below)
BM25 server db_content_retrieval/lsh_api.pyJDK 11+, heap e.g. -Xmx6g
Training precision fp16 on gf-henry (RTX 2080 Ti / TITAN RTX — no native bf16)

First actions on pickup: Read Resume here → confirm disk/symlinks on gf-henry → start BM25 API → retry validator–fixer SFT → eval and fill rebuttal numbers.

Source code: Upstream is https://github.com/thanhdath/mats-sql — this workspace uses the TIST fork folder mats-sql-tist/ (not /home/datht/mats).

SSH: Configure a Host gf-henry entry in ~/.ssh/config on your laptop (hostname, user, key) so ssh gf-henry matches what the sync scripts expect — or edit scripts/sync_code.sh to your target.

Secrets: Validator–fixer training data was generated without paid LLM APIs (heuristic SQL mutations). If you add API-based data generation later, store keys outside git.

Overleaf / IEEE form: Use the journal’s official rebuttal / response-to-reviewers template from IEEE TIST author instructions or Overleaf; keep the canonical review text at overleaf-journal-TIST/review.txt.


Resume here (next session)

Policy: Edit code only under mats-sql-tist/ on this machine, then bash scripts/sync_code.sh (or your usual rsync) to gf-henry. Avoid editing project files directly on the remote unless unavoidable.

On gf-henry — do next (in order):

  1. Confirm env: conda activate matsaccelerate should be 0.34.2 only (stale accelerate-0.23.0.dist-info was removed; if training still complains, reinstall accelerate).
  2. BM25 API: JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64, JAVA_TOOL_OPTIONS=-Xmx6g, then start lsh_api.py as in WORKFLOW_GF_HENRY.md / scripts/run_training_gf_henry.sh.
  3. Retry 1.5B validator–fixer SFT: recipe alignment-handbook/recipes/qwen-1.5b-bird/validator-fixer-fft-rebuttal.yaml + accelerate config recipes/accelerate_configs/single_gpu.yaml (fp16, Turing GPUs — no bf16).
  4. After that succeeds: broader SFT/ORPO per MATS-rebuttal/checkpoint_tracking.md and MATS-rebuttal/scripts/training_commands.sh.
  5. Paper / rebuttal: fill baseline numbers (ExCoT, Arctic, Alpha-SQL, FINER-SQL) yourself; polish overleaf-journal-TIST/ and MATS-rebuttal/response_to_reviewers.md.

Large paths on gf-henry: mats/data and mats/alignment-handbook/output live under /hdd/datht/mats/… with symlinks from $HOME — do not delete the symlinks.


Repository Setup

Task Status Notes
Clone github.com/thanhdath/mats-sqlmats-sql-tist/ ✅ Done User cloned; all TIST edits live here only
Move overleaf-journal-TIST/ into mats-sql-tist/ ✅ Done Path: mats-sql-tist/overleaf-journal-TIST/
Rename conda env handbookmats ✅ Done conda rename -n handbook mats
Fix broken more-itertools in mats env ✅ Done pip install more-itertools
Verify all key libs in mats env ✅ Done torch 2.2.2, transformers 4.45.0, trl 0.8.6, accelerate 0.34.2, peft 0.6.1, alignment-handbook ✓

Code Changes in mats-sql-tist/ (TIST fork)

A. BIRD CSV Descriptions (value_description / column_description)

Problem: MATS was ignoring the rich database_description/*.csv files that BIRD provides per-database.
These contain column_description and value_description for every column — missing them hurts accuracy.

File Status What changed
utils/bird_csv_utils.py New file CHESS-style CSV loader. load_db_descriptions(db_dir) reads all CSVs under database_description/; handles UTF-8/CP1252 encodings. Also provides load_all_db_descriptions(split_dir) for bulk loading.
utils/db_utils.pyget_db_schema() ✅ Done Added db_descriptions=None parameter. When provided, populates column_descriptions and value_descriptions lists on each schema item from BIRD CSVs.
utils/db_utils.pyget_db_schema_sequence() ✅ Done Rewritten to CHESS DDL-style format: CREATE TABLE … ( col TYPE, -- Example Values: … | Column Description: … | Value Description: … ). Falls back gracefully if fields are absent.
prepare_sft_datasets.py ✅ Done Imports load_db_descriptions; auto-detects BIRD sources and loads CSV descriptions; passes them to get_db_schema() per db_id.
evaluate_end2end.py ✅ Done Imports get_db_schema_sequence; regenerates schema_sequence at load-time for any sample where it is missing — backward-compatible with old JSON inputs.

Example output from new DDL schema format:

CREATE TABLE frpm
(
    cdscode TEXT,  -- Example Values: `01100170` | Column Description: CDSCode identifier | Primary Key
    free_meal_count REAL,  -- Example Values: `191.0`, `1.0` | Column Description: Free meal count for K-12 | Value Description: 0 = Not eligible; 1 = Eligible
);

B. BM25 Fallback Clarification

File Status What changed
db_content_retrieval/lsh_api.py ✅ Done Added inline docstring comment on the fallback path (lines ~82–85): when BM25 finds no hits but the column is non-empty, returning searcher.doc(0) is a fixed, reproducible, deterministic "representative example from V_ci" — directly addressing Reviewer concern. No behavioral change.

C. Training Framework

Decision Status Notes
Keep alignment-handbook (do NOT switch to TRL SFT) ✅ Confirmed alignment-handbook/scripts/run_orpo.py contains custom ORPO edits critical to MATS; train_bird.sh documents the accelerate launch commands

BM25 Content Index Status

Data symlink

mats-sql-tist/data/home/datht/mats/data (symlink created)

Index build script

scripts/build_all_bm25_indexes.py — builds / symlinks all indexes; run with:

conda activate mats
cd mats-sql-tist
python scripts/build_all_bm25_indexes.py

Dataset index status

Dataset Index path Status Notes
BIRD dev data/bird/dev/db_contents_index ✅ Done 11 dbs
BIRD train data/bird/train/db_contents_index ✅ Done 69 dbs
sft_data_collections/bird/dev symlink → bird/dev ✅ Done same 11 dbs
sft_data_collections/bird/train symlink → bird/train ✅ Done same 69 dbs
Spider (dev/test/train) data/spider/db_contents_index ✅ Done 169 dbs
Spider-Syn symlink → spider ✅ Done same databases
spider-realistic symlink → spider ✅ Done same databases
Spider-DK sft_data_collections/Spider-DK/db_contents_index ✅ Done 3 new dbs
Dr.Spider NLQ_* (9 sets) symlink → spider ✅ Done same databases
Dr.Spider SQL_* (5 sets) symlink → spider ✅ Done same databases
Dr.Spider DB_schema_synonym …/DB_schema_synonym/db_contents_index ✅ Done 96/96 dbs
Dr.Spider DB_schema_abbreviation …/DB_schema_abbreviation/db_contents_index ✅ Done 96/96 dbs
Dr.Spider DB_DBcontent_equivalence …/DB_DBcontent_equivalence/db_contents_index ✅ Done 63/63 dbs
Domain datasets (Bank/Aminer) sft_data_collections/domain_datasets/db_contents_index ✅ Done 2/2 dbs

Full index build finished; build_all_bm25_indexes.py is not required to run again unless databases change.

lsh_api.py source paths updated

All sources now correctly mapped in db_content_retrieval/lsh_api.py:

  • BIRD dev/train → data/bird/{dev,train}/db_contents_index
  • Spider-train → data/spider/db_contents_index
  • Spider-dev/syn/realistic → synonym of spider-train
  • Dr.Spider DB_* → own index paths
  • Dr.Spider NLQ_*/SQL_* → own index paths (symlinked to spider)
  • Bank/Aminer domain datasets → domain_datasets index
  • Startup auto-filters sources whose index dir does not yet exist (no crash on missing dirs)

Completed (local + gf-henry) — since core code landed

Area Status Notes
BM25 indexes (all planned sets) Built locally via scripts/build_all_bm25_indexes.py; synced to gf-henry with mats/data
Enriched BIRD SFT JSON/JSONL ✅ Local + synced scripts/build_sft_data.py → e.g. mats/data/rebuttal_sft_bird_{train,dev}_text2sql.json(l) (CHESS-style schema + BM25 evidence)
Validator–fixer SFT data (synthetic) ✅ Local + synced scripts/generate_val_fix_sft_data.pydata/multi-agents/fixed/sft-validator-fixer-bird_with_evidence/ (HF DatasetDict)
gf-henry mats env torch 2.2.2+cu121, transformers, trl, peft, pyserini, faiss-cpu, scipy wheel compatible with Ubuntu 20.04 / GLIBC 2.31
BM25 API on gf-henry ✅ Was working Java 11 (JAVA_HOME), heap -Xmx6g; lsh_api.py filters synonym_sources when --db_content_index limits loaded corpora (fixes KeyError)
Qwen2.5-Coder-1.5B-Instruct ✅ On gf-henry Under /home/datht/huggingface//hdd/datht/huggingface/ (existing symlink layout)
Rebuttal draft doc ✅ Draft MATS-rebuttal/response_to_reviewers.md — still needs final numbers and polish
Training wiring alignment-handbook/recipes/qwen-1.5b-bird/validator-fixer-fft-rebuttal.yaml (fp16); recipes/accelerate_configs/single_gpu.yaml (fp16); scripts/run_training_gf_henry.sh; WORKFLOW_GF_HENRY.md

Pending work (your turn / GPU)

Training & evaluation on gf-henry

Task Status Notes
Validator–fixer SFT (1.5B Qwen) Next Unblockers applied: disk space, duplicate accelerate dist-info removed, fp16 configs — re-run training and confirm loss/checkpoint
Full agent SFT + ORPO refresh After rebuttal data/checkpoints agreed; use alignment-handbook + MATS-rebuttal/checkpoint_tracking.md
ORPO preference data regen After refreshed SFT artifacts if you change prompts/schema again
evaluate_end2end.py on BIRD dev (new checkpoints) After models trained
Ablations (no Schema Insight, no Validator, SFT-only, oracle selector, etc.) Plan in rebuttal docs

Paper & rebuttal (no GPU)

Task Status Notes
Baseline table: ExCoT, Arctic-Text2SQL-R1, Alpha-SQL, FINER-SQL You add accuracy — no eval runs required in this repo
Finalize response_to_reviewers.md Merge measured numbers after eval
LaTeX polish + RQ-led experiment narrative overleaf-journal-TIST/
Pipeline overview figure New diagram for camera-ready
Official hidden-test submission After final checkpoints

Optional code improvements

Task Status Notes
Selector: majority vote / self-consistency on execution No retraining

Known issues / gotchas (gf-henry)

  1. Root / was full — mitigated by moving mats/data (106G) and mats/alignment-handbook/output (26G) to /hdd/datht/mats/… with symlinks; keep that layout.
  2. Turing GPUs — no bf16: training YAML + accelerate config use fp16.
  3. Java — BM25/Lucene needs JDK 11+, not default Java 8.
  4. Do not use sql_writer/ in this repo (reserved for FINER-SQL baseline work).

File Map

mats-sql-tist/
├── overleaf-journal-TIST/          ← LaTeX paper + review.txt
│   ├── main_multiagent.tex
│   ├── review.txt
│   └── text/
├── MATS-rebuttal/                  ← rebuttal plan + drafts + scripts
│   ├── response_to_reviewers.md
│   ├── checkpoint_tracking.md
│   └── scripts/training_commands.sh
├── utils/
│   ├── bird_csv_utils.py           ✅ NEW — BIRD CSV description loader
│   ├── db_utils.py                 ✅ MODIFIED — CHESS DDL schema format
│   └── load_sft_dataset.py
├── db_content_retrieval/
│   └── lsh_api.py                  ✅ MODIFIED — fixed source paths + BM25 fallback comment
├── scripts/
│   ├── build_all_bm25_indexes.py   ✅ builds / symlinks all dataset BM25 indexes
│   ├── build_sft_data.py           ✅ enriched BIRD SFT JSONL (calls prepare_sft_datasets)
│   ├── generate_val_fix_sft_data.py ✅ synthetic validator–fixer SFT from gold SQL
│   ├── sync_code.sh                ✅ rsync mats-sql-tist → gf-henry
│   ├── setup_env_gf_henry.sh       ✅ conda/pip bootstrap for remote
│   └── run_training_gf_henry.sh    ✅ staged BM25 / data / training on gf-henry
├── WORKFLOW_GF_HENRY.md            ✅ remote runbook
├── prepare_sft_datasets.py         ✅ MODIFIED — wires BIRD CSV descriptions
├── evaluate_end2end.py             ✅ MODIFIED — rebuilds schema_sequence
├── data -> /home/datht/mats/data   ✅ NEW symlink — shared data dir
├── alignment-handbook/             ← keep as-is (custom ORPO)
│   ├── recipes/
│   │   ├── accelerate_configs/single_gpu.yaml  ✅ fp16, single GPU (gf-henry)
│   │   └── qwen-1.5b-bird/validator-fixer-fft-rebuttal.yaml  ✅ rebuttal SFT recipe
│   └── scripts/
│       ├── train_bird.sh
│       ├── run_orpo.py
│       └── run_sft.py
└── PROGRESS.md                     ← this file

Conda Environment

conda activate mats
# Key packages:
# torch            2.2.2+cu121
# transformers     4.45.0
# trl              0.8.6
# accelerate       0.34.2
# peft             0.6.1

gf-henry transfer and storage (physical layout)

Large trees were moved off the small / volume to /hdd/datht/ (symlinks from $HOMEdo not remove):

Logical path on gf-henry Physical location (approx.)
/home/datht/mats/data /hdd/datht/mats/data (~106 GB: BIRD, Spider, indexes, rebuttal JSON, etc.)
/home/datht/mats/alignment-handbook/output /hdd/datht/mats/alignment-handbook/output (~26 GB checkpoints)
/home/datht/huggingface /hdd/datht/huggingface/ (base models, e.g. Qwen2.5-Coder-1.5B-Instruct)

Also synced / present: mats-sql-tist tree, sft_data_collections, Dr.Spider / domain paths under mats/data, schema_insight checkpoints as applicable, synthetic validator–fixer HF dataset under data/multi-agents/fixed/sft-validator-fixer-bird_with_evidence/.

gf-henry Environment (mats conda env)

Package Version Status
torch 2.2.2+cu121 ✅ CUDA available (2 GPUs)
transformers 4.45.0
accelerate 0.34.2
trl 0.8.6
peft 0.6.1
pyserini 0.21.0
numpy 1.26.4
alignment-handbook 0.2.0.dev0

GPUs: TITAN RTX (23GB VRAM) + RTX 2080 Ti (10GB VRAM)

Note: bitsandbytes removed (not needed for FFT training; had scipy binary incompatibility).

MATS-rebuttal/ Contents

File Status
response_to_reviewers.md ✅ Draft complete (placeholders for numbers)
checkpoint_tracking.md ✅ Created
scripts/training_commands.sh ✅ Created

Disk space management (gf-henry, Apr 23, 2026)

See also gf-henry transfer and storage above. Moved large directories from /home (was 100% full) to /hdd/datht/ and created symlinks:

Directory Size Action
/home/datht/mats/data/hdd/datht/mats/data 106GB Moved + symlinked ✅
/home/datht/mats/alignment-handbook/output/hdd/datht/mats/alignment-handbook/output 26GB Moved + symlinked ✅

Result: Home partition freed from 100% → 87% used (117GB free now)

Fixed: Removed stale accelerate-0.23.0.dist-info from mats env (was causing ImportError during training)

Later pipeline (after validator–fixer SFT succeeds)

Use MATS-rebuttal/checkpoint_tracking.md and MATS-rebuttal/scripts/training_commands.sh as the source of truth. Typical order: broader SFT / ORPO per agent → evaluate_end2end.py on BIRD dev → ablations (no Schema Insight, no Validator, SFT-only, oracle selector, etc.) → merge metrics into response_to_reviewers.md and Overleaf tables.

Do not repeat by default: Full build_all_bm25_indexes.py and enriched rebuttal SFT JSON(L) generation were already run locally and synced; only re-run if database files, index paths, or prompt schema change materially.

Previous conversation transcript

MATS TIST Rebuttal Plan & Setup