通过视图解耦表关系,提升大模型理解数据库能力
V-SQL: A View-based Two-stage Text-to-SQL Framework
- 将紧密耦合的表拆分为低耦合视图,帮助大模型更好理解数据库结构
- 在Bird数据集上表现媲美当前最先进方法
- 适合需要提升复杂数据库查询准确率的研究者
文本到SQL任务旨在无偏地将自然语言转换为结构化查询语言。近年来,基于大语言模型(LLMs)的方法受到广泛关注。主流文本到SQL框架的核心是模式链接,即把用户查询与数据库中的相关表和列对齐。以往方法侧重于模式链接,却忽略了增强LLM对数据库模式的理解。数据库中表之间的复杂耦合关系限制了LLM生成SQL的能力。为此,本文提出一种简单而有效的方法——基于视图的模式策略,通过将紧密耦合的表分解为低耦合视图,帮助LLM更好地理解数据库结构。我们进一步提出V-SQL,一个基于视图的两阶段文本到SQL框架。V-SQL利用该策略提升LLM对数据库模式的理解。在权威数据集Bird上的实验结果表明,V-SQL在性能上可与现有最先进方法相媲美。
原文摘要 · Abstract (English)
The text-to-SQL task aims to convert natural language into Structured Query Language (SQL) without bias. Recently, text-to-SQL methods based on large language models (LLMs) have garnered significant attention. The core of mainstream text-to-SQL frameworks is schema linking, which aligns user queries with relevant tables and columns in the database. Previous methods focused on schema linking while neglecting to enhance LLMs' understanding of database schema. The complex coupling relationships between tables in the database constrain the SQL generation capabilities of LLMs. To tackle this issue, this paper proposes a simple yet effective strategy called view-based schema. This strategy aids LLMs in understanding the database schema by decoupling tightly coupled tables into low-coupling views. We then introduce V-SQL, a view-based two-stage text-to-SQL framework. V-SQL involves the view-based schema strategy to enhance LLMs' understanding of database schema. Results on the authoritative datasets Bird indicate that V-SQL achieves competitive performance compared to existing state-of-the-art methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。