用小模型+多智能体机制,让本地部署的文本转SQL更准更快。
A Multi-agent Text2SQL Framework using Small Language Models and Execution Feedback
- 设计多智能体协作框架,分工负责生成与验证,减轻单个模型负担。
- 在单张显卡上运行,准确率接近大模型,参数量却少得多。
- 适合注重隐私和成本的企业,尤其是想自建文本转SQL系统的团队。
文本转SQL是数据工程中的关键挑战。尽管大语言模型(LLMs)因强大的理解与生成能力表现出色,但其隐私与成本问题限制了企业使用外部服务。因此,许多公司转向可本地部署的小型语言模型(SLMs)。然而,这些SLMs泛化能力不足,难以胜任复杂任务如文本转SQL。为此,我们提出MATS,一种专为SLMs设计的新型文本转SQL框架。MATS采用多智能体机制,赋予辅助智能体特定角色,降低个体负载并促进协作。基于强化学习的训练方案利用执行反馈对齐各智能体,从而在模型规模受限的情况下保持竞争力。在基准数据集上的评估显示,MATS在单张GPU服务器上部署时,准确率与大规模LLMs相当,但参数量显著减少。代码与数据已公开于https://github.com/thanhdath/mats-sql。
原文摘要 · Abstract (English)
Text2SQL, the task of generating SQL queries from natural language text, is a critical challenge in data engineering. Recently, Large Language Models (LLMs) have demonstrated superior performance for this task due to their advanced comprehension and generation capabilities. However, privacy and cost considerations prevent companies from using Text2SQL solutions based on external LLMs offered as a service. Rather, small LLMs (SLMs) that are openly available and can hosted in-house are adopted. These SLMs, in turn, lack the generalization capabilities of larger LLMs, which impairs their effectiveness for complex tasks such as Text2SQL. To address these limitations, we propose MATS, a novel Text2SQL framework designed specifically for SLMs. MATS uses a multi-agent mechanism that assigns specialized roles to auxiliary agents, reducing individual workloads and fostering interaction. A training scheme based on reinforcement learning aligns these agents using feedback obtained during execution, thereby maintaining competitive performance despite a limited LLM size. Evaluation results using on benchmark datasets show that MATS, deployed on a single- GPU server, yields accuracy that are on-par with large-scale LLMs when using significantly fewer parameters. Our source code and data are available at https://github.com/thanhdath/mats-sql.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。