arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.33946cs.CL
收藏

无模式Text-to-SQL:从查询日志学习企业数据库结构

Schema-Free Text-to-SQL: Learning Enterprise Database Structure from Query Logs

University of Southern California(南加州大学);Amazon(亚马逊)

Ömer Faruk Akgül, Nikhil Kapahi, Prajit Reddy Muppidi

AI总结:

该研究提出无需模式文档的Text-to-SQL框架,从查询日志学习数据库结构,结合知识图谱与实体驱动GraphRAG检索,在工业部署和Beaver基准上优于主流方法,实现企业环境下的有效自然语言数据库接口。

摘要:

Text-to-SQL系统在学术基准上实现了出色的准确率,但在企业部署中性能大幅下降。这一差距源于一个基本假设:现有方法需要完整的模式文档,而企业数据库通常缺乏全面的文档,存在命名晦涩、关系隐含的问题。我们提出了首个无需模式文档的Text-to-SQL框架,而是从历史查询日志中学习数据库结构。查询日志编码了隐含的结构知识:哪些表被共同查询、如何连接,以及哪些列对应业务概念。我们从解析的查询模式构建知识图谱,并引入实体驱动的GraphRAG检索,该方法将用户问题锚定在领域术语中,而非仅依赖嵌入相似度。在带有专家评估的工业部署和Beaver基准上验证,我们的方法在可执行性和答案质量上显著优于作为行业主流方法的基于相似度的检索。在Beaver上,我们实现了95.7%的执行有效性,而基于嵌入的检索为60.8%;在内部部署中,专业数据工程师对我们系统的偏好率为70%,而对另一系统为10%。我们的工作表明,Text-to-SQL可在模式模糊的企业环境中有效运行,实现“野外”的自然语言数据库接口。

英文摘要:

Text-to-SQL systems achieve remarkable accuracy on academic benchmarks, yet performance drops dramatically in enterprise deployments. This gap stems from a fundamental assumption: existing approaches require complete schema documentation, but enterprise databases typically lack comprehensive documentation, featuring cryptic naming and implicit relationships. We present the first text-to-SQL framework that operates without schema documentation, instead learning database structure from historical query logs. Query logs encode implicit structural knowledge: which tables are queried together, how they join, and what columns map to business concepts. We construct a knowledge graph from parsed query patterns and introduce entity-driven GraphRAG retrieval that grounds user questions in domain terminology rather than relying solely on embedding similarity. Validated on both an industrial deployment with expert evaluation and the Beaver benchmark, our approach substantially outperforms similarity-based retrieval methods, the dominant industry approach, in both executability and answer quality. On Beaver, we achieve 95.7% execution validity compared to 60.8% for embedding-based retrieval, with expert data engineers preferring our system 70% to 10% on internal deployment. Our work demonstrates that text-to-SQL can operate effectively in schema-ambiguous enterprise environments, enabling natural language database interfaces "in the wild".

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑