MAC-SQL:一种面向 Text-to-SQL 的多智能体协作框架
MAC-SQL: A Multi-Agent Collaborative Framework for Text-to-SQL
AI总结:
提出 MAC-SQL 多智能体协作框架,通过分解器与可扩展辅助智能体结合外部工具和模型协作,解决复杂数据库上的 Text-to-SQL 难题,并在 BIRD 上取得 SOTA。
摘要:
近期基于 LLM 的 Text-to-SQL 方法在“庞大”数据库以及需要多步推理的复杂用户问题上通常会出现显著的性能下降。此外,大多数现有方法忽视了 LLM 使用外部工具和模型协作的关键重要性。为应对这些挑战,我们提出 MAC-SQL,这是一种新颖的、基于 LLM 的多智能体协作框架。我们的框架包含一个核心分解器智能体,用于通过少样本思维链推理生成 Text-to-SQL;同时配有两个辅助智能体,它们利用外部工具或模型获取更小的子数据库并修正错误的 SQL 查询。分解器智能体与辅助智能体协作,辅助智能体根据需要被激活,并且可以扩展以纳入新的功能或工具,从而实现有效的 Text-to-SQL 解析。在我们的框架中,我们最初利用 GPT-4 作为所有智能体任务的强大骨干 LLM,以确定该框架的性能上限。随后,我们利用 Code Llama 7B 微调了一个遵循指令的开源模型 SQL-Llama,使其像 GPT-4 一样完成所有任务。实验表明,与原始 GPT-4 的 46.35 基线准确率相比,SQL-Llama 达到了具有可比性的 43.94 执行准确率。在撰写本文时,MAC-SQL+GPT-4 在 BIRD 基准上评估时取得了 59.59 的执行准确率,在其保留测试集上确立了新的最先进水平(SOTA)(https://github.com/wbbeyourself/MAC-SQL)。
英文摘要:
Recent LLM-based Text-to-SQL methods usually suffer from significant performance degradation on "huge" databases and complex user questions that require multi-step reasoning. Moreover, most existing methods neglect the crucial significance of LLMs utilizing external tools and model collaboration. To address these challenges, we introduce MAC-SQL, a novel LLM-based multi-agent collaborative framework. Our framework comprises a core decomposer agent for Text-to-SQL generation with few-shot chain-of-thought reasoning, accompanied by two auxiliary agents that utilize external tools or models to acquire smaller sub-databases and refine erroneous SQL queries. The decomposer agent collaborates with auxiliary agents, which are activated as needed and can be expanded to accommodate new features or tools for effective Text-to-SQL parsing. In our framework, We initially leverage GPT-4 as the strong backbone LLM for all agent tasks to determine the upper bound of our framework. We then fine-tune an open-sourced instruction-followed model, SQL-Llama, by leveraging Code Llama 7B, to accomplish all tasks as GPT-4 does. Experiments show that SQL-Llama achieves a comparable execution accuracy of 43.94, compared to the baseline accuracy of 46.35 for vanilla GPT-4. At the time of writing, MAC-SQL+GPT-4 achieves an execution accuracy of 59.59 when evaluated on the BIRD benchmark, establishing a new state-of-the-art (SOTA) on its holdout test set (https://github.com/wbbeyourself/MAC-SQL).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。