SQL-to-Schema Enhances Schema Linking in Text-to-SQL

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Yang, Sun, Su, Qiong, Li, Zhishuai, Li, Ziyue, Mao, Hangyu, Liu, Chenxi, Zhao, Rui
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916248914231296
author Yang, Sun
Su, Qiong
Li, Zhishuai
Li, Ziyue
Mao, Hangyu
Liu, Chenxi
Zhao, Rui
author_facet Yang, Sun
Su, Qiong
Li, Zhishuai
Li, Ziyue
Mao, Hangyu
Liu, Chenxi
Zhao, Rui
contents In sophisticated existing Text-to-SQL methods exhibit errors in various proportions, including schema-linking errors (incorrect columns, tables, or extra columns), join errors, nested errors, and group-by errors. Consequently, there is a critical need to filter out unnecessary tables and columns, directing the language models attention to relevant tables and columns with schema-linking, to reduce errors during SQL generation. Previous approaches have involved sorting tables and columns based on their relevance to the question, selecting the top-ranked ones for sorting, or directly identifying the necessary tables and columns for SQL generation. However, these methods face challenges such as lengthy model training times, high consumption of expensive GPT-4 tokens in few-shot prompts, or suboptimal performance in schema linking. Therefore, we propose an inventive schema linking method in two steps: Firstly, generate an initial SQL query by utilizing the complete database schema. Subsequently, extract tables and columns from the initial SQL query to create a concise schema. Using CodeLlama-34B, when comparing the schemas obtained by mainstream methods with ours for SQL generation, our schema performs optimally. Leveraging GPT4, our SQL generation method achieved results that are comparable to mainstream Text-to-SQL methods on the Spider dataset.
format Preprint
id arxiv_https___arxiv_org_abs_2405_09593
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle SQL-to-Schema Enhances Schema Linking in Text-to-SQL
Yang, Sun
Su, Qiong
Li, Zhishuai
Li, Ziyue
Mao, Hangyu
Liu, Chenxi
Zhao, Rui
Databases
Artificial Intelligence
In sophisticated existing Text-to-SQL methods exhibit errors in various proportions, including schema-linking errors (incorrect columns, tables, or extra columns), join errors, nested errors, and group-by errors. Consequently, there is a critical need to filter out unnecessary tables and columns, directing the language models attention to relevant tables and columns with schema-linking, to reduce errors during SQL generation. Previous approaches have involved sorting tables and columns based on their relevance to the question, selecting the top-ranked ones for sorting, or directly identifying the necessary tables and columns for SQL generation. However, these methods face challenges such as lengthy model training times, high consumption of expensive GPT-4 tokens in few-shot prompts, or suboptimal performance in schema linking. Therefore, we propose an inventive schema linking method in two steps: Firstly, generate an initial SQL query by utilizing the complete database schema. Subsequently, extract tables and columns from the initial SQL query to create a concise schema. Using CodeLlama-34B, when comparing the schemas obtained by mainstream methods with ours for SQL generation, our schema performs optimally. Leveraging GPT4, our SQL generation method achieved results that are comparable to mainstream Text-to-SQL methods on the Spider dataset.
title SQL-to-Schema Enhances Schema Linking in Text-to-SQL
topic Databases
Artificial Intelligence
url https://arxiv.org/abs/2405.09593