A Case-Based Reasoning Framework for Adaptive Prompting in Cross-Domain Text-to-SQL

04/26/2023
by   Chunxi Guo, et al.
0

Recent advancements in Large Language Models (LLMs), such as Codex, ChatGPT and GPT-4 have significantly impacted the AI community, including Text-to-SQL tasks. Some evaluations and analyses on LLMs show their potential to generate SQL queries but they point out poorly designed prompts (e.g. simplistic construction or random sampling) limit LLMs' performance and may cause unnecessary or irrelevant outputs. To address these issues, we propose CBR-ApSQL, a Case-Based Reasoning (CBR)-based framework combined with GPT-3.5 for precise control over case-relevant and case-irrelevant knowledge in Text-to-SQL tasks. We design adaptive prompts for flexibly adjusting inputs for GPT-3.5, which involves (1) adaptively retrieving cases according to the question intention by de-semantizing the input question, and (2) an adaptive fallback mechanism to ensure the informativeness of the prompt, as well as the relevance between cases and the prompt. In the de-semanticization phase, we designed Semantic Domain Relevance Evaluator(SDRE), combined with Poincaré detector(mining implicit semantics in hyperbolic space), TextAlign(discovering explicit matches), and Positector (part-of-speech detector). SDRE semantically and syntactically generates in-context exemplar annotations for the new case. On the three cross-domain datasets, our framework outperforms the state-of-the-art(SOTA) model in execution accuracy by 3.7%, 2.5%, and 8.2%, respectively.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/23/2023

Divide and Prompt: Chain of Thought Prompting for Text-to-SQL

Chain-of-thought (CoT) prompting combined with large language models (LL...
research
04/07/2020

RYANSQL: Recursively Applying Sketch-based Slot Fillings for Complex Text-to-SQL in Cross-Domain Databases

Text-to-SQL is the problem of converting a user question into an SQL que...
research
05/20/2019

Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representation

We present a neural approach called IRNet for complex and cross-domain T...
research
05/19/2023

How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settings

Large language models (LLMs) with in-context learning have demonstrated ...
research
04/18/2019

Clause-Wise and Recursive Decoding for Complex and Cross-Domain Text-to-SQL Generation

Most deep learning approaches for text-to-SQL generation are limited to ...
research
06/08/2021

Turing: an Accurate and Interpretable Multi-Hypothesis Cross-Domain Natural Language Database Interface

A natural language database interface (NLDB) can democratize data-driven...
research
12/21/2020

MT-Teql: Evaluating and Augmenting Consistency of Text-to-SQL Models with Metamorphic Testing

Text-to-SQL is a task to generate SQL queries from human utterances. How...

Please sign up or login with your details

Forgot password? Click here to reset