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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

A Two-Stage SQL Generation Method Based on Lightweight Large Language Model

  • Jiaqi Shi,
  • Qing Zhu,
  • Wei Yu,
  • Hu Wang,
  • Jian Tan,
  • Ruiqiang Li

摘要

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.