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

TL;DR
Sema is a high-performance system that integrates LLM-based semantic query processing into a database engine, optimizing execution to reduce costs and latency while maintaining accuracy.
Contribution
It introduces Sema, a system that treats LLM semantic operators as first-class citizens and employs adaptive optimization techniques for efficient query execution.
Findings
Achieves 2-10x speedup over baseline systems.
Maintains competitive accuracy in semantic tasks.
Effectively balances token cost and latency.
Abstract
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 and burden users with implementation complexities. The LLM-powered semantic operators also bring new challenges due to the high cost and non-deterministic nature of 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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Database Systems and Queries · Natural Language Processing Techniques · Semantic Web and Ontologies
