TL;DR
Imagine asking a world-class novelist to spend three hours reading two documents just to answer "yes" or "no" to a simple database filter—thousands of times in a row. That is essentially what modern semantic database systems do when they use frontier Large Language Models (LLMs) for SQL queries. UniBays fixes this by flipping the script: it aggressively prunes impossible candidates using classic database tricks and reusable record-level indexes before any model runs, and then uses fast, non-generative "decision models" paired with a global optimizer that only calls in an expensive frontier LLM when the final query quality is genuinely at risk.
What Problem Does This Paper Address?
Semantic database systems (like Palimpzest, LOTUS, and SEMA) extend SQL with AI-powered operators—letting you filter, join, or rank unstructured text alongside structured tables. The catch is a massive time-scale gap: traditional relational operators run in nanoseconds to microseconds, whereas frontier LLMs take seconds per call and cost real money.
The authors identify two root causes behind this scalability wall:
- An architectural mismatch: Most SQL semantic predicates only need a discrete, typed answer (a Boolean, an Enum, or a Score). Using a giant, autoregressive generative LLM for this is overkill—it's slow, expensive, and often poorly calibrated.
- Isolated optimization: Existing engines optimize semantic operators one by one. They miss obvious opportunities to prune structurally impossible tuples across a multi-table query, fail to reuse semantic evidence across queries, and lack any global control over which individual judgments actually matter for the final answer.
Methods
UniBays replaces heavy generative models with compact, single-pass, non-generative decision models (such as Jev and Liquid AI's d1.2-ultra) and wraps them in a three-stage "prune first, optimize globally" pipeline:
- Relational-Aware Candidate Reduction: Before touching any AI model, UniBays strips out the semantic edges of the query graph to isolate the "relational skeleton." It then runs exact, Yannakakis-style semijoin reductions to a fixpoint. If a report doesn't have a matching return in the requested region, it's tossed out immediately—no model inference required.
- Reusable Proposition-Based Semantic Index: Building on Semantic Bloom Filters, UniBays decouples record-specific requirements from shared, record-level propositions (e.g., "the report describes humid storage"). A fast decision model evaluates these simpler propositions once per record and caches the scores. Candidate pairs are screened against these cached scores, and any pair that fails a necessary condition is pruned. Best of all, these cached proposition scores are reused across different queries and evolving data versions.
- Quality-Aware Global Optimization: For the surviving candidates, the decision model generates provisional judgments. UniBays then builds a Boolean query lineage—a map showing exactly which semantic decisions each candidate output tuple depends on. A global controller calibrates the decision model's raw scores using a small random sample of LLM judgments (modeled via Beta posteriors over score bins) and runs in parallel rounds. It selectively escalates only the most uncertain, high-impact decisions to a frontier LLM (
gpt-6-luna) until the query hits user-defined precision and recall targets (e.g., 0.90) at minimal cost and latency.
Datasets
- SemBench: An existing benchmark of 21 text-and-structured-data queries (spanning Movie, E-Commerce, MMQA, and Cars), plus two new E-Commerce queries (EC3, EC4) designed to test multiple semantic filters.
- Shelob (New Benchmark): Built on top of TPC-DS, Shelob introduces two realistic, large-scale workloads—Shelob-Maintenance (up to 6,264 documents and 1.02 billion candidate tuples) and Shelob-Ops (21,993 documents across 22 tables). Unlike SemBench's small-scale, single-predicate NLP tasks, Shelob simulates real-world business processes with multi-way joins and complex contextual reasoning.
Key Insights and Ideas
- Fast models still need pruning: Even though decision models cut per-call latency by ~100× compared to frontier LLMs (down to ~100 ms), they are still roughly three orders of magnitude slower than relational operators. Eliminating candidates before inference is non-negotiable.
- Raw decision scores are wildly miscalibrated: On Shelob-Ops, candidate pairs scoring between
0.5and0.6under the Jev decision model only received a "yes" from the reasoning LLM 3% of the time. Relying on fixed thresholds without online calibration destroys accuracy. - Lineage beats isolated cascades: Predicate-level accuracy doesn't map cleanly to query-level quality. By tracking Boolean lineage, UniBays avoids wasting LLM calls on decisions that are rendered irrelevant by other parts of the query.
Key Results
- SemBench: Running in decision-only mode (
UniBays-Flashwith Jev), UniBays achieved the lowest latency on all 21 queries—finishing in 40.99 s total (56.8×–82.4× faster than SEMA, LOTUS, and Palimpzest) at $1.20 total cost (3.2×–7.9× cheaper), while achieving the highest mean quality (0.8580). - Shelob: Where existing baselines hit the 2,000-second timeout on most multi-stage and S-tier queries, UniBays completed all 27 query instances in 5.8–209.4 s with F1 scores between 0.77 and 1.00 (mean F1 of 0.9201).
- Component Impact: Semantic indexing pruned 68.8%–86.4% of candidate pairs at under 2.9% match loss, and global optimization cut total query time by 31.9% compared to operator-level cascades.
Limitations and Future Work
- Staged vs. Interleaved Reduction: Currently, UniBays runs relational reduction strictly before semantic inference. Interleaving relational updates across semantic edges as new judgments arrive is left for future work.
- High-Escalation Predicates: On a few particularly nuanced predicates (like Maintenance XS Q4 and Q7), the LLM still had to evaluate 56%–60% of the pairs, meaning the decision model's overhead slightly exceeded the saved LLM cost. The authors plan to use cost estimates to bypass the decision model on such predicates in the future.
Summary updated