Battle of the Large Language Models: Dolly vs LLaMA vs Vicuna vs Guanaco vs Bard vs ChatGPT - A Text-to-SQL Parsing Comparison

Shuo Sun, Yuchen Zhang, Jiahuan Yan, Yuze Gao, Donovan Ong, Bin Chen, Jian Su · DOI

Introduction

Text-to-SQL parsing represents a critical frontier in democratizing data access, promising a future where non-technical users can query complex databases using natural language. However, the transition from conversational English to structured SQL is fraught with challenges, requiring precise understanding of database schemas, join logic, and rigid syntax.

Recently, the AI community has seen a surge of open-source models—such as Vicuna and Guanaco—claiming to reach parity with proprietary giants like ChatGPT. This study systematically evaluates these claims within the specialized domain of Text-to-SQL, testing whether these "GPT-killers" can handle the rigors of structured reasoning or if their capabilities are primarily limited to surface-level dialogue.

Methodology

The Contestants

The researchers conducted a comprehensive benchmark involving a diverse array of models:

  • Open-Source: Dolly (v2-3B to 12B), LLaMA (7B to 65B), Vicuna (7B, 13B), and Guanaco (33B).
  • Closed-Source: GPT-3.5 and Bard (including both LaMDA and PaLM 2 iterations).

Prompting Strategies

To determine how model performance varies with instruction style, five distinct prompting strategies were employed:

  1. Informal Schema (IS): Describing database tables in natural language.
  2. API Docs (AD): Utilizing a formal SQL translation prompt.
  3. Select 3 (S3): Providing the schema alongside three example rows of data to provide concrete context.
  4. 1-Shot (1SL) & 5-Shot (5SL): Including one or five "golden" example pairs of natural language questions and their corresponding SQL queries.

Evaluation Framework

The primary metric used was Execution Accuracy (EX). Unlike simple string matching (Exact Match), EX runs the generated SQL against a live database to verify if the output returns the correct data. The evaluation utilized nine benchmark datasets, including the industry-standard Spider and eight classical benchmarks (e.g., GeoQuery, ATIS, and Advising). Crucially, the researchers used "query-based" splits to prevent models from succeeding through simple memorization of SQL structures seen during training.

Key Insights and Results

The Performance Gap

The results reveal a significant performance chasm between open-source and closed-source models. On the Spider dataset, GPT-3.5 achieved a leading 70.9% execution accuracy, followed by Bard (PaLM 2) at 60.2%. In contrast, the highest-performing open-source model, LLaMA-65B, reached only 29.5% accuracy using the S3 strategy. Vicuna-13B, despite its reputation for general chat prowess, managed only ~35% accuracy.

Sensitivity to Prompting Style

LLMs demonstrated extreme sensitivity to how information is presented. While GPT-3.5 excelled with informal schema descriptions, LLaMA showed a marked preference for the S3 strategy (providing example rows). Furthermore, LLaMA exhibited a unique "alias mimicry" behavior; when few-shot examples utilized specific canonical styles (like table_alias0), the model's performance improved as it adapted to the provided formatting.

Validity vs. Semantic Accuracy

A notable finding was that most models are proficient at generating syntactically valid SQL—code that executes without error. However, they frequently fail at semantic accuracy, meaning the code runs but fails to actually answer the user's specific question. This suggests that the bottleneck is not language syntax, but the underlying reasoning required to map intent to logic.

Complex Reasoning Failures

On more difficult "classical" datasets such as Advising, open-source models struggled significantly, with many bottoming out near 0% accuracy. This highlights a massive failure in handling complex joins and multi-layered logic compared to GPT-3.5.

Limitations and Challenges

Several factors currently hinder open-source performance in this domain:

  • Context Window Constraints: Many open-source models are limited to a 2048-token window. When a prompt includes a large database schema and five few-shot examples, it often exceeds this limit, resulting in truncated prompts and failed generations.
  • Output Noise: General-purpose LLMs often include conversational filler or explanations. Extracting raw SQL from this "chatter" requires significant post-processing.
  • Few-Shot Diminishing Returns: Surprisingly, moving from 1-shot to 5-shot prompting did not consistently improve results. In some cases, performance stagnated or declined, suggesting that poorly selected examples can confuse the model.

Conclusion

While open-source models are making rapid strides in general conversation, they are not yet viable replacements for closed-source models in production-grade Text-to-SQL applications. The study suggests that future improvements should focus on dynamic example selection and the use of parameter-efficient fine-tuning (such as LoRA) to specialize these models for the nuances of database querying. For now, GPT-3.5 and Bard remain the standard-bearers for reliable natural language data interaction.

Summary updated

BibTeX
@inproceedings{sun2023battle,
  author = {Shuo Sun and Yuchen Zhang and Jiahuan Yan and Yuze Gao and Donovan Ong and Bin Chen and Jian Su},
  title = {{Battle of the Large Language Models: Dolly vs LLaMA vs Vicuna vs Guanaco vs Bard vs ChatGPT - A Text-to-SQL Parsing Comparison}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.750},
}
Figure