Skip to main content
QUICK REVIEW

[Paper Review] Large Language Model Enhanced Text-to-SQL Generation: A Survey

Xiaohu Zhu, Qian Li|arXiv (Cornell University)|Oct 8, 2024
Topic ModelingComputer Science3 citations
TL;DR

This survey comprehensively reviews large language model (LLM)-enhanced text-to-SQL generation, categorizing methods into prompt engineering, fine-tuning, task-training, and LLM agent approaches. It identifies key advancements in zero-shot and few-shot prompting, parameter-efficient fine-tuning, and multi-agent systems that improve SQL accuracy and generalization across domains.

ABSTRACT

Text-to-SQL translates natural language queries into Structured Query Language (SQL) commands, enabling users to interact with databases using natural language. Essentially, the text-to-SQL task is a text generation task, and its development is primarily dependent on changes in language models. Especially with the rapid development of Large Language Models (LLMs), the pattern of text-to-SQL has undergone significant changes. Existing survey work mainly focuses on rule-based and neural-based approaches, but it still lacks a survey of Text-to-SQL with LLMs. In this paper, we survey the large language model enhanced text-to-SQL generations, classifying them into prompt engineering, fine-tuning, pre-trained, and Agent groups according to training strategies. We also summarize datasets and evaluation metrics comprehensively. This survey could help people better understand the pattern, research status, and challenges of LLM-based text-to-SQL generations.

Motivation & Objective

  • To address the gap in existing surveys that overlook LLM-based text-to-SQL methods, particularly in prompting and agent-based frameworks.
  • To systematically classify LLM-enhanced text-to-SQL approaches by training strategy, including prompt engineering, fine-tuning, task-training, and agent-based systems.
  • To provide a comprehensive summary of benchmark datasets and evaluation metrics, including exact match, execution accuracy, and test-suite accuracy.
  • To analyze challenges in real-world deployment, such as cross-domain generalization, schema linking, and handling complex or ambiguous queries.
  • To guide future research by identifying open problems in zero-shot generalization, multilingual support, and cost-effective deployment of LLM-based text-to-SQL systems.

Proposed method

  • Categorizes LLM-based text-to-SQL into four training strategy groups: prompt engineering (no training), fine-tuning (full or parameter-efficient), task-training (training from scratch with LLM-like architectures), and LLM agent frameworks.
  • Employs few-shot and zero-shot prompting with carefully designed templates to guide LLMs in generating correct SQL from natural language and schema.
  • Reviews parameter-efficient fine-tuning (PEFT) techniques such as LoRA and adapters to adapt pre-trained LLMs to text-to-SQL with minimal compute cost.
  • Analyzes multi-agent systems like MAC-SQL and SQLFixAgent that use specialized agents (e.g., decomposer, selector, refiner) to break down queries, detect errors, and correct SQL via external execution tools.
  • Integrates external knowledge retrieval and dynamic feedback loops in agents like Distyl AI’s Analytics Insight Engine to improve query reliability and user intent alignment.
  • Proposes a structured evaluation framework using standard datasets (e.g., Spider, DAIL-SQL, BRIDGE v2) and metrics like execution accuracy and test-suite accuracy to assess model performance across single- and multi-turn interactions.

Experimental results

Research questions

  • RQ1How do different LLM training strategies—prompting, fine-tuning, task-training, and agent-based frameworks—compare in terms of accuracy, generalization, and efficiency for text-to-SQL?
  • RQ2What are the key design principles and components of effective prompt engineering for zero-shot and few-shot text-to-SQL generation?
  • RQ3To what extent can parameter-efficient fine-tuning improve LLM generalization on low-resource or out-of-domain databases?
  • RQ4How do multi-agent systems enhance SQL generation by enabling stepwise reasoning, error detection, and self-correction using external tools?
  • RQ5What are the major limitations of current datasets and evaluation metrics in reflecting real-world text-to-SQL challenges such as schema linking and multi-turn dialogue?

Key findings

  • LLM-based text-to-SQL models, especially those using few-shot prompting or fine-tuning, achieve state-of-the-art performance on benchmark datasets like Spider, with execution accuracy approaching or surpassing 90% in some cases.
  • Multi-agent frameworks such as MAC-SQL and SQLFixAgent significantly improve robustness by decomposing complex queries, detecting errors, and repairing SQL through external execution feedback.
  • Parameter-efficient fine-tuning (PEFT) methods like LoRA enable effective adaptation of LLMs to text-to-SQL with minimal computational cost and strong zero-shot generalization on unseen databases.
  • Agent-based systems that incorporate external tools (e.g., database execution, retrievers) demonstrate superior performance on complex or ambiguous queries by enabling dynamic correction and verification.
  • Datasets like DAIL-SQL and BRIDGE v2 improve few-shot prompting by selecting semantically similar examples, enhancing reliability and consistency in generated SQL.
  • Evaluation metrics such as test-suite accuracy and execution accuracy are more reliable indicators of real-world performance than exact match, especially for complex or ambiguous queries.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.