2026-11-16 · 专家 · 自然语言处理 · 机器学习

MEM-SQL: Memory-Empowered Text-to-SQL

该论文提出了一种名为MEM-SQL的内存增强文本到SQL系统,通过存储整个查询模板、可重用SQL块和领域概念到模式元素的映射,有效地利用历史查询来提高文本到SQL转换的准确性和效率。

更新于 2026-11-26。作者:Xiaoqi Wang、Wenqi Pei、Shizheng Hou、Yilai Liu、Han Chen、Boyan Li、Yuyu Luo、Hongyang Du。

中文摘要

文本到SQL系统将自然语言问题翻译成针对日益复杂的数据库的SQL查询。然而,广泛使用的基准测试独立评估问题,忽略了先前查询可以提供连接或计算为新问题的情况。我们引入了HARE(历史感知文本到SQL基准)来衡量适应历史SQL的准确性和成本。HARE包含1600个请求,这些请求来源于四个数据集中固定的823个已验证查询。注释记录了每个请求保留的组件以及它需要的编辑,区分了整个查询的适应和部分重用。我们的方法MEM-SQL(内存增强文本到SQL)存储整个查询模板、可重用的SQL块以及从领域概念到模式元素的映射。MEM-SQL只有在分配给它的每个要求都有超过该层阈值的匹配时才会使用该层。通过按需模式链接(OSL),MEM-SQL仅在没有任何层符合条件或生成器判断检索到的证据不足时才咨询模式。在HARE的六个语言模型上,平均执行准确率从没有历史记录的直接生成37.1%提高到MEM-SQL的50.0%,平均输入标记减少了76.6%,延迟降低了68.8%。进一步的分析显示,重用多个已验证查询的请求仍然是一个瓶颈,准确率从56.7%下降到29.7%,尤其是在必须将重用组件放置在新查询结构中或与共享连接结合时。将OSL应用于其他三种内存设计,可以一致地减少生成成本,但其准确率收益取决于内存设计。因此,经过验证的历史记录可以使生成既更准确又更便宜,但其价值取决于保留的证据以及系统何时咨询模式。

英文摘要

Text-to-SQL systems translate natural language questions into SQL queries over increasingly complex databases. However, widely used benchmarks evaluate questions independently, overlooking settings where earlier queries over the same database can supply joins or calculations for a new question. We introduce HARE (History-AwaRe Text-to-SQL BEnchmark) to measure the accuracy and cost of adapting historical SQL. HARE comprises 1,600 requests derived from a fixed pool of 823 verified queries across four datasets. Annotations record which components each request preserves and which edits it requires, distinguishing whole-query adaptation from partial reuse. Our method, MEM-SQL (Memory-EMpowered Text-to-SQL), stores whole-query templates, reusable SQL blocks, and mappings from domain concepts to schema elements. MEM-SQL uses a layer only if every requirement assigned to it has a match above that layer's threshold. With On-demand Schema Linking (OSL), MEM-SQL consults the schema only when no layer qualifies or the generator judges retrieved evidence insufficient. Across six language models on HARE, mean execution accuracy rises from 37.1% for Direct Generation without history to 50.0% for MEM-SQL, with 76.6% fewer input tokens and 68.8% lower latency on average. Further analysis shows that requests reusing several verified queries remain a bottleneck, with accuracy falling from 56.7% to 29.7%, most sharply when reused components must be placed in a new query structure or combined with a shared join. Applying OSL to three other memory designs consistently reduces generation cost, while its accuracy benefit depends on the memory design. Verified history can thus make generation both more accurate and cheaper, but its value depends on the evidence retained and when the system consults the schema.

解读

一句话总结

该论文提出了一种名为MEM-SQL的内存增强文本到SQL系统,通过存储整个查询模板、可重用SQL块和领域概念到模式元素的映射,有效地利用历史查询来提高文本到SQL转换的准确性和效率。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt