HarnessSQL:面向真实数据库环境中SQL智能体的原生执行器训练框架
HarnessSQL: Harness-Native Training for SQL Agents in Realistic Database Environments
浏览论文内容
中文总结 AI 辅助
HarnessSQL是一种原生执行器后训练框架,通过在监督微调与强化学习阶段保留完整交互结构,提升了Qwen3系列轻量SQL模型的执行准确率,且可有效迁移至分布外交互式数据库基准。
中文摘要 AI 辅助
Text-to-SQL模型通常被训练为直接将问题映射到静态查询,而现实世界中的数据库智能体通过与实时数据库进行有状态的多轮交互运行——包括检查模式、执行探测查询、诊断错误以及修正假设。这造成了关键的训练-部署不匹配,因为介导这种交互的执行器(execution harness)仅在推理阶段引入。为弥合该差距,我们提出HarnessSQL,一种原生执行器后训练框架,在监督微调(SFT)和强化学习(RL)阶段均保留完整的交互结构。HarnessSQL构建隔离的可执行数据库环境并搭配隐藏的执行预言机,在目标SQL执行器内部直接部署教师,仅保留已验证的轨迹用于全序列SFT,随后进行基于执行奖励的RL。在Spider 2.0-SQLite基准上,HarnessSQL大幅提升了轻量模型的执行准确率,将Qwen3-8B从15.5%提升至45.2%,Qwen3-14B从22.2%提升至54.8%,同时有效迁移到分布外的交互式基准如BIRD-Interact和LiveSQLBench。我们的研究表明,直接在数据库智能体的执行器内进行训练,对掌握复杂的长时序数据库工作流至关重要。
英文摘要
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.
发表机构
- Hong Kong University of Science and Technology(香港科技大学)
- Microsoft Research(微软研究院)
- Tsinghua University(清华大学)
- University of Macau(澳门大学)
机构由 AI 辅助整理,请以论文原文为准。