Relational databases excel at structured data analysis, but real-world queries increasingly require capabilities beyond standard SQL, such as semantically matching entities across inconsistent names, extracting information not explicitly stored in schemas, and analyzing unstructured text. While text-to-SQL systems enable natural language querying, they remain limited to relational operations and cannot leverage the semantic reasoning capabilities of modern large language models (LLMs). Conversely, recent semantic operator systems extend relational algebra with LLM-powered operations (e.g., semantic joins, mappings, aggregations), but require users to manually construct complex query pipelines. To address this gap, we present SEMA-SQL, a system that automatically answers natural language questions by generating efficient queries that combine relational operations with LLM semantic reasoning. We formalize Hybrid Relational Algebra (HRA), a declarative abstraction unifying traditional relational operators with LLM user-defined functions (UDFs). The system automates three critical aspects: (1) query generation via in-context learning that produces HRA queries with precise natural language specifications for LLM UDFs, (2) query optimization via cost-based transformations and UDF rewriting, and (3) efficient execution algorithms that reduce LLM invocations by an average of 93% in semantic joins through intelligent batching. Extensive experiments with known benchmarks, and extensions thereof, demonstrate the significant query capability improvements possible with our design.


翻译:关系数据库擅长结构化数据分析,但现实世界的查询日益需要超越标准SQL的能力,例如跨不一致名称的语义实体匹配、提取未显式存储在模式中的信息,以及分析非结构化文本。尽管文本到SQL系统支持自然语言查询,但它们仍局限于关系操作,无法利用现代大语言模型(LLMs)的语义推理能力。相反,近期语义算子系统通过基于LLM的操作(例如语义连接、映射、聚合)扩展了关系代数,但要求用户手动构建复杂的查询管线。为填补这一空白,我们提出了SEMA-SQL,一个通过生成结合关系操作与LLM语义推理的高效查询来自动解答自然语言问题的系统。我们形式化了混合关系代数(HRA),一种统一传统关系算子与LLM用户自定义函数(UDFs)的声明式抽象。该系统自动化三个关键方面:(1)基于上下文学习的查询生成,生成带有LLM UDFs精确自然语言规范的HRA查询;(2)基于代价的转换与UDF重写的查询优化;(3)通过智能批处理将语义连接中的LLM调用平均减少93%的高效执行算法。通过已知基准及其扩展的广泛实验,证明了我们的设计能够显著提升查询能力。

0
下载
关闭预览

相关内容

SQL 全名是结构化查询语言,是用于数据库中的标准数据查询语言,IBM 公司最早使用在其开发的数据库系统中。
面向统计学家的大型语言模型概述
专知会员服务
32+阅读 · 2025年3月16日
【关系抽取】从文本中进行关系抽取的几种不同的方法
深度学习自然语言处理
29+阅读 · 2020年3月30日
金融领域自然语言处理研究资源大列表
专知
13+阅读 · 2020年2月27日
一种关键字提取新方法
1号机器人网
21+阅读 · 2018年11月15日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
TextInfoExp:自然语言处理相关实验(基于sougou数据集)
全球人工智能
12+阅读 · 2017年11月12日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2014年12月31日
Arxiv
0+阅读 · 4月22日
VIP会员
最新内容
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
6+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
5+阅读 · 6月22日
美国从乌克兰无人机战争中学习经验
专知会员服务
7+阅读 · 6月21日
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
5+阅读 · 6月21日
相关VIP内容
面向统计学家的大型语言模型概述
专知会员服务
32+阅读 · 2025年3月16日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员