arXiv:2510.14296cs.CLcs.IR2025-10Conference of the …被引 6

提出双向上下文检索方法,提升文本转SQL的数据库元素匹配准确率。

Rethinking Schema Linking: A Context-Aware Bidirectional Retrieval Approach for Text-to-SQL

  • 分两步检索:先选表再选列,或先选列再选表,结合关键词提取增强匹配。
  • 在BIRD和Spider数据集上,召回率显著提升,误报率降低,接近理想方案表现。
  • 无需查询修正即可逼近最优性能,适合追求高精度的工业级系统应用。

Schema linking——将自然语言问题与数据库模式元素对齐——是文本转SQL系统中关键但研究不足的环节。现有方法多聚焦于SQL生成,却忽视了相关模式元素的检索,常导致幻觉和执行失败。本文提出一种上下文感知的双向模式检索框架,将schema linking视为独立问题处理。该方法结合两种互补策略:先表后列检索,以及先列后表检索,并引入问题分解、关键词提取和关键短语提取等技术。在BIRD和Spider等挑战性基准上的综合评估表明,该方法显著提升了模式召回率,同时减少了误报。使用所检索模式生成的SQL,性能持续优于全模式基线,且接近理想情况下的最优表现,无需查询修正。值得注意的是,该方法使全模式与完美模式设置间的性能差距缩小了50%。研究结果凸显了schema linking作为提升文本转SQL准确性和效率的关键杠杆。

原文摘要 · Abstract (English)

Schema linking -- the process of aligning natural language questions with database schema elements -- is a critical yet underexplored component of Text-to-SQL systems. While recent methods have focused primarily on improving SQL generation, they often neglect the retrieval of relevant schema elements, which can lead to hallucinations and execution failures. In this work, we propose a context-aware bidirectional schema retrieval framework that treats schema linking as a standalone problem. Our approach combines two complementary strategies: table-first retrieval followed by column selection, and column-first retrieval followed by table selection. It is further augmented with techniques such as question decomposition, keyword extraction, and keyphrase extraction. Through comprehensive evaluations on challenging benchmarks such as BIRD and Spider, we demonstrate that our method significantly improves schema recall while reducing false positives. Moreover, SQL generation using our retrieved schema consistently outperforms full-schema baselines and closely approaches oracle performance, all without requiring query refinement. Notably, our method narrows the performance gap between full and perfect schema settings by 50\%. Our findings highlight schema linking as a powerful lever for enhancing Text-to-SQL accuracy and efficiency.

文本转SQL模式链接双向检索数据库问答

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。