< Explain other AI papers

TRUST-SQL: Tool-Integrated Multi-Turn Reinforcement Learning for Text-to-SQL over Unknown Schemas

Ai Jian, Xiaoyun Zhang, Wanrou Du, Jingqing Ruan, Jiangbo Pei, Weipeng Zhang, Ke Zeng, Xunliang Cai

2026-03-18

TRUST-SQL: Tool-Integrated Multi-Turn Reinforcement Learning for Text-to-SQL over Unknown Schemas

Summary

This paper introduces a new method, TRUST-SQL, for converting natural language questions into SQL queries when the database structure isn't fully known beforehand.

What's the problem?

Current text-to-SQL systems work really well when they have complete information about the database, like all the table names and what each column means. However, real-world databases are huge and complex, with tons of tables and confusing descriptions. It's impractical to feed all that information into the system at once. The challenge is to figure out *which* parts of the database are relevant to a specific question without being given the full picture upfront.

What's the solution?

The researchers created TRUST-SQL, which acts like an agent that explores the database step-by-step. It uses a four-stage process to identify and confirm only the necessary database details. A key part of their approach is a technique called 'Dual-Track GRPO' which helps the agent learn what actions lead to good results, even if the immediate outcome isn't clear. This is done by focusing on the value of each step taken, rather than just the final answer. Essentially, it learns to explore effectively.

Why it matters?

This work is important because it makes text-to-SQL systems more practical for use with real-world databases. By not requiring complete database knowledge from the start, TRUST-SQL significantly improves performance on complex databases and even matches or beats systems that *do* have that upfront information. This means we can get more accurate SQL queries from natural language questions, even when dealing with messy and large datasets.

Abstract

Text-to-SQL parsing has achieved remarkable progress under the Full Schema Assumption. However, this premise fails in real-world enterprise environments where databases contain hundreds of tables with massive noisy metadata. Rather than injecting the full schema upfront, an agent must actively identify and verify only the relevant subset, giving rise to the Unknown Schema scenario we study in this work. To address this, we propose TRUST-SQL (Truthful Reasoning with Unknown Schema via Tools). We formulate the task as a Partially Observable Markov Decision Process where our autonomous agent employs a structured four-phase protocol to ground reasoning in verified metadata. Crucially, this protocol provides a structural boundary for our novel Dual-Track GRPO strategy. By applying token-level masked advantages, this strategy isolates exploration rewards from execution outcomes to resolve credit assignment, yielding a 9.9% relative improvement over standard GRPO. Extensive experiments across five benchmarks demonstrate that TRUST-SQL achieves an average absolute improvement of 30.6% and 16.6% for the 4B and 8B variants respectively over their base models. Remarkably, despite operating entirely without pre-loaded metadata, our framework consistently matches or surpasses strong baselines that rely on schema prefilling.