Skip to main content
QUICK REVIEW

[Paper Review] A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capability

Aiwei Liu, Xuming Hu|arXiv (Cornell University)|Mar 12, 2023
Topic ModelingComputer Science60 citations
TL;DR

The paper evaluates ChatGPT's zero-shot Text-to-SQL performance across 12 benchmarks, showing strong capabilities and robustness, with some gaps to SOTA models but notable wins in adversarial and multi-turn scenarios.

ABSTRACT

This paper presents the first comprehensive analysis of ChatGPT's Text-to-SQL ability. Given the recent emergence of large-scale conversational language model ChatGPT and its impressive capabilities in both conversational abilities and code generation, we sought to evaluate its Text-to-SQL performance. We conducted experiments on 12 benchmark datasets with different languages, settings, or scenarios, and the results demonstrate that ChatGPT has strong text-to-SQL abilities. Although there is still a gap from the current state-of-the-art (SOTA) model performance, considering that the experiment was conducted in a zero-shot scenario, ChatGPT's performance is still impressive. Notably, in the ADVETA (RPL) scenario, the zero-shot ChatGPT even outperforms the SOTA model that requires fine-tuning on the Spider dataset by 4.1\%, demonstrating its potential for use in practical applications. To support further research in related fields, we have made the data generated by ChatGPT publicly available at https://github.com/THU-BPM/chatgpt-sql.

Motivation & Objective

  • Assess ChatGPT's zero-shot Text-to-SQL abilities across diverse datasets and languages.
  • Compare zero-shot ChatGPT with fine-tuned SOTA models on multiple robustness scenarios.
  • Identify scenarios where ChatGPT excels, including adversarial and multi-turn settings.
  • Provide insights to guide future prompting and data-augmentation for Text-to-SQL tasks.

Proposed method

  • Adopt a fixed, OpenAI demo-style Text-to-SQL prompt (single-turn and multi-turn variants).
  • Evaluate ChatGPT on 12 public Text-to-SQL benchmarks spanning Spider family, real-world variations, adversarial, multilingual, and multi-turn datasets.
  • Use execution-based metrics (Valid SQL, Execution Accuracy, Test-Suite) rather than exact-match.
  • Compare against baselines built on constrained decoding and skeleton-guided decoding (PICARD, RASAT, RESDSQL) without using ChatGPT fine-tuning.
  • Analyze robustness across datasets with synonym substitutions, knowledge needs, adversarial column-name changes, and cross-lingual settings.
  • Provide case studies illustrating common error types and potential improvements.
Figure 1: Example prompts for Text-to-SQL using ChatGPT. The prompt at the top is for a single-turn scenario, while the one below is for multi-turn scenarios where only new questions are added in each interaction.
Figure 1: Example prompts for Text-to-SQL using ChatGPT. The prompt at the top is for a single-turn scenario, while the one below is for multi-turn scenarios where only new questions are added in each interaction.

Experimental results

Research questions

  • RQ1How well does zero-shot ChatGPT perform on standard Text-to-SQL benchmarks compared to fine-tuned SOTA models?
  • RQ2How robust is ChatGPT to robustness challenges such as synonym substitutions, additional knowledge, and adversarial column-name changes?
  • RQ3What is ChatGPT's performance in multi-turn and cross-lingual Text-to-SQL settings?
  • RQ4What kinds of errors does ChatGPT make, and what are practical directions to improve its zero-shot Text-to-SQL ability?

Key findings

  • ChatGPT achieves strong zero-shot Text-to-SQL performance, with only a 14% gap to the SOTA model trained on Spider data in execution accuracy.
  • Under certain robustness scenarios, ChatGPT narrows or even closes the gap with SOTA methods (e.g., ADVETA(RPL) where it surpasses SOTA by 4.1%).
  • ChatGPT shows strong robustness, with smaller gaps on robustness benchmarks than on the standard Spider dataset (e.g., 7.8% gap in some Spider robustness settings).
  • In multi-turn settings (SParC, CoSQL), ChatGPT remains competitive, with smaller gaps relative to single-turn results, indicating effective contextual modeling.
  • In Chinese Text-to-SQL datasets (CSpider, DuSQL), ChatGPT performs well but exhibits larger gaps when table/column names are also in Chinese, highlighting cross-lingual generalization challenges.
  • Exact-match-based evaluation is weak for SQL, so execution-based metrics are emphasized; ChatGPT’s outputs are often semantically equivalent despite differing syntax.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.