arXiv:2502.00675cs.CL2025-02被引 35

ReFoRCE让自然语言转SQL更准,尤其适合复杂数据库。

ReFoRCE: A Text-to-SQL Agent with Self-Refinement, Consensus Enforcement, and Column Exploration

  • 用模式分组和大模型链接表,压缩数据库信息减少上下文负担。
  • 通过自修正和多数投票机制,在多数据库方言上提升准确率。
  • 结合执行反馈迭代探索字段,解决复杂查询的模糊问题。

我们提出 ReFoRCE,一个在 Spider 2.0 基准上表现领先的 Text-to-SQL 智能体,该基准反映真实世界中复杂的文本转 SQL 场景。尽管 Text-to-SQL 系统可实现对结构化数据库的自然语言查询,但其在企业环境中部署仍面临挑战:数据库模式庞大(超过 1,000 列)、支持多种 SQL 方言(如 BigQuery、Snowflake),以及复杂的查询需求(如数据转换与分析)。ReFoRCE 通过四种策略应对:(a) 基于模式的表分组与大模型引导的模式链接,压缩数据库信息以缓解长上下文问题;(b) 自修正机制,跨方言迭代纠正语法与语义错误;(c) 多数投票共识机制,选择高置信度候选结果,将复杂模糊情况暂存;(d) 依据执行反馈进行迭代字段探索,解决暂存问题。ReFoRCE 在 Spider 2.0-Snow 和 Spider 2.0-Lite 上分别取得 35.83 和 36.56 的新高分。

原文摘要 · Abstract (English)

We present ReFoRCE, a Text-to-SQL agent that tops the Spider 2.0 leaderboard--a challenging benchmark reflecting complex, real-world Text-to-SQL scenarios. While Text-to-SQL systems enable natural language queries over structured databases, deploying them in enterprise environments remains difficult due to large, complex schemas (with over 1,000 columns), diverse SQL dialects (e.g., BigQuery, Snowflake), and sophisticated query requirements (e.g., transformations and analytics). ReFoRCE addresses these challenges through: (a) database information compression via pattern-based table grouping and LLM-guided schema linking to alleviate long-context issues; (b) self-refinement to iteratively correct syntax and semantic errors across dialects; (c) majority-vote consensus to select high-confidence candidates while deferring ambiguous cases arising from sophisticated queries; and (d) iterative column exploration guided by execution feedback to resolve those deferred cases. ReFoRCE achieves new state-of-the-art results, with scores of 35.83 on Spider 2.0-Snow and 36.56 on Spider 2.0-Lite.

Text-to-SQL大模型数据库智能代理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。