HarnessSQL: Harness-Native Training for SQL Agents in Realistic Database Environments
Haolin Yang, Jipeng Zhang, Zhiqiang Qian, Jian Xie, Shuaishuai Gong, Yike Guo, Sirui Han
Abstract
Text-to-SQL models are commonly trained to map questions directly to static queries, whereas real-world database agents operate through stateful, multi-turn interaction with live databases -- inspecting schemas, executing probe queries, diagnosing errors, and revising hypotheses. This creates a critical train-deploy mismatch, as the execution harness that mediates this interaction is introduced only at inference time. To bridge this gap, we propose HarnessSQL, a harness-native post-training framework that preserves the full interaction structure throughout both supervised fine-tuning and reinforcement learning. HarnessSQL builds isolated, executable database environments paired with hidden execution oracles, rolls out teachers directly inside the target SQL harness, and retains only verified trajectories for full-sequence SFT, followed by execution-reward RL. Across Spider 2.0-SQLite, HarnessSQL dramatically boosts the execution accuracy of compact models, raising Qwen3-8B from 15.5% to 45.2% and Qwen3-14B from 22.2% to 54.8%, while transferring effectively to out-of-distribution interactive benchmarks such as BIRD-Interact and LiveSQLBench. Our findings demonstrate that training database agents directly within their execution harness is essential for mastering complex, long-horizon database workflows.
Create a lesson
Related papers
Sequent-Prover: Training Agents for Formal, Checkable SMT-based Reasoning
Shared title terminologycs.CLDebargha Ganguly, Weicong Chen, Mohsen Hariri et al.
CoTrace: Data Recipes for Training Terminal Agents with Harness-Model Co-Evolution
Shared title terminologycs.CLJixuan Chen, Jiaxin Zhang, Qinyuan Ye et al.
IRTIQA: Evolving in English, Evaluated in Urdu -- Does Agent Self-Evolution Transfer from English to Urdu and Code-Switched Input?
Shared title terminologycs.CLAbdullah Hashmat, Danish Javed, Usman Naseem et al.
MINE: A Training-Free Defense against Indirect Prompt Injection via Mutual Information and Embedding Variance
Shared title terminologycs.CLTruong Phan, Ngoc-Quan Pham, Dat Quoc Nguyen
When Rerankers Work Together: Better and Faster Reranking without Joint Training
Shared title terminologycs.CLYanqiao Chen, Dongsheng Hou, Yuhan Rui
Sports Agent: A Self-Evolving System for Conversational Data Analytics
Shared title terminologycs.CLChao Chen, Fuqi Lin, Ze Chen et al.