To bridge the gap between training and deployment in traditional Text-to-SQL models—and to address their lack of interactive exploration and trial-and-error capabilities—teams from HKUST and Microsoft have launched HarnessSQL, the first natively long-horizon framework for environment-interaction training. The framework builds a high-fidelity, closed execution sandbox and a minimalist SQL Harness contract, and adopts a two-stage post-training pipeline: full-trajectory long-horizon supervised fine-tuning followed by execution-reward reinforcement learning. This enables models to develop long-horizon exploration and fault-tolerance capabilities in real execution environments. Evaluations on multiple mainstream interactive Text-to-SQL benchmarks show that, under identical settings, the 8B model of HarnessSQL far surpasses 32B specialized models and multi-agent systems in execution accuracy, while the 14B model achieves further performance gains and strong out-of-domain generalization. Controlled experiments and ablation studies confirm that strict isomorphism between training and inference environments, full-sequence trajectory supervision, a sufficient context window, and optimization algorithms adapted to sparse rewards are the core keys to long-horizon interactive tasks. All HarnessSQL-related assets are now fully open-sourced.
