通过增强问题来直接链接数据库模式,提升复杂SQL生成准确率。
E-SQL: Direct Schema Linking via Question Enrichment in Text-to-SQL
- 用数据库表、列、值等信息增强自然语言问题,实现直接模式关联。
- 在BIRD测试集上复杂查询执行准确率达66.29%,显著优于传统方法。
- 对小模型尤其有效,无需微调即可提升性能,适合低资源场景。
将自然语言查询转化为结构化SQL(Text-to-SQL)是自然语言处理与数据库领域的重要任务,旨在为非专家提供自然语言数据库接口(NLIDB)。尽管大型语言模型(LLMs)带来进展,仍面临复杂模式处理、查询歧义和复杂结构生成等挑战。本文提出E-SQL,一种通过直接模式链接与候选谓词增强的新管道。该方法在问题中嵌入相关数据库项(表、列、值)及条件,提升问题与数据库结构的对齐度。同时利用候选谓词增强缓解生成语句中的错误或缺失谓词。在BIRD基准上的全面评估显示,E-SQL在复杂查询上表现优异,测试集执行准确率达66.29%。实验还发现,当使用先进专有大模型时,引入模式过滤未提升性能;而对小型模型,增强问题显著改善效果——无需微调,仅用DeepSeek Coder 7B Instruct 1.5v单提示生成,开发集执行准确率达56.45%。
原文摘要 · Abstract (English)
Translating Natural Language Queries into Structured Query Language (Text-to-SQL or NLQ-to-SQL) is a critical task extensively studied by both the natural language processing and database communities, aimed at providing a natural language interface to databases (NLIDB) and lowering the barrier for non-experts. Despite recent advancements made through the use of Large Language Models (LLMs), significant challenges remain. These include handling complex database schemas, resolving ambiguity in user queries, and generating SQL queries with intricate structures that accurately reflect the user's intent. In this work, we introduce E-SQL, a novel pipeline specifically designed to address these challenges through direct schema linking and candidate predicate augmentation. E-SQL enhances the natural language query by incorporating relevant database items (i.e., tables, columns, and values) and conditions directly into the question and SQL construction plan, bridging the gap between the query and the database structure. The pipeline leverages candidate predicate augmentation to mitigate erroneous or incomplete predicates in generated SQLs. Comprehensive evaluations on the BIRD benchmark illustrate that E-SQL achieves competitive performance, particularly excelling in complex queries with a 66.29% execution accuracy on the test set. A further observation from our experiments reveals that incorporating schema filtering into the translation pipeline does not have a positive impact on performance when the most advanced proprietary LLMs are used. Additionally, our experiments with small LLMs highlight the importance and positive impact of enriched questions on their performance. Without fine-tuning, single-prompt SQL generation using enriched questions with DeepSeek Coder 7B Instruct 1.5v achieves 56.45% execution accuracy on the BIRD development set.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。