Hybrid Querying Over Relational Databases and Large Language Models
Not on the map. Why?
Abstract (arXiv)
Database queries traditionally operate under the closed-world assumption, providing no answers to questions that require information beyond the data stored in the database. Hybrid querying using SQL offers an alternative by integrating relational databases with large language models (LLMs) to answer beyond-database questions. In this paper, we present the first cross-domain benchmark, SWAN, containing 120 beyond-database questions over four real-world databases. To leverage state-of-the-art language models in addressing these complex questions in SWAN, we present two solutions: one based on schema expansion and the other based on user defined functions. We also discuss optimization opportunities and potential future directions. Our evaluation demonstrates that using GPT-4 Turbo with few-shot prompts, one can achieves up to 40.0% in execution accuracy and 48.2% in data factuality. These results highlights both the potential and challenges for hybrid querying. We believe that our work will inspire further research in creating more efficient and accurate data systems that seamlessly integrate relational databases and large language models to address beyond-database questions.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 17 of its 47 references that are in the map. First posted on arXiv 1 Aug 2024.
Builds on
17 of 47 references.
References · 17
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,568
- 2024From Local to Global: A Graph RAG Approach to Query-Focused Summarizationcited by 1,453
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 477
- 2023Survey on Factuality in Large Language Models: Knowledge, Retrieval and Domain-Specificitycited by 206
- 2024Large Language Models are Geographically Biasedcited by 93
- 2023Batch Prompting: Efficient Inference with Large Language Model APIscited by 85
- 2024Enhancing LLM Factual Accuracy with RAG to Counter Hallucinations: A Case Study on Domain-Specific Queries in Private Knowledge-Basescited by 77
5 more
- 2023Large Language Models as Data Preprocessorscited by 34
- 2024BlendSQL: A Scalable Dialect for Unifying Hybrid Question Answering in Relational Algebracited by 24
- 2023Querying Large Language Models with SQLcited by 14
- 2023Revisiting Prompt Engineering via Declarative Crowdsourcingcited by 12
- 2023LLM-SQL-Solver: Can LLMs Determine SQL Equivalence?cited by 10
Built on by
Citing papers per year: 2025: 2; 2026: 1.
3 papers.
- 2025Access Paths for Efficient Ordering with Large Language Modelscited by 1
- 2025An advanced AI driven database systemcited by 0
- 2026Compositional Online Learning for Semantic Data Processing Systemscited by 0
- 2026Compositional Online Learning for Semantic Data Processing Systems27 Aug 2026
- 2025Access Paths for Efficient Ordering with Large Language Models30 Aug 2025
- 2025An advanced AI driven database system22 Jul 2025