Abstract
PALIMPZEST is a declarative optimization system for AI-powered analytics that treats Large Language Model (LLM) calls as relational operators. By abstracting the manual complexities of prompt engineering and model selection, it automatically generates execution plans that balance cost, runtime, and data quality. Our evaluation shows that PALIMPZEST achieves up to a 90x speedup over naive implementations while maintaining high accuracy.
Introduction
The current landscape of production-grade AI development is characterized by manual, imperative workflows. Engineers must navigate a complex space of model selection (e.g., GPT-4 vs. Mixtral), prompt iteration, and token management. This process is not only labor-intensive but also results in a significant "performance gap": while traditional data systems process gigabytes per second, high-quality LLMs often operate at speeds below 1 KB per second.
Furthermore, the optimal execution strategy is a moving target; as models evolve and pricing structures change, existing systems require manual retuning. PALIMPZEST addresses these challenges by introducing a declarative framework that brings the efficiency and "set-it-and-forget-it" nature of SQL to unstructured AI workloads.
System Architecture
The core of PALIMPZEST is its declarative approach, where developers define a schema and utilize a novel relational operator: convert.
The Optimization Pipeline
- The
convertOperator: This operator transforms data between schemas (e.g., from a rawFileto a structuredEmail). It can be implemented via LLM inference, code synthesis, or traditional User Defined Functions (UDFs). - Logical Optimization: Similar to traditional database optimizers, PALIMPZEST performs operation reordering. For instance, it may push "cheap" regex filters ahead of "expensive" semantic LLM filters to minimize the data volume processed by the model.
- Physical Optimization: The system selects the most efficient physical implementation for each step. This includes model selection (balancing speed and capability), code synthesis (generating Python functions to replace LLM calls for simple tasks), and token reduction.
- Cost Estimation and Selection: PALIMPZEST utilizes "sentinel plans"—small-scale sample runs—to estimate selectivity, cost, and quality. It then presents a Pareto frontier, allowing users to select plans based on specific trade-offs between budget and accuracy.
Evaluation and Applications
We evaluated PALIMPZEST across three diverse Semantic Analytics Applications (SAPPs):
- Legal Discovery: Identifying fraudulent activity within the Enron email corpus.
- Real Estate Search: A multimodal task requiring the analysis of text descriptions and images to find specific property types within defined constraints.
- Medical Schema Matching: Harmonizing disparate spreadsheet structures from multiple cancer research studies into a unified target schema.
Key Insights
- AI as a Relational Operator: By treating tasks like summarization as transformations, we can apply decades of database theory—such as predicate pushdown—to LLM-based systems.
- Quality as a First-Class Metric: Unlike traditional databases where queries are binary (correct/incorrect), AI workloads involve a quality trade-off. PALIMPZEST explicitly optimizes for data quality alongside time and cost.
- Code Synthesis: One of the most potent optimizations is using an LLM to "compile" a task into a specialized Python script, which is orders of magnitude faster than repeated LLM inference.
Results
Experimental results indicate that PALIMPZEST significantly outperforms naive manual implementations:
- Performance: In the Legal Discovery task, the system achieved a 90.3x speedup and a 9.1x reduction in cost compared to a single-threaded GPT-4 baseline.
- Quality: Even when optimized for speed, the system maintained an F1-score within 83.5% of the gold standard.
- Efficiency: In the Real Estate workload, the optimizer identified a plan that was 3.3x faster and 2.9x cheaper than the baseline while simultaneously improving data quality.
Limitations and Future Work
Current limitations include a dependency on a "champion model" (like GPT-4) for quality estimation during the sampling phase, which can be expensive. Future work will focus on automated dependency discovery, record-level caching for streaming datasets, and the implementation of complex AI-based operators like groupby and aggregation.
Summary updated