arXiv:2510.09014cs.CL2025-10Conference of the …被引 3

轻量级文本转SQL框架,用向量链接模式和执行引导自纠错。

LitE-SQL: A Lightweight and Efficient Text-to-SQL Framework with Vector-based Schema Linking and Execution-Guided Self-Correction

  • 用向量数据库实现高效模式链接,通过对比学习区分语义相似但无关的列。
  • 两阶段微调+执行引导强化,无需多候选采样即可自纠正,准确率达88.45%。
  • 参数量仅为大模型的1/30,适合隐私敏感与资源受限场景。

文本转SQL任务将自然语言问题转化为SQL查询,使非专家能直观操作数据库。尽管近期基于大语言模型(LLM)的方法表现优异,但其依赖专有模型,引发部署可行性和数据隐私担忧。本文提出LitE-SQL,一种轻量高效框架,包含两个组件:(i) 模式检索器,利用预计算的模式嵌入向量数据库进行高效模式链接,通过硬负样本监督对比学习,区分语义相似但功能无关的列;(ii) SQL生成器,经两阶段微调——监督微调后接执行引导强化学习,实现无需多候选采样的执行引导自纠错。在BIRD上达到72.10%执行准确率,在Spider 1.0上达88.45%,性能媲美甚至优于基于LLM的方法,同时参数量减少2至30倍。结果表明,高质量文本转SQL生成可在轻量模型上实现,为隐私敏感和资源受限场景提供实用方案。

原文摘要 · Abstract (English)

The Text-to-SQL task translates natural language questions into SQL queries, enabling intuitive database interaction for non-experts. While recent methods leveraging Large Language Models (LLMs) achieve strong performance, their reliance on proprietary models raise concerns about deployment feasibility and data privacy. In this work, we introduce LitE-SQL, a Lightweight and Efficient framework with two components: (i) a Schema Retriever that performs efficient schema linking using a vector database of pre-computed schema embeddings, optimized with a hard-negative supervised contrastive objective to distinguish semantically similar but functionally irrelevant columns, and (ii) a SQL Generator fine-tuned in two stages-supervised fine-tuning followed by execution-guided reinforcement-enabling execution-guided self-correction without multi-candidate sampling, which is commonly required by prior LLM-based approaches. On BIRD, LitE-SQL achieves 72.10% execution accuracy, and on Spider 1.0 it reaches 88.45%, demonstrating comparable or superior performance to LLM-based methods despite using 2x to 30x fewer parameters. Our findings demonstrate that high-quality Text-to-SQL generation is feasible with lightweight models, offering a practical solution for privacy-sensitive and resource-constrained settings.

文本转SQL轻量模型向量检索自纠错

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