TCSR-SQL: Towards Table Content-aware Text-to-SQL with Self-retrieval

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Xu, Wenbo, Yan, Liang, Liu, Chuanyi, Han, Peiyi, Zhu, Haifeng, Xu, Yong, Liang, Yingwei, Zhang, Bob
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866914139541078016
author Xu, Wenbo
Yan, Liang
Liu, Chuanyi
Han, Peiyi
Zhu, Haifeng
Xu, Yong
Liang, Yingwei
Zhang, Bob
author_facet Xu, Wenbo
Yan, Liang
Liu, Chuanyi
Han, Peiyi
Zhu, Haifeng
Xu, Yong
Liang, Yingwei
Zhang, Bob
contents Large Language Model-based (LLM-based) Text-to-SQL methods have achieved important progress in generating SQL queries for real-world applications. When confronted with table content-aware questions in real-world scenarios, ambiguous data content keywords and nonexistent database schema column names within the question lead to the poor performance of existing methods. To solve this problem, we propose a novel approach towards Table Content-aware Text-to-SQL with Self-Retrieval (TCSR-SQL). It leverages LLM's in-context learning capability to extract data content keywords within the question and infer possible related database schema, which is used to generate Seed SQL to fuzz search databases. The search results are further used to confirm the encoding knowledge with the designed encoding knowledge table, including column names and exact stored content values used in the SQL. The encoding knowledge is sent to obtain the final Precise SQL following multi-rounds of generation-execution-revision process. To validate our approach, we introduce a table-content-aware, question-related benchmark dataset, containing 2115 question-SQL pairs. Comprehensive experiments conducted on this benchmark demonstrate the remarkable performance of TCSR-SQL, achieving an improvement of at least 27.8% in execution accuracy compared to other state-of-the-art methods.
format Preprint
id arxiv_https___arxiv_org_abs_2407_01183
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle TCSR-SQL: Towards Table Content-aware Text-to-SQL with Self-retrieval
Xu, Wenbo
Yan, Liang
Liu, Chuanyi
Han, Peiyi
Zhu, Haifeng
Xu, Yong
Liang, Yingwei
Zhang, Bob
Databases
Large Language Model-based (LLM-based) Text-to-SQL methods have achieved important progress in generating SQL queries for real-world applications. When confronted with table content-aware questions in real-world scenarios, ambiguous data content keywords and nonexistent database schema column names within the question lead to the poor performance of existing methods. To solve this problem, we propose a novel approach towards Table Content-aware Text-to-SQL with Self-Retrieval (TCSR-SQL). It leverages LLM's in-context learning capability to extract data content keywords within the question and infer possible related database schema, which is used to generate Seed SQL to fuzz search databases. The search results are further used to confirm the encoding knowledge with the designed encoding knowledge table, including column names and exact stored content values used in the SQL. The encoding knowledge is sent to obtain the final Precise SQL following multi-rounds of generation-execution-revision process. To validate our approach, we introduce a table-content-aware, question-related benchmark dataset, containing 2115 question-SQL pairs. Comprehensive experiments conducted on this benchmark demonstrate the remarkable performance of TCSR-SQL, achieving an improvement of at least 27.8% in execution accuracy compared to other state-of-the-art methods.
title TCSR-SQL: Towards Table Content-aware Text-to-SQL with Self-retrieval
topic Databases
url https://arxiv.org/abs/2407.01183