Recent database systems have introduced semantic operators that leverage large language models (LLMs) to filter, join, and project over structured data using natural language predicates. In practice, these operators are combined with traditional relational operators, e.g., equi-joins, producing hybrid query plans whose execution cost depends on both expensive LLM calls and conventional database processing. A key optimization question is where to place each semantic operator relative to the relational operators in the plan: placing them earlier reduces the data that subsequent operators process, but requires more LLM calls; placing them later reduces LLM calls through deduplication, but forces relational operators to process larger intermediate data. Existing systems either ignore this placement question or apply simple heuristics without considering the full cost trade-off. We present Horrila, a plan-level optimizer for hybrid semantic-relational queries. Horrila reduces hybrid query planning to semantic filter placement via two equivalence-preserving rewrites. We prove that deferring all semantic filters to the latest possible position minimizes LLM invocations under function caching, but show that this can cause relational processing costs to dominate on complex multi-table queries. To balance LLM cost against relational cost, Horrila uses a dynamic-programming-based cost model that finds the placement minimizing their weighted sum. On 44 semantic SQL queries across five schemas and two benchmarks, Horrila achieves up to 1.5$\times$ speedup and 4.29$\times$ cost reduction while maintaining high output quality: an average F1 of 0.85 against the unoptimized baseline and 0.84 against human-annotated ground truth on SemBench. Overall, Horrila achieves a significant cost reduction while preserving the highest accuracy among six publicly available systems.


翻译:近期数据库系统引入了利用大语言模型通过自然语言谓词对结构化数据进行过滤、连接与投影的语义算子。实践中,这些算子需与传统关系算子(如等值连接)协同使用,形成混合查询计划——其执行代价既取决于昂贵的LLM调用开销,也受传统数据库处理成本影响。一个关键优化问题是如何在查询计划中合理布局语义算子与关系算子的相对位置:前置语义算子可减少后续算子处理的数据量,但将增加LLM调用次数;后置语义算子可通过去重减少LLM调用,但迫使关系算子处理更大的中间数据集。现有系统要么忽视此布局问题,要么采用未考虑全成本平衡的简单启发式方法。本文提出Horrila——面向混合语义-关系查询的计划级优化器。通过两种等价保留重写规则,Horrila将混合查询规划问题简化为语义过滤器布局问题。我们证明在函数缓存机制下,将所有语义过滤器推迟至最终位置可最小化LLM调用次数,但实验表明该策略会导致复杂多表查询中关系处理成本占比过高。为平衡LLM成本与关系成本,Horrila采用基于动态规划的代价模型,寻找使加权和最小的算子布局方案。在涵盖五个模式与两个基准的44条语义SQL查询中,Horrila实现高达1.5倍加速与4.29倍成本降低,同时保持优异输出质量:在SemBench上平均F1值达到0.85(对比未优化基线)与0.84(对比人工标注基准)。整体而言,Horrila在六个公开系统中以最高精度实现了显著的成本降低。

0
下载
关闭预览

相关内容

大语言模型时代的城市计算
专知会员服务
21+阅读 · 2025年4月4日
TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
基于大语言模型的复杂任务自主规划处理框架
专知会员服务
102+阅读 · 2024年4月12日
Query 理解和语义召回在知乎搜索中的应用
DataFunTalk
25+阅读 · 2020年1月2日
使用 Canal 实现数据异构
性能与架构
20+阅读 · 2019年3月4日
推荐系统算法合集,满满都是干货(建议收藏)
七月在线实验室
17+阅读 · 2018年7月23日
关系推理:基于表示学习和语义要素
计算机研究与发展
19+阅读 · 2017年8月22日
语料库构建——自然语言理解的基础
计算机研究与发展
11+阅读 · 2017年8月21日
GAFT:一个使用 Python 实现的遗传算法框架
Python开发者
10+阅读 · 2017年8月1日
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
VIP会员
最新内容
以色列-美国-伊朗战争中的无人机:关键要点
专知会员服务
1+阅读 · 48分钟前
《Palantir任务保障性软件安全标准(MA-S2)》
专知会员服务
4+阅读 · 今天13:49
基于声学的无人机检测技术综述
专知会员服务
3+阅读 · 今天13:37
《当代混合战争分析框架:俄乌战争经验教训》
专知会员服务
4+阅读 · 今天13:11
战略前沿人工智能的再思考(中文)
专知会员服务
7+阅读 · 5月29日
《量化地基防空系统间接效应的博弈论方法》
专知会员服务
5+阅读 · 5月29日
“史诗怒火行动”中美军损失的作战飞机
专知会员服务
6+阅读 · 5月29日
ICML 2026 | 理解上下文持续学习中的泛化与遗忘
专知会员服务
5+阅读 · 5月28日
相关资讯
Query 理解和语义召回在知乎搜索中的应用
DataFunTalk
25+阅读 · 2020年1月2日
使用 Canal 实现数据异构
性能与架构
20+阅读 · 2019年3月4日
推荐系统算法合集,满满都是干货(建议收藏)
七月在线实验室
17+阅读 · 2018年7月23日
关系推理:基于表示学习和语义要素
计算机研究与发展
19+阅读 · 2017年8月22日
语料库构建——自然语言理解的基础
计算机研究与发展
11+阅读 · 2017年8月21日
GAFT:一个使用 Python 实现的遗传算法框架
Python开发者
10+阅读 · 2017年8月1日
相关基金
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员