通过多粒度逐步学习,提升文本转SQL的准确率。
PSM-SQL: Progressive Schema Learning with Multi-granularity Semantics for Text-to-SQL
- 分列、表、库三层建模数据库语义,逐层减少冗余信息。
- 在多个数据集上比现有方法高1-3个百分点,最高达87.2%准确率。
- 适合需要精准数据库查询的自然语言交互场景。
由于数据库模式数量庞大且存在冗余,文本转SQL任务面临语义学习干扰和自然语言与SQL间领域差异的挑战。现有方法仅在表级进行一次模式链接,忽略了模式的多粒度语义与可链式循环特性。本文提出渐进式多粒度语义模式链接框架(PSM-SQL),通过多粒度模式链接(MSL)模块,在列、表、数据库三个层级学习模式语义。具体地,列级使用三元组损失学习嵌入表示,库级微调大模型实现模式推理;表级结合分类器与相似度得分建模模式间交互关系。特别地,采用链式循环策略逐步削减冗余模式,降低模式链接难度。在Text-to-SQL数据集上的实验表明,该方法相较现有方法性能提升1-3个百分点,最高达到87.2%的准确率。
原文摘要 · Abstract (English)
It is challenging to convert natural language (NL) questions into executable structured query language (SQL) queries for text-to-SQL tasks due to the vast number of database schemas with redundancy, which interferes with semantic learning, and the domain shift between NL and SQL. Existing works for schema linking focus on the table level and perform it once, ignoring the multi-granularity semantics and chainable cyclicity of schemas. In this paper, we propose a progressive schema linking with multi-granularity semantics (PSM-SQL) framework to reduce the redundant database schemas for text-to-SQL. Using the multi-granularity schema linking (MSL) module, PSM-SQL learns the schema semantics at the column, table, and database levels. More specifically, a triplet loss is used at the column level to learn embeddings, while fine-tuning LLMs is employed at the database level for schema reasoning. MSL employs classifier and similarity scores to model schema interactions for schema linking at the table level. In particular, PSM-SQL adopts a chain loop strategy to reduce the task difficulty of schema linking by continuously reducing the number of redundant schemas. Experiments conducted on text-to-SQL datasets show that the proposed PSM-SQL is 1-3 percentage points higher than the existing methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。