A Two-Stage SQL Generation Method Based on Lightweight Large Language Model
摘要
In the task of converting natural language queries into structured query statements (also known as SQL generation), large language models (LLM) can bring higher question-answering accuracy and user experience. However, the high hardware resource requirements make it difficult to apply LLM. And existing lightweight language models have problems with positioning bias and insufficient accuracy in the task. To narrow the performance gap between lightweight language models and LLM, and improve model usability, the paper proposes a two-stage SQL generation method. The method decomposes the complex natural language query task into two steps, which are fine-tuned separately and evaluated on a dedicated dataset. Experiments show that the proposed method can effectively improve the accuracy of SQL generation, making the comprehensive query accuracy of the lightweight model is close to the performance of LLM.