ORANGE:一种面向Text-to-SQL的带有领域知识的在线反思与生成框架
ORANGE: An Online Reflection ANd GEneration framework with Domain Knowledge for Text-to-SQL
AI总结:
提出在线自演化框架ORANGE,通过解析翻译日志构建数据库特定知识库,并采用嵌套思维链SQL-to-Text策略减少语义错误,逐步缩小语义鸿沟,提升Text-to-SQL翻译准确性。
摘要:
大型语言模型(LLMs)在将自然语言翻译为SQL方面取得了显著进展,但其通用知识与数据库的领域特定语义之间仍存在显著的语义鸿沟。历史翻译日志构成了这一缺失领域内知识的丰富来源,其中SQL查询固有地封装了数据库模式的真实世界使用模式。现有方法主要增强单个翻译的推理过程,但未能从过去的翻译中积累领域内知识。我们引入了ORANGE,这是一个在线自演化框架,通过解析翻译日志中的SQL查询来构建特定于数据库的知识库。通过积累包含模式和数据语义的领域内知识,ORANGE逐步减少了语义鸿沟并提高了后续SQL翻译的准确性。为确保可靠性,我们提出了一种新颖的带有元组语义跟踪的嵌套思维链SQL到文本策略,该策略减少了知识生成过程中的语义错误。在多个基准上的实验证实了ORANGE的实用性,证明了其在现实世界Text-to-SQL部署中的有效性,特别是在处理复杂和领域特定查询方面。
英文摘要:
Large Language Models (LLMs) have demonstrated remarkable progress in translating natural language to SQL, but a significant semantic gap persists between their general knowledge and domain-specific semantics of databases. Historical translation logs constitute a rich source of this missing in-domain knowledge, where SQL queries inherently encapsulate real-world usage patterns of database schema. Existing methods primarily enhance the reasoning process for individual translations but fail to accumulate in-domain knowledge from past translations. We introduce ORANGE, an online self-evolutionary framework that constructs database-specific knowledge bases by parsing SQL queries from translation logs. By accumulating in-domain knowledge that contains schema and data semantics, ORANGE progressively reduces the semantic gap and enhances the accuracy of subsequent SQL translations. To ensure reliability, we propose a novel nested Chain-of-Thought SQL-to-Text strategy with tuple-semantic tracking, which reduces semantic errors during knowledge generation. Experiments on multiple benchmarks confirm the practicality of ORANGE, demonstrating its effectiveness for real-world Text-to-SQL deployment, particularly in handling complex and domain-specific queries.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。