MageSQL: Enhancing In-context Learning for Text-to-SQL Applications with Large Language Models
Chen Shen, Jin Wang, Sajjadur Rahman, Eser Kandogan

TL;DR
MageSQL significantly improves text-to-SQL translation by leveraging SQL syntax and semantics for better prompt construction and error correction, outperforming existing methods on benchmark datasets.
Contribution
Introduces MageSQL, a novel in-context learning approach with graph-based demonstration selection and error correction for enhanced text-to-SQL performance.
Findings
Outperforms state-of-the-art methods on benchmark datasets.
Utilizes SQL-specific graph contrastive learning for demonstration selection.
Incorporates an error correction module to improve SQL translation accuracy.
Abstract
The text-to-SQL problem aims to translate natural language questions into SQL statements to ease the interaction between database systems and end users. Recently, Large Language Models (LLMs) have exhibited impressive capabilities in a variety of tasks, including text-to-SQL. While prior works have explored various strategies for prompting LLMs to generate SQL statements, they still fall short of fully harnessing the power of LLM due to the lack of (1) high-quality contextual information when constructing the prompts and (2) robust feedback mechanisms to correct translation errors. To address these challenges, we propose MageSQL, a text-to-SQL approach based on in-context learning over LLMs. MageSQL explores a suite of techniques that leverage the syntax and semantics of SQL queries to identify relevant few-shot demonstrations as context for prompting LLMs. In particular, we introduce a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSemantic Web and Ontologies · Service-Oriented Architecture and Web Services
