[论文解读] MCI-SQL: Text-to-SQL with Metadata-Complete Context and Intermediate Correction
MCI-SQL 引入用于列的元数据完整性上下文以及一个中间 SQL 校正机制,以提高 Text-to-SQL 的准确性,在 BIRD 基准上实现了最先进的执行准确性。
Text-to-SQL aims to translate natural language queries into SQL statements. Existing methods typically follow a pipeline of pre-processing, schema linking, candidate SQL generation, SQL alignment, and target SQL selection. However, these methods face significant challenges. First, they often struggle with column filtering during schema linking due to difficulties in comprehending raw metadata. Also, the candidate SQL generation process often suffers from reasoning errors, which limits accuracy improvements. To address these limitations, we propose a framework, called MCI-SQL, to efficiently and precisely generate SQL queries. Specifically, we assign metadata-complete contexts to each column, which significantly improves the accuracy of column filtering for schema linking. Also, for candidate SQL generation, we propose an intermediate correction mechanism that validates SQL queries and revises errors in a timely way. Moreover, we also propose effective optimizations in subsequent SQL alignment and selection phases, which further enhance the performance. Experiments on the widely-used BIRD benchmark show that MCI-SQL achieves execution accuracy of 74.45% on the development set and 76.41% on the test set, surpassing current published state-of-the-art results. In addition, we manually identify and correct 412 samples in the BIRD dataset, forming a new version named BIRD-clear, which is released together with our code on GitHub. We also evaluate our methods on BIRD-clear and find that MCI-SQL outperforms baselines by 8.47 percentage points in execution accuracy, further demonstrating the effectiveness and reliability of our framework.
研究动机与目标
- 通过丰富元数据实现更精确的列筛选来弥合 LLM 与数据库之间的差距。
- 在生成过程中集成一个中间纠错机制以验证并修正 SQL。
- 优化 SQL 对齐与候选生成以提升最终执行准确性。
- 在 BIRD 基准上展示优越性能并发布经修正的 BIRD-clear 数据集。
提出的方法
- 通过聚合列级、列间以及表级元数据,构建元数据完整的上下文并转换为自然语言描述。
- 进行 SQL 驱动的模式连接,利用初始草拟 SQL 选择性地识别相关列。
- 使用一个中间纠错机制,在执行反馈下验证并修订子查询。
- 应用自适应提示链,保持在 SQL 生成过程中的结构化推理。
- 实施规则引导的 SQL 对齐,确保各阶段(功能与输出对齐)的一致性。
- 生成多粒度的基于元数据的候选 SQL,并对执行结果进行多数投票以选择最终 SQL。

实验结果
研究问题
- RQ1元数据完整上下文是否能提升 Text2SQL 的列筛选和模式链接的准确性?
- RQ2在 SQL 生成过程中整合中间纠错是否能提高执行准确性并减少错误?
- RQ3多粒度元数据和对齐策略如何影响最终 SQL 的质量与效率?
- RQ4MCI-SQL 对像 BIRD 这样的真实世界挑战数据集的影响如何?
- RQ5校正数据集注释(BIRD-clear)是否会影响测量的性能?
主要发现
- MCI-SQL 在 BIRD 开发集上实现了 74.45% 的执行准确性。
- MCI-SQL 在 BIRD 测试集上实现了 76.41% 的执行准确性。
- MCI-SQL 超越了在 BIRD 上的最前沿方法,且在单 SQL 生成准确性方面有所提升。
- 发布了手工校正的 BIRD-clear 数据集版本,以更好地反映模型能力。
- 使用元数据完整上下文和中间纠错可在 SQL 生成过程中更高效地解决错误。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。