Enhancements in Data Querying: Applying MMR-Integrated In-Context Learning to LLM-based Text-to-SQL
Junfang Li, Ming Huang, Zeng Zhenyu, Yang Chuniie · 2024
In the modern business ecosystem, informed decision-making relies heavily on effective data utilization. To enable more intuitive and efficient data access, Text-to-SQL technologies serve as a crucial bridge. This paper introduces an improvement by integrating the Maximal Marginal Relevance (MMR) with In-Context Learning (ICL) to improve the performance of Large Language Models (LLMs) in generating SQL queries. This research focuses on strategically deploying MMR within ICL frameworks, optimizing prompt construction by balancing relevance and diversity of examples. This method was rigorously tested on datasets from domains such as tobacco and automotive marketing, as well as the cross-domain SPIDER benchmark. Results demonstrate that the proposed method excels in both domain-specific and complex questions.