Text-to-SQL 旨在将自然语言问题转换为针对结构化数据库的可执行 SQL 查询。现有基准主要聚焦于具有预定义数据库模式和明确问题的封闭域场景,但在应对开放域场景的挑战(如问题歧义、数据库未指定以及跨数据库查询)方面存在不足。为弥补这一差距,我们提出了 TACO,一个面向含歧义及跨数据库查询的开放域 Text-to-SQL 基准。TACO 包含基于智慧城市数据服务的 1,500 个真实世界 Text-to-SQL 示例,以及基于大规模开放数据门户生成的 13,000 个高质量合成示例,涵盖交通、医疗和金融等多个领域。为了构建合成示例,我们开发了一种有效的数据合成流水线,以保留真实世界查询的复杂性。为了展示 TACO 的实用性,我们引入了由问题重写、表链接和查询规划组成的基线方法 TACO-SQL,以阐明 TACO 带来的挑战并更好地理解现有 Text-to-SQL 方法的局限性。在 TACO 上使用多种近期 Text-to-SQL 方法进行的大量实验表明,尽管 TACO-SQL 取得了最佳结果,但现有方法与人工编写的 SQL 之间仍存在显著差距。这些发现凸显了开放域 Text-to-SQL 的难度,并将 TACO 定位为推动未来研究的有价值基准。
Text-to-SQL aims to translate natural language questions into executable SQL queries over structured databases. Existing benchmarks mainly focus on closed-domain settings with predefined database schemas and well-specified questions, but they fall short in addressing the challenges of open-domain scenarios, such as ambiguous questions, unspecified databases, and cross-database querying. To bridge this gap, we introduce TACO, a benchmark for open-domain Text-to-SQL with Ambiguous and Cross-database queries. TACO consists of 1,500 real-world Text-to-SQL examples based on a smart city data service and 13,000 high-quality synthetic examples generated based on large-scale open data portals, covering diverse domains such as transportation, healthcare, and finance. To construct the synthetic examples, we develop an effective data synthesis pipeline that preserves the complexity of real-world queries. To demonstrate the utility of TACO, we introduce a baseline TACO-SQL composed of question rewriting, table linking, and query planning, to illustrate the challenges posed by TACO and to better understand the limitations of existing Text-to-SQL approaches. Extensive experiments on TACO using a variety of recent Text-to-SQL approaches show that, while TACO-SQL achieves the best results, a significant gap still remains between the existing approaches and human-written SQL. These findings highlight the difficulty of open-domain Text-to-SQL and position TACO as a valuable benchmark to drive future research.