用多智能体协作让大模型更准地理解表格并生成有效SQL
Chain-of-Query: Unleashing the Power of LLMs in SQL-Aided Table Understanding via Multi-Agent Collaboration
- 用自然语言描述表结构,减少格式干扰
- 分步生成SQL,无效查询率显著降低
- 适合需要精准表格推理的AI应用
表格理解需要结构化、多步骤推理。大语言模型因表格数据结构复杂而表现不佳。近期基于SQL生成的多智能体框架虽有潜力,但存在难以理解表结构、错误传播导致无效查询、过度依赖执行正确性等问题。为此,我们提出链式查询(Chain-of-Query, CoQ)框架,采用自然语言风格的表模式表示,消除结构噪声以增强理解;采用逐子句生成SQL策略提升查询质量;引入混合推理分工,将基于SQL的机械推理与基于LLM的逻辑推理分离,降低对执行结果的依赖。在四个模型和五个主流基准上的大量实验表明,CoQ在准确率上显著优于现有通用大模型、基于SQL的及混合基线方法,且无效SQL率大幅下降,验证了其在表格理解中的优越性能。代码已开源:https://github.com/SongyuanSui/ChainofQuery。
原文摘要 · Abstract (English)
Table understanding requires structured, multi-step reasoning. Large Language Models (LLMs) struggle with it due to the structural complexity of tabular data. Recently, multi-agent frameworks for SQL generation have shown promise in tackling the challenges of understanding tabular data, but existing approaches often suffer from limitations such as the inability to comprehend table structure for reliable SQL generation, error propagation that results in invalid queries, and over-reliance on execution correctness. To address these issues, we propose Chain-of-Query (CoQ), a novel multi-agent framework for SQL-aided table understanding. CoQ adopts natural-language-style representations of table schemas to abstract away structural noise and enhance understanding. It employs a clause-by-clause SQL generation strategy to improve query quality and introduces a hybrid reasoning division that separates SQL-based mechanical reasoning from LLM-based logical inference, thereby reducing reliance on execution outcomes. Extensive experiments across four models and five widely used benchmarks demonstrate that CoQ achieves substantial accuracy improvements and significantly lowers invalid SQL rates compared to prior generic LLM-based, SQL-aided, and hybrid baselines, confirming its superior effectiveness in table understanding. The code is available at https://github.com/SongyuanSui/ChainofQuery.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。