SAGE: A Unified Algebra and Self-Adaptive Execution for AI Functions in SQL
cs.AI
Submitted: 2026-08-21
Updated: 2026-08-21
Comments: arXiv admin comment: This version has been removed by arXiv administrators as the submitter did not have the rights to agree to the license at the time of submission
Code: https://github.com/BerriAI/litel
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: SQL systems increasingly expose AI functions for tasks such as classification, extraction, filtering, ranking, retrieval, joining, and summarization.
Terminology
Abstract
SQL systems increasingly expose AI functions for tasks such as classification, extraction, filtering, ranking, retrieval, joining, and summarization. Despite their diverse APIs, these functions play only three relational roles: transforming individual rows, aggregating groups, or generating relationships between row pairs. We present SAGE (Self-Adaptive Generative Execution), a unified logical and physical framework that captures these roles with three typed primitives, AI SCALAR, AI AGG, and AI JOIN, and composes them naturally with standard relational operators. All primitives share a confidence-gated execution interface while supporting physical strategies tailored to their relational shape. The main challenge is AI JOIN, where SAGE analyzes the predicate, decomposes compound conditions when possible, and uses a recipe card together with a small label-free probe to select among complete execution strategies. Across a broad audit of public AI operators and evaluations spanning scalar, aggregate, and join workloads, this formulation covers common AI functionality while consistently improving execution quality and efficiency. SAGE achieves the strongest overall SemBench performance and, on a representative factorable join, reduces pairwise model calls by more than two orders of magnitude, yielding a 358-fold measured cost reduction.
Sources
- Semantic Operators: A Declarative Model for Rich, AI-based Data Processing
- A Declarative System for Optimizing AI Workloads
- DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing
- Beyond Quacking: Deep Integration of Language Models and RAG into DuckDB
- FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance
- RouteLLM: Learning to Route LLMs with Preference Data
- SemBench: A Benchmark for Semantic Query Processing Engines
- GLiClass: Generalist Lightweight Model for Sequence Classification Tasks
- X-Stance: A Multilingual Multi-Target Dataset for Stance Detection
- Towards Accurate and Efficient Document Analytics with Large Language Models
- gpt-oss-120b & gpt-oss-20b Model Card
- Sema: A High-performance System for LLM-based Semantic Query Processing
- Featurized-Decomposition Join: Low-Cost Semantic Joins with Guarantees
Related papers
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- Agents' Last Exam
- The Clinician's Veto: Navigating Trust, Liability, and Uncertainty in Autonomous AI Prescribing
- MindHelper: Closed-Loop Embodied Mental-State Reasoning for Precision Intervention
- Incumbent Advantage: Brand Bias and Cognitive Manipulation Dynamics in LLM Recommendation Systems