The task of converting natural language queries into SQL queries is intricate, necessitating a blend of precise techniques for an accurate translation. The DIN-SQL (Decomposed-In-Context SQL) methodology represents a significant development in this domain. This paper introduces DFIN (Decomposed Focused-In-Context), an innovative extension of DIN-SQL that enhances Text-to-SQL conversion by addressing schema linking errors, which are a major source of inaccuracies. DFIN uniquely alternates between prompting techniques and Retrieval-Augmented Generation (RAG), adapting to the size and complexity of the database schema. A preprocessing phase embeds database definitions and leverages annotated files, akin to those in the BIRD dataset, facilitating the runtime retrieval of pertinent schema information. This strategy significantly reduces the token count for schema linking prompts, enabling the use of a standard GPT-4 model over its larger context variant, thus handling large-scale databases more effectively and economically. Our evaluation on the BIRD dataset, a challenging real-world benchmark, demonstrates that DFIN not only scales efficiently but also improves accuracy, achieving a score of 51.69. This improvement surpasses DIN-SQL method (the current third-place), which is the highest-ranked model employing in-context learning rather than fine-tuning, previously scoring 50.72. The advancement of DFIN underscores the evolving capabilities of in-context learning methodologies combined with advanced language models, offering a promising avenue for future research in complex Text-to-SQL conversion tasks.
翻译:将自然语言查询转化为SQL查询的任务具有复杂性,需要结合多种精确技术以实现准确转换。DIN-SQL(分解上下文内SQL)方法是该领域的一项重要进展。本文提出DFIN(分解聚焦上下文内方法),作为DIN-SQL的创新性扩展,通过解决模式链接错误(主要的不准确来源)来增强文本到SQL的转换能力。DFIN独特地在提示技术间交替切换,并融合检索增强生成(RAG),根据数据库模式的大小和复杂度进行自适应调整。预处理阶段嵌入数据库定义并利用标注文件(类似BIRD数据集中的文件),从而在运行时检索相关模式信息。该策略显著减少了模式链接提示的令牌数量,使得标准GPT-4模型(而非其更大上下文变体)得以使用,从而更高效且经济地处理大规模数据库。我们在具有挑战性的真实世界基准测试BIRD数据集上的评估表明,DFIN不仅具备高效扩展性,还提升了准确率,达到51.69分。这一进步超越了DIN-SQL方法(当前排名第三),后者是采用上下文学习而非微调的最高排名模型,此前得分为50.72。DFIN的进步凸显了上下文学习方法与先进语言模型结合的发展潜力,为未来复杂文本到SQL转换任务的研究提供了有前景的方向。