Retrieval-augmented GPT-3.5-based Text-to-SQL Framework with Sample-aware Prompting and Dynamic Revision Chain

要約

Text-to-SQL は、指定された自然言語の質問に対して SQL クエリを生成し、ユーザーがデータベースにクエリできるようにすることを目的としています。
大規模言語モデル (LLM) を使用した即時学習が最近のアプローチとして登場しており、LLM が入力された質問を理解し、対応する SQL を生成できるようにプロンプ​​トを設計します。
ただし、厳密な SQL 構文要件という課題に直面しています。
既存の作業では、LLM にデモンストレーション例 (つまり、質問と SQL のペア) のリストを使用して SQL を生成するように指示しますが、固定プロンプトでは、取得されたデモンストレーションと入力された質問の間の意味論的なギャップが大きいシナリオにほとんど対応できません。
この論文では、LLM ベースの Text-to-SQL フレームワーク向けに、サンプル認識プロンプトと動的リビジョン チェーンを含む、検索拡張プロンプト手法を提案します。
私たちのアプローチには、SQL 演算子の構成や特定の質問に関連する詳細な情報を含む、サンプルを意識したデモンストレーションが組み込まれています。
入力された質問と同様の意図を共有する質問を検索するために、検索を支援する 2 つの戦略を提案します。
まず、LLM を活用して元の質問を簡素化し、構文を統一して、ユーザーの意図を明確にします。
人間の介入なしで実行可能で正確な SQL を生成するために、以前に生成された SQL からのきめ細かいフィードバックを繰り返し適応させる動的リビジョン チェーンを設計します。
3 つの Text-to-SQL ベンチマークの実験結果は、強力なベースライン モデルに対するこの手法の優位性を示しています。

要約(オリジナル)

Text-to-SQL aims at generating SQL queries for the given natural language questions and thus helping users to query databases. Prompt learning with large language models (LLMs) has emerged as a recent approach, which designs prompts to lead LLMs to understand the input question and generate the corresponding SQL. However, it faces challenges with strict SQL syntax requirements. Existing work prompts the LLMs with a list of demonstration examples (i.e. question-SQL pairs) to generate SQL, but the fixed prompts can hardly handle the scenario where the semantic gap between the retrieved demonstration and the input question is large. In this paper, we propose a retrieval-augmented prompting method for a LLM-based Text-to-SQL framework, involving sample-aware prompting and a dynamic revision chain. Our approach incorporates sample-aware demonstrations, which include the composition of SQL operators and fine-grained information related to the given question. To retrieve questions sharing similar intents with input questions, we propose two strategies for assisting retrieval. Firstly, we leverage LLMs to simplify the original questions, unifying the syntax and thereby clarifying the users’ intentions. To generate executable and accurate SQLs without human intervention, we design a dynamic revision chain which iteratively adapts fine-grained feedback from the previously generated SQL. Experimental results on three Text-to-SQL benchmarks demonstrate the superiority of our method over strong baseline models.

arxiv情報

著者 Chunxi Guo,Zhiliang Tian,Jintao Tang,Shasha Li,Zhihua Wen,Kaixuan Wang,Ting Wang
発行日 2023-07-11 07:16:22+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.DB, cs.IR パーマリンク