Saved in:
Bibliographic Details
Main Authors: Wang, Zhongyuan, Zhang, Richong, Nie, Zhijie, Kim, Jaein
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2408.16991
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866929479227539456
author Wang, Zhongyuan
Zhang, Richong
Nie, Zhijie
Kim, Jaein
author_facet Wang, Zhongyuan
Zhang, Richong
Nie, Zhijie
Kim, Jaein
contents Recent Text-to-SQL methods leverage large language models (LLMs) by incorporating feedback from the database management system. While these methods effectively address execution errors in SQL queries, they struggle with database mismatches -- errors that do not trigger execution exceptions. Database mismatches include issues such as condition mismatches and stricter constraint mismatches, both of which are more prevalent in real-world scenarios. To address these challenges, we propose a tool-assisted agent framework for SQL inspection and refinement, equipping the LLM-based agent with two specialized tools: a retriever and a detector, designed to diagnose and correct SQL queries with database mismatches. These tools enhance the capability of LLMs to handle real-world queries more effectively. We also introduce Spider-Mismatch, a new dataset specifically constructed to reflect the condition mismatch problems encountered in real-world scenarios. Experimental results demonstrate that our method achieves the highest performance on the averaged results of the Spider and Spider-Realistic datasets in few-shot settings, and it significantly outperforms baseline methods on the more realistic dataset, Spider-Mismatch.
format Preprint
id arxiv_https___arxiv_org_abs_2408_16991
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Tool-Assisted Agent on SQL Inspection and Refinement in Real-World Scenarios
Wang, Zhongyuan
Zhang, Richong
Nie, Zhijie
Kim, Jaein
Computation and Language
Recent Text-to-SQL methods leverage large language models (LLMs) by incorporating feedback from the database management system. While these methods effectively address execution errors in SQL queries, they struggle with database mismatches -- errors that do not trigger execution exceptions. Database mismatches include issues such as condition mismatches and stricter constraint mismatches, both of which are more prevalent in real-world scenarios. To address these challenges, we propose a tool-assisted agent framework for SQL inspection and refinement, equipping the LLM-based agent with two specialized tools: a retriever and a detector, designed to diagnose and correct SQL queries with database mismatches. These tools enhance the capability of LLMs to handle real-world queries more effectively. We also introduce Spider-Mismatch, a new dataset specifically constructed to reflect the condition mismatch problems encountered in real-world scenarios. Experimental results demonstrate that our method achieves the highest performance on the averaged results of the Spider and Spider-Realistic datasets in few-shot settings, and it significantly outperforms baseline methods on the more realistic dataset, Spider-Mismatch.
title Tool-Assisted Agent on SQL Inspection and Refinement in Real-World Scenarios
topic Computation and Language
url https://arxiv.org/abs/2408.16991