Skip to main content
QUICK REVIEW

[Paper Review] A Preview of XiYan-SQL: A Multi-Generator Ensemble Framework for Text-to-SQL

Yingqi Gao, Yifu Liu|arXiv (Cornell University)|Nov 13, 2024
Advanced Computational Techniques and ApplicationsComputer Science4 citations
TL;DR

XiYan-SQL is a multi-generator ensemble framework for text-to-SQL that combines supervised fine-tuning and in-context learning to generate diverse, high-quality SQL candidates. It introduces M-Schema for improved schema representation, employs a refiner and a fine-tuned selection model to correct errors and select optimal queries, achieving state-of-the-art execution accuracy of 89.65% on Spider and 72.23% on Bird.

ABSTRACT

To tackle the challenges of large language model performance in natural language to SQL tasks, we introduce XiYan-SQL, an innovative framework that employs a multi-generator ensemble strategy to improve candidate generation. We introduce M-Schema, a semi-structured schema representation method designed to enhance the understanding of database structures. To enhance the quality and diversity of generated candidate SQL queries, XiYan-SQL integrates the significant potential of in-context learning (ICL) with the precise control of supervised fine-tuning. On one hand, we propose a series of training strategies to fine-tune models to generate high-quality candidates with diverse preferences. On the other hand, we implement the ICL approach with an example selection method based on named entity recognition to prevent overemphasis on entities. The refiner optimizes each candidate by correcting logical or syntactical errors. To address the challenge of identifying the best candidate, we fine-tune a selection model to distinguish nuances of candidate SQL queries. The experimental results on multiple dialect datasets demonstrate the robustness of XiYan-SQL in addressing challenges across different scenarios. Overall, our proposed XiYan-SQL achieves the state-of-the-art execution accuracy of 75.63% on Bird benchmark, 89.65% on the Spider test set, 69.86% on SQL-Eval, 41.20% on NL2GQL. The proposed framework not only enhances the quality and diversity of SQL queries but also outperforms previous methods.

Motivation & Objective

  • To address the limitations of existing text-to-SQL models in generating diverse, high-quality SQL queries with strong generalization across different database schemas.
  • To improve schema understanding by introducing M-Schema, a semi-structured, hierarchical representation of database schemas that enhances LLM performance.
  • To reduce inference overhead and improve accuracy by combining supervised fine-tuning for controllability and in-context learning for diversity in candidate generation.
  • To enhance final output quality through a dedicated refiner and a fine-tuned selection model that outperforms self-consistency.
  • To validate the framework’s robustness across relational (e.g., Spider, Bird) and non-relational (e.g., NL2GQL) databases.

Proposed method

  • The framework uses a multi-generator ensemble strategy, combining two fine-tuned SQL generators with one in-context learning (ICL) generator using GPT-4o.
  • A two-stage multi-task training approach is applied to fine-tune generators for diverse stylistic preferences and enhanced semantic understanding.
  • M-Schema is introduced as a semi-structured schema representation that includes tables, columns, and data types in a hierarchical, compact format, improving model understanding.
  • ICL examples are selected based on question skeleton similarity and named entity masking to prevent overemphasis on entities and improve generalization.
  • Each candidate is refined by a refiner that corrects logical or syntactical errors using execution feedback or error signals.
  • A fine-tuned selection model is trained to distinguish subtle differences among candidates, replacing self-consistency to improve final accuracy.

Experimental results

Research questions

  • RQ1Can a multi-generator ensemble framework combining fine-tuning and in-context learning significantly improve the quality and diversity of generated SQL queries?
  • RQ2Does the proposed M-Schema representation outperform traditional DDL and MAC-SQL Schema in enhancing LLM understanding of complex database schemas?
  • RQ3Can a fine-tuned selection model outperform self-consistency in selecting the best SQL candidate from multiple outputs?
  • RQ4How does schema linking, which filters relevant schema elements, impact end-to-end execution accuracy?
  • RQ5To what extent does the ensemble framework generalize across diverse databases, including non-relational systems like nGQL?

Key findings

  • XiYan-SQL achieves a state-of-the-art execution accuracy of 89.65% on the Spider test set, outperforming prior methods.
  • On the challenging Bird development benchmark, it achieves 72.23% execution accuracy, demonstrating strong generalization to out-of-distribution samples.
  • The use of M-Schema improves average execution accuracy by 2.03% compared to DDL Schema across four LLMs, with GPT-4o and Claude 3.5 Sonnet showing the highest gains.
  • Schema linking increases precision from 10.14% to 74.74% and boosts execution accuracy from 57.95% to 60.10%, proving its effectiveness in filtering relevant schema information.
  • Ablation studies show that removing the fine-tuned generators, ICL generator, refiner, or selection model all lead to significant performance drops, with the selection model contributing a 2.74% decrease when removed.
  • Increasing the number of candidates from three to five improves accuracy to 72.23% on Bird, confirming the benefit of candidate diversity and ensemble selection.

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.