arXiv:2503.18596cs.CL2025-03EMNLP被引 36

解决多数据库文本转SQL中的模式链接难题,提升准确率与效率。

LinkAlign: Scalable Schema Linking for Real-World Large-Scale Multi-Database Text-to-SQL

  • 分三步优化:语义检索+去噪+模式提取,支持灵活执行
  • 在Spider 2.0-Lite上达33.09%准确率,为开源模型新纪录
  • 适合需要处理海量数据库的智能查询系统开发者

将现有文本转SQL模型应用于真实世界大规模多数据库环境时,模式链接是主要瓶颈。通过错误分析,我们识别出两大挑战:(1) 数据库检索——从大规模模式池中精准选择目标数据库并过滤无关项;(2) 模式项定位——在复杂冗余的模式中精确识别用于生成SQL的相关表和列。针对此,我们提出LinkAlign框架,专为含数千字段的大规模数据库设计。该框架包含三个关键步骤:多轮语义增强检索与无关信息隔离(应对挑战1),以及模式提取增强(应对挑战2)。各阶段均支持Agent与Pipeline两种执行模式,通过模块化设计平衡效率与性能。为实现更真实的评估,我们构建了AmbiDB这一合成数据集,模拟真实场景下的模糊性。在多个主流文本转SQL基准上的实验表明,LinkAlign在所有模式链接指标上均显著优于现有基线。尤其在仅使用开源大模型的前提下,其在Spider 2.0-Lite基准上达到33.09%的新纪录,位列提交时排行榜第一。代码已公开于https://github.com/Satissss/LinkAlign。

原文摘要 · Abstract (English)

Schema linking is a critical bottleneck in applying existing Text-to-SQL models to real-world, large-scale, multi-database environments. Through error analysis, we identify two major challenges in schema linking: (1) Database Retrieval: accurately selecting the target database from a large schema pool, while effectively filtering out irrelevant ones; and (2) Schema Item Grounding: precisely identifying the relevant tables and columns within complex and often redundant schemas for SQL generation. Based on these, we introduce LinkAlign, a novel framework tailored for large-scale databases with thousands of fields. LinkAlign comprises three key steps: multi-round semantic enhanced retrieval and irrelevant information isolation for Challenge 1, and schema extraction enhancement for Challenge 2. Each stage supports both Agent and Pipeline execution modes, enabling balancing efficiency and performance via modular design. To enable more realistic evaluation, we construct AmbiDB, a synthetic dataset designed to reflect the ambiguity of real-world schema linking. Experiments on widely-used Text-to-SQL benchmarks demonstrate that LinkAlign consistently outperforms existing baselines on all schema linking metrics. Notably, it improves the overall Text-to-SQL pipeline and achieves a new state-of-the-art score of 33.09% on the Spider 2.0-Lite benchmark using only open-source LLMs, ranking first on the leaderboard at the time of submission. The codes are available at https://github.com/Satissss/LinkAlign

文本转SQL模式链接大模型应用数据库智能

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