MGRR-SQL: Multi-Granularity Relevant Retrieval-Based in-Context Learning Approach for Text-to-SQL Generation
In-Context learning serves as a vital component for enhancing Text-to-SQL task performance. However, current in-context learning methodologies for Text-to-SQL applications fail to sufficiently bridge the significant cross-domain correlation gap that exists between few-shot examples and the intended query target. Our approach overcomes these challenges through a novel relevant retrieval-based in-context learning method, which operates across three distinct granularity levels: (1) semantic similarity retrieval for analogous questions, (2) query kernel entity matching for retrieving strongly relevant questions and (3) character-level similarity analysis for fine-grained question retrieval. Additionally, we introduce a novel Object-Relational Mapping (ORM)-based database prompt and a post cell value linking method that effectively describes the schema while avoiding error propagation common in traditional schema linking approaches. Our experimental evaluations conducted on the benchmark datasets BIRD and Spider reveal that our approach delivers strong performance, comparable to state-of-the-art methods.
Authors
- Zhao Li (ORCID: https://orcid.org/0000-0001-7702-3348)
- Yang Li (ORCID: https://orcid.org/0000-0002-0736-251X)
- Tong Chen (ORCID: https://orcid.org/0000-0001-7269-146X)
- Shiwei Wu (ORCID: https://orcid.org/0000-0002-3206-6827)
- Yiming Zhan
Institutions
- Qilu University of Technology (CN)
- Hainan University (CN)
- Shandong Academy of Sciences (CN)
Publication Details
- Published
- 2025-03-21
- DOI
- https://doi.org/10.1109/icaace65325.2025.11019241
- Primary Topic
- Semantic Web and Ontologies
- Type
- article
- Field-Weighted Citation Impact
- 0.00