[论文解读] Text2SQL is Not Enough: Unifying AI and Databases with TAG
本文提出了表格增强生成(Table-Augmented Generation, TAG),一种统一框架,将大语言模型(LLMs)与数据库管理系统相结合,以回答需要世界知识、语义推理或数据聚合的复杂自然语言问题。与Text2SQL或RAG不同,TAG采用三步流程——查询生成、数据库执行和答案生成,在复杂查询上的准确率比基线方法最高提升65%,凸显了人工智能与数据库集成领域的重要研究机遇。
AI systems that serve natural language questions over databases promise to unlock tremendous value. Such systems would allow users to leverage the powerful reasoning and knowledge capabilities of language models (LMs) alongside the scalable computational power of data management systems. These combined capabilities would empower users to ask arbitrary natural language questions over custom data sources. However, existing methods and benchmarks insufficiently explore this setting. Text2SQL methods focus solely on natural language questions that can be expressed in relational algebra, representing a small subset of the questions real users wish to ask. Likewise, Retrieval-Augmented Generation (RAG) considers the limited subset of queries that can be answered with point lookups to one or a few data records within the database. We propose Table-Augmented Generation (TAG), a unified and general-purpose paradigm for answering natural language questions over databases. The TAG model represents a wide range of interactions between the LM and database that have been previously unexplored and creates exciting research opportunities for leveraging the world knowledge and reasoning capabilities of LMs over data. We systematically develop benchmarks to study the TAG problem and find that standard methods answer no more than 20% of queries correctly, confirming the need for further research in this area. We release code for the benchmark at https://github.com/TAG-Research/TAG-Bench.
研究动机与目标
- 为解决现有Text2SQL和检索增强生成(Retrieval-Augmented Generation, RAG)方法的局限性,这些方法无法有效处理需要世界知识或对数据进行语义推理的自然语言问题。
- 提出一种统一范式——表格增强生成(TAG),将大语言模型与数据库系统集成,以实现对自定义数据源更通用且强大的问答能力。
- 通过新基准系统评估TAG问题,揭示当前方法正确回答的查询不超过20%。
- 证明手工编写的TAG流水线在复杂查询上可实现比基线方法最高65%的准确率提升,验证该方法的可行性与潜力,并推动进一步研究。
提出的方法
- TAG定义了一个三步流水线:(1) 查询生成利用大语言模型将自然语言请求R映射为可执行的数据库查询Q。
- 查询执行步骤(exec)在数据库系统上运行Q,以检索相关数据T,利用DBMS在精确计算和过滤方面的高效性。
- 答案生成步骤(gen)结合原始请求R和检索到的数据T,通过大语言模型生成自然语言答案A,从而支持语义推理和世界知识的应用。
- 该框架将Text2SQL和RAG作为特例进行泛化,支持涉及推理、聚合和外部知识的更广泛查询类别。
- 该方法支持对大数据库集进行LLM的迭代或递归编排,实现复杂推理。
- 该方法设计用于高效的批量推理,在评估中表现出较低的执行时间。

实验结果
研究问题
- RQ1现有Text2SQL和RAG方法能否有效处理需要超越数据库模式的世界知识的自然语言问题?
- RQ2当与数据库执行结合时,大语言模型在自由文本字段上进行语义推理,或对大规模数据集的趋势进行聚合时,其能力如何?
- RQ3当前方法在需要关系操作以及对非结构化数据或外部知识进行推理的查询上,泛化能力如何?
- RQ4在复杂的真实世界类查询上,启发式或手工编写的TAG流水线与自动化基线之间的性能差距有多大?
- RQ5当前AI-数据库集成中的关键瓶颈是什么,导致难以实现准确、可扩展且通用的自然语言问答?
主要发现
- 标准的Text2SQL和RAG基线方法正确回答的基准查询不超过20%,表明亟需新方法。
- 手工编写的TAG流水线在复杂查询上可实现比自动化基线最高65%的准确率提升,证明了该方法的可行性和潜力。
- RAG基线无法为聚合查询(如关于Sepang国际赛道赛事的问题)检索到相关数据,因其依赖于点查询。
- Text2SQL + LM基线无法有效利用数据库数据,仅依赖参数化知识,无法提供数据驱动的分析。
- 定性分析表明,TAG系统能够成功聚合大量数据,并生成信息丰富、上下文相关的答案。
- TAG框架支持低延迟的高效执行,表明基于该范式可构建可扩展、生产就绪的系统。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。