SEMA: A High-performance System for LLM-based Semantic Query Processing
Kangkang Qi, Dongyang Xie, Wenbo Li, Hao Zhang, Yuanyuan Zhu, Jeffrey Xu Yu, Kangfei Zhao
摘要
The integration of Large Language Models (LLMs) into data analytics has unlocked powerful capabilities for reasoning over bulk structured and unstructured data. However, existing systems typically rely on either DataFrame primitives, which lack the efficient execution infrastructure of modern DBMSs, or SQL User-Defined Functions (UDFs), which isolate semantic logic from the query optimizer. The LLM-powered semantic operators also bring new challenges due to the high cost and non-deterministic nature of the LLM invocation, where conventional optimization rules and cost models are inapplicable for their optimization. To bridge these gaps, we present Sema, a high-performance semantic query engine built on DuckDB that treats LLM-powered semantic operators as first-class citizens. Sema introduces SemaSQL, a declarative dialect that allows users to seamlessly inject natural language expressions into standard SQL clauses, enabling end-to-end optimization and execution. At the logical level, the optimizer of Sema compresses natural language expressions and deduces relational constraints from semantic operators. At runtime, Sema employs Adaptive Query Execution (AQE) to dynamically reorder operators, fuse semantic operations, and apply prompt batching. This approach seeks a Pareto-optimal execution path that minimizes either token consumption or latency according to user preference, subject to accuracy constraints. We evaluate Sema on 26 semantic queries across classification, summarization, text extraction, and ranking tasks. Experimental results demonstrate that Sema achieves 2 – 10× speedup against three baseline systems while achieving competitive result quality.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
它引用的顶会 Paper17
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 被引用 22,562 次
- Efficient Memory Management for Large Language Model Serving with PagedAttentionWoosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng 等SOSP 2023 · 被引用 1,016 次
- BlazeIt: Optimizing Declarative Aggregation and Limit Queries for Neural Network-Based Video AnalyticsDaniel Kang, Peter Bailis, Matei ZahariaVLDB 2020 · 被引用 103 次
- DocETL: Agentic Query Rewriting and Evaluation for Complex Document ProcessingShreya Shankar, Tristan Chambers, Tarak Shah, Aditya G. Parameswaran 等VLDB 2025 · 被引用 62 次
- Jointly Optimizing Preprocessing and Inference for DNN-based Visual AnalyticsDaniel Kang, Ankit Mathur, Teja Veeramacheneni, Peter Bailis 等VLDB 2021 · 被引用 50 次
相关 Paper
- Semantic Operators and Their Optimization: Towards AI-Based Data Analytics with Accuracy GuaranteesLiana Patel, Siddharth Jha, Melissa Z. Pan, Harshit Gupta 等VLDB 2025 · 被引用 16 次
- Weaver: Interweaving SQL and LLM for Table ReasoningRohit Khoja, Devanshu Gupta, Yanjie Fu, Dan Roth 等EMNLP 2025 · 被引用 1 次
- Beyond Relational: Semantic-Aware Multi-Modal Analytics with LLM-Native Query OptimizationJunhao Zhu, Lu Chen, Xiangyu Ke, Ziquan Fang 等SIGMOD 2026 · 被引用 8 次
- Logical and Physical Optimizations for SQL Query Execution over Large Language ModelsDario Satriani, Enzo Veltri, Donatello Santoro, Sara Rosato 等SIGMOD 2025 · 被引用 7 次
- UQE: A Query Engine for Unstructured DatabasesHanjun Dai, Bethany Wang, Xingchen Wan, Bo Dai 等NeurIPS 2024 · 被引用 45 次
