arXiv:2503.21602cs.AI2025-03被引 4

让企业文本转SQL系统能随用户反馈持续进化。

GenEdit: Compounding Operators and Continuous Improvement to Tackle Text-to-SQL in the Enterprise

  • 分步生成:用分解操作符逐步构建查询计划
  • 反馈驱动:用户修改后自动更新知识库提升后续准确率
  • 适合企业数据员:降低复杂查询门槛,支持迭代优化

近年来,大语言模型推动了文本转SQL的发展,使数据访问更普及。然而,企业在部署时仍面临捕捉业务知识、处理复杂查询和持续改进的挑战。为此,我们设计并实现了GenEdit:一个能通过用户反馈不断优化的文本转SQL系统。GenEdit维护企业专属知识集,采用分步生成管道,利用复合操作符提升知识检索效率,并生成链式思维步骤引导SQL生成。首先在初始检索阶段,将原始SQL分解为子语句、子查询或子句,再检索相关示例、指令与模式元素。基于上下文信息,生成自然语言步骤计划,指导最终生成SQL,减少模型推理依赖,提升复杂查询生成能力。若存在语法或语义错误,可重新生成。知识集更新通过交互式协作者推荐,用户可迭代反馈并重新生成查询。每次生成采用分阶段编辑更新生成提示,反馈经回归测试与审批后合并,持续优化未来生成结果。

原文摘要 · Abstract (English)

Recent advancements in Text-to-SQL, driven by large language models, are democratizing data access. Despite these advancements, enterprise deployments remain challenging due to the need to capture business-specific knowledge, handle complex queries, and meet expectations of continuous improvements. To address these issues, we designed and implemented GenEdit: our Text-to-SQL generation system that improves with user feedback. GenEdit builds and maintains a company-specific knowledge set, employs a pipeline of operators decomposing SQL generation, and uses feedback to update its knowledge set to improve future SQL generations. We describe GenEdit's architecture made of two core modules: (i) decomposed SQL generation; and (ii) knowledge set edits based on user feedback. For generation, GenEdit leverages compounding operators to improve knowledge retrieval and to create a plan as chain-of-thought steps that guides generation. GenEdit first retrieves relevant examples in an initial retrieval stage where original SQL queries are decomposed into sub-statements, clauses or sub-queries. It then also retrieves instructions and schema elements. Using the retrieved contextual information, GenEdit then generates step-by-step plan in natural language on how to produce the query. Finally, GenEdit uses the plan to generate SQL, minimizing the need for model reasoning, which enhances complex SQL generation. If necessary, GenEdit regenerates the query based on syntactic and semantic errors. The knowledge set edits are recommended through an interactive copilot, allowing users to iterate on their feedback and to regenerate SQL queries as needed. Each generation uses staged edits which update the generation prompt. Once the feedback is submitted, it gets merged after passing regression testing and obtaining an approval, improving future generations.

文本转SQL持续改进企业应用

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