DCG-SQL: Enhancing In-Context Learning for Text-to-SQL with Deep Contextual Schema Link Graph

πŸ“… 2025-05-26
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF

career value

137K/year
πŸ€– AI Summary
Existing Text-to-SQL approaches over-rely on the intrinsic capabilities of large language models (LLMs), employing coarse-grained and semantically misaligned example retrieval, which leads to sharp performance degradation in smaller models. To address this, we propose a retrieval-generation framework grounded in a Deep Contextual Pattern Linking Graph (DCPLG). Our method introduces a fine-grained semantic relationship graph explicitly modeling associations between natural language questions and database schema elements, thereby decoupling schema understanding from SQL generation. Guided by this graph structure, we perform context-aware example retrieval and integrate schema-linking–enhanced in-context learning. On the Spider benchmark, our approach improves the execution accuracy of Llama 3.1-8B by 12.7%, substantially narrowing the performance gap between small and large models, while preserving state-of-the-art (SOTA) accuracy for large models and accelerating inference.

Technology Category

Application Category

πŸ“ Abstract
Text-to-SQL, which translates a natural language question into an SQL query, has advanced with in-context learning of Large Language Models (LLMs). However, existing methods show little improvement in performance compared to randomly chosen demonstrations, and significant performance drops when smaller LLMs (e.g., Llama 3.1-8B) are used. This indicates that these methods heavily rely on the intrinsic capabilities of hyper-scaled LLMs, rather than effectively retrieving useful demonstrations. In this paper, we propose a novel approach for effectively retrieving demonstrations and generating SQL queries. We construct a Deep Contextual Schema Link Graph, which contains key information and semantic relationship between a question and its database schema items. This graph-based structure enables effective representation of Text-to-SQL samples and retrieval of useful demonstrations for in-context learning. Experimental results on the Spider benchmark demonstrate the effectiveness of our approach, showing consistent improvements in SQL generation performance and efficiency across both hyper-scaled LLMs and small LLMs. Our code will be released.
Problem

Research questions and friction points this paper is trying to address.

Improving Text-to-SQL performance with in-context learning
Addressing performance drops in smaller LLMs for SQL generation
Enhancing demonstration retrieval using schema link graphs
Innovation

Methods, ideas, or system contributions that make the work stand out.

Constructs Deep Contextual Schema Link Graph
Retrieves useful demonstrations effectively
Improves SQL generation across LLMs
πŸ”Ž Similar Papers