Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

CHESS: Contextual Harnessing for Efficient SQL Synthesis

About

Translating natural language questions into SQL queries, known as text-to-SQL, is a long-standing research problem. Effective text-to-SQL synthesis can become very challenging due to (i) the extensive size of database catalogs (descriptions of tables and their columns) and database values, (ii) reasoning over large database schemas, (iii) ensuring the functional validity of the generated queries, and (iv) navigating the ambiguities of natural language questions. We introduce CHESS, a Large Language Model (LLM) based multi-agent framework for efficient and scalable SQL synthesis, comprising four specialized agents, each targeting one of the aforementioned challenges: the Information Retriever (IR) extracts relevant data, the Schema Selector (SS) prunes large schemas, the Candidate Generator (CG) generates high-quality candidates and refines queries iteratively, and the Unit Tester (UT) validates queries through LLM-based natural language unit tests. Our framework offers configurable features that adapt to various deployment constraints, including 1) Supporting industrial-scale databases: leveraging the Schema Selector agent, CHESS efficiently narrows down very large database schemas into manageable sub-schemas, boosting system accuracy by approximately $2\%$ and reducing the number of LLM tokens by $\times 5$. 2) State-of-the-Art privacy-preserving performance: Among the methods using open-source models, CHESS achieves state-of-the-art performance, resulting in a high-performing, privacy-preserving system suitable for industrial deployment. 3) Scalablity with additional compute budget: In settings with high computational budgets, CHESS achieves $71.10\%$ accuracy on the BIRD test set, within $2\%$ of the leading proprietary method, while requiring approximately $83\%$ fewer LLM calls.

Shayan Talaei, Mohammadreza Pourreza, Yu-Chen Chang, Azalia Mirhoseini, Amin Saberi• 2024

Related benchmarks

TaskDatasetResultRank
Text-to-SQLBIRD (dev)
Execution Accuracy (EA)68.31
251
Text-to-SQLSpider (test)
Execution Accuracy89.6
162
Text-to-SQLSpider (dev)--
100
Text-to-SQLSpider 1.0 (test)
EM Acc (Overall)87.2
91
Text-to-SQLSpider
Exec Acc (All)83.3
91
Text-to-SQLBird
Total Execution Accuracy62.14
64
Text-to-SQLLogicCat
Exact Match19.21
58
Text-to-SQLBIRD (test)
EX71.1
46
Text-to-SQLArcher (dev)
Execution Accuracy35.54
36
Text-to-SQLSpider Lite 2.0
Execution Accuracy (EX)3.83
24
Showing 10 of 14 rows

Other info

Code

Follow for update