NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CRED-SQL: Enhancing Real-world Large Scale Database Text-to-SQL Parsing through Cluster Retrieval and Execution Description

Shaoming Duan, Zirui Wang, Chuanyi Liu, Zhibin Zhu, Yuhao Zhang, Peiyi Han, Liang Yan, Zewu PengarXiv 2025

TL;DR

CRED-SQL is a novel framework designed to tackle Text-to-SQL parsing in massive, real-world databases by eliminating schema mismatch and semantic drift. By pairing a cluster-based schema retrieval method with a natural-language intermediate representation called Execution Description Language (EDL), it achieves new state-of-the-art performance on large-scale benchmarks, even allowing open-source models to outperform proprietary giants like GPT-4o.

What Problem Does This Paper Address?

While Text-to-SQL systems have made massive leaps thanks to Large Language Models (LLMs), they usually stumble when deployed in the wild. Standard academic benchmarks feature small databases with only a handful of tables. In contrast, real-world enterprise databases contain thousands of tables and columns, introducing two major challenges:

  1. Schema Mismatch: When a database contains hundreds of semantically similar attributes (e.g., columns named city, city_record, location, or geo.city), standard dense retrieval mechanisms get confused, frequently missing the actual target tables.
  2. Semantic Deviation: Mapping a complex natural language question directly into rigid SQL code creates a massive semantic gap. Existing intermediate representations (IRs) designed to bridge this gap are highly symbolic and syntactically restrictive, which stifles the natural language reasoning strengths of modern LLMs.

Methods

CRED-SQL splits the Text-to-SQL pipeline into two distinct, optimized phases:

1. Cluster-based Large-scale Schema Retrieval (CLSR)

Instead of flattening a table by concatenating all its column names into a single string, CLSR indexes table descriptions and column information independently. It vectorizes all columns and applies a semantic clustering algorithm (like K-Means).

Crucially, it introduces an adaptive weighting strategy: columns belonging to massive clusters (representing generic, high-frequency terms like id or name) are down-weighted because they lack discriminative power. Conversely, rare columns are up-weighted, allowing the retriever to easily pinpoint the exact tables needed for a specific query.

2. Execution Description Language (EDL)

Instead of jumping straight from a question to SQL, CRED-SQL introduces EDL—a human-readable, step-by-step natural language breakdown of the SQL execution plan. Structured as a logical tree, EDL uses 16 core operators (such as Scan Table, Filter, Join, and Group By) to describe data flow. The generation process is elegantly decoupled into two stages: Text-to-EDL and EDL-to-SQL.

CRED-SQL Framework Overview

Datasets

To simulate real-world scale, the authors evaluated their framework on two unified, large-scale benchmarks:

  • SpiderUnion: A combination of all 166 databases from the classic Spider benchmark into a single massive schema containing 876 tables and 4,502 columns.
  • BirdUnion: A combination of 11 large databases from the BIRD benchmark, resulting in a unified schema with 75 tables and 798 columns.

Additionally, the authors introduced Spider-EDL and Bird-EDL, which map natural language questions to gold-standard EDL descriptions. These were generated via GPT-4o and strictly verified by executing the resulting SQL to ensure exact semantic alignment.

Key Insights and Ideas

  • Rare attributes are the real anchors: Standard retrieval gets drowned out by common column names. By explicitly down-weighting high-frequency semantic clusters, the retrieval mechanism can focus on the unique, highly specific columns that actually pinpoint the correct table.
  • Natural language beats symbolic code for LLMs: Symbolic intermediate representations force LLMs to act like rigid compilers. EDL leverages the LLM's innate strength—generating fluent, structured natural language narratives—which drastically reduces semantic drift and logical errors (like choosing an incorrect UNION or EXCEPT clause).
  • Open-source models can beat closed-source giants: When fine-tuned on structured intermediate tasks like Text-to-EDL, open-source models like Qwen2.5-Coder-32B can actually outperform proprietary models like GPT-4o on complex reasoning tasks.

Key Results

  • End-to-End Accuracy: On the massive SpiderUnion dataset, CRED-SQL achieved a stellar 73.4% execution accuracy (EX) using Qwen2.5-Coder-32B, outperforming the previous state-of-the-art retrieval method (CRUSH) by a massive 21.9 percentage points.
  • On BirdUnion, combining CRED-SQL with a MAC-SQL backbone hit 62.91% EX, beating the CRUSH baseline by 12.45 percentage points.
  • Retrieval Efficiency: The CLSR retrieval method converges incredibly fast, achieving high table recall at just @3 candidates, meaning the target table is almost always in the top 3 choices.
  • EDL-to-SQL Reliability: Once the correct EDL is generated, translating it to SQL is nearly flawless, with all tested LLMs scoring above 98.4% accuracy on the Spider dev set.

Limitations and Future Work

  • Latency Trade-off: Decomposing the task into Text $\rightarrow$ EDL $\rightarrow$ SQL improves accuracy but triples the inference time compared to direct Text $\rightarrow$ SQL generation.
  • Un-tuned Schema Selection: The final schema selection step still relies on zero/few-shot LLM prompting without task-specific fine-tuning.
  • Data Curation Bottleneck: Creating high-quality EDL datasets currently relies heavily on LLM translation and manual verification. The authors suggest exploring automated data augmentation techniques in the future.

Summary updated

BibTeX
@misc{duan2025cred,
  author = {Shaoming Duan and Zirui Wang and Chuanyi Liu and Zhibin Zhu and Yuhao Zhang and Peiyi Han and Liang Yan and Zewu Peng},
  title = {{CRED-SQL: Enhancing Real-world Large Scale Database Text-to-SQL Parsing through Cluster Retrieval and Execution Description}},
  year = {2025},
  eprint = {2508.12769},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.12769},
}
Figure