Cooperative SQL Generation for Segmented Databases By Using Multi-functional LLM Agents
This addresses the problem of generating accurate SQL queries from natural language for users in database management, with an incremental approach that enhances privacy through agent collaboration.
The paper tackles the Text-to-SQL task by proposing a cooperative framework using multi-functional LLM agents to generate SQL queries from user questions, achieving performance comparable to state-of-the-art methods on Spider and Bird benchmarks while maintaining data privacy across segmented databases.
Text-to-SQL task aims to automatically yield SQL queries according to user text questions. To address this problem, we propose a Cooperative SQL Generation framework based on Multi-functional Agents (CSMA) through information interaction among large language model (LLM) based agents who own part of the database schema seperately. Inspired by the collaboration in human teamwork, CSMA consists of three stages: 1) Question-related schema collection, 2) Question-corresponding SQL query generation, and 3) SQL query correctness check. In the first stage, agents analyze their respective schema and communicate with each other to collect the schema information relevant to the question. In the second stage, agents try to generate the corresponding SQL query for the question using the collected information. In the third stage, agents check if the SQL query is created correctly according to their known information. This interaction-based method makes the question-relevant part of database schema from each agent to be used for SQL generation and check. Experiments on the Spider and Bird benckmark demonstrate that CSMA achieves a high performance level comparable to the state-of-the-arts, meanwhile holding the private data in these individual agents.