Enhancing Chain-of-Thought Reasoning for Text-to-SQL with Effective Retrieval-Augmented Generation
摘要
The problem of text-to-SQL, which aims at translating natural language questions into SQL queries, has caught increasing attention from the research communities. With the rapid advances in the era of Large Language Model (LLM), nowadays in-context learning over LLMs has become the mainstream methodology for text-to-SQL. Although there are many previous studies in this area, their performance is not so ideal since they fail to fully utilize the reasoning capacity of LLMs. In this paper, we proposed a novel framework to improve the performance of text-to-SQL by leveraging the Chain-of-Thought style (CoT) prompt strategy over LLM. We decompose the process of SQL translation into three stages and construct effective prompts to realize each of them, respectively. To further improve the performance, we adopt the Retrieval Augment Generation (RAG) strategy to include essential contextual information in the prompts to provide more useful insights for in-context learning. We conduct experiments on several benchmarking datasets and the results show that our proposed methods could outperform existing solutions by an obvious margin.