arXiv:2502.12911cs.CLcs.DB2025-02被引 13

用背包优化提升文本转SQL的模式链接,减少遗漏和冗余。

Knapsack Optimization-based Schema Linking for LLM-based Text-to-SQL Generation

  • 引入受限遗漏指标,用背包算法优化表与列的链接顺序。
  • 在Spider和BIRD数据集上优于大模型,提升率超10%。
  • 适合想改进文本转SQL准确率的研究者和开发者。

从用户查询生成SQL是一个长期挑战,初始模式链接的准确性显著影响后续SQL生成效果。然而,现有模式链接模型仍存在遗漏相关模式元素或包含过多冗余元素的问题。其关键原因在于常用指标(召回率、精确率)无法反映元素遗漏情况,因而不能真实体现链接性能。为此,我们提出改进的模式链接指标,引入受限遗漏指示器。基于此,我们设计了可插拔的背包优化式模式链接方法KaSLA(Knapsack Optimization-based Schema Linking Approach),旨在防止遗漏相关元素的同时最小化冗余元素的引入。KaSLA采用分层链接策略:先确定最优表链接,再在选定表内链接列,以缩小候选空间。每次链接过程均使用背包优化方法,在容忍有限冗余的前提下,链接潜在相关元素。实验表明,KaSLA-1.6B在Spider和BIRD基准上优于包括DeepSeek-V3在内的大规模LLM,显著提升主流Text2SQL模型的SQL生成性能。代码已开源:https://github.com/DEEP-PolyU/KaSLA。

原文摘要 · Abstract (English)

Generating SQLs from user queries is a long-standing challenge, where the accuracy of initial schema linking significantly impacts subsequent SQL generation performance. However, current schema linking models still struggle with missing relevant schema elements or an excess of redundant ones. A crucial reason for this is that commonly used metrics, recall and precision, fail to capture relevant element missing and thus cannot reflect actual schema linking performance. Motivated by this, we propose enhanced schema linking metrics by introducing a \textbf{restricted missing indicator}. Accordingly, we introduce \textbf{\underline{K}n\underline{a}psack optimization-based \underline{S}chema \underline{L}inking \underline{A}pproach (KaSLA)}, a plug-in schema linking method designed to prevent the missing of relevant schema elements while minimizing the inclusion of redundant ones. KaSLA employs a hierarchical linking strategy that first identifies the optimal table linking and subsequently links columns within the selected table to reduce linking candidate space. In each linking process, it utilizes a knapsack optimization approach to link potentially relevant elements while accounting for a limited tolerance of potentially redundant ones. With this optimization, KaSLA-1.6B achieves superior schema linking results compared to large-scale LLMs, including DeepSeek-V3 with the state-of-the-art (SOTA) schema linking method. Extensive experiments on Spider and BIRD benchmarks verify that KaSLA can significantly improve the SQL generation performance of SOTA Text2SQL models by substituting their schema linking processes. The code is available at https://github.com/DEEP-PolyU/KaSLA.

文本转SQL模式链接背包优化大模型

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