SAGE: A Unified Algebra and Self-Adaptive Execution for AI Functions in SQL
Summary
SAGE introduces a unified logical and physical framework for AI functions in SQL using three primitives (AI_SCALAR, AI_AGG, AI_JOIN) to optimize execution, significantly reducing model calls and costs.
View Cached Full Text
Cached at: 08/24/26, 04:17 AM
# 1 Introduction
Source: [https://arxiv.org/html/2608.20630](https://arxiv.org/html/2608.20630)
1Preprint\. Not peer reviewed\. Content and conclusions are those of the authors\.
![[Uncaptioned image]](https://arxiv.org/html/2608.20630v1/ibm_logo.png)![[Uncaptioned image]](https://arxiv.org/html/2608.20630v1/nd_logo.png)SAGE: A Unified Algebra and Self\-Adaptive Execution for AI Functions in SQLXiangqi Wang1,2Nhan H\. Pham2Oktie Hassanzadeh2 Dharmashankar Subramanian2Xiangliang Zhang11University of Notre Dame\|2IBM ResearchSQL 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 presentSAGE\(Self\-Adaptive Generative Execution\), a unified logical and physical framework that captures these roles with three typed primitives,AI\_SCALAR,AI\_AGG, andAI\_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 isAI\_JOIN, whereSAGEanalyzes 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\.SAGEachieves the strongest overall SemBench performance and, on a representative factorable join, reduces pairwise model calls by more than two orders of magnitude, yielding a358×358\\timesmeasured cost reduction\.Correspondencexwang76@nd\.eduDateAugust 2026
Figure 1:System overview\. Surface AI functions compile to three logical primitives\. Each primitive has a shared adaptive skeleton and a shape\-specific physical front end; a per\-query probe chooses the final execution configuration\.AI functions bring unstructured data into SQL\. A user can classify a review, extract a field from a report, retrieve passages relevant to a question, match records under a natural\-language condition, or summarize all documents in a group without leaving a relational query[29](https://arxiv.org/html/2608.20630#bib.bib1);[23](https://arxiv.org/html/2608.20630#bib.bib4);[33](https://arxiv.org/html/2608.20630#bib.bib6)\. Research systems and production warehouses consequently expose a growing vocabulary ofAI\_CLASSIFY,AI\_EXTRACT,AI\_FILTER,AI\_SIMILARITY,AI\_JOIN, andAI\_AGG\-like functions[10](https://arxiv.org/html/2608.20630#bib.bib13);[34](https://arxiv.org/html/2608.20630#bib.bib14);[14](https://arxiv.org/html/2608.20630#bib.bib15)\.
This operator growth hides a simpler execution structure\. Rather than organizing AI functions by user\-facing names, the query plan can reason about where a model invocation appears in relational dataflow\. Each invocation plays one of three roles:AI\_SCALARmaps a row to a value,AI\_AGGreduces a group to a value, andAI\_JOINdecides which row pairs survive\. Classification, extraction, rewriting, and filtering are scalar operations; summarization is aggregation; retrieval, similarity search, entity resolution, and natural\-language joins are pairwise predicates followed by standard relational operators\. More complex tasks are compositions of these primitives\.
These roles also induce different physical optimization problems\. Scalars mainly require per\-row model routing, aggregates additionally require compaction and chunking, and joins must control a potentially quadratic pair space and determine when predicates can be factorized\. Across all three, model cost dominates execution: using only a strong model is expensive, while using only a cheap model sacrifices quality[6](https://arxiv.org/html/2608.20630#bib.bib17)\. Fixed cascades are also insufficient because difficulty varies across inputs, model quality is not always monotone with size[28](https://arxiv.org/html/2608.20630#bib.bib18), and each primitive exposes different optimization choices\. Thus, efficient execution requires a shared adaptive interface together with role\-specific physical strategies\.
We therefore separate the problem into a logical layer and a physical layer\. The logical layer gives every query\-time AI function a typed formulation and compiles surface syntax to a plan over three primitives plus ordinary SQL\. The physical layer preserves those semantics while adapting effort\. All primitives share a small\-to\-large cascade gated by answer\-bearing token confidence[13](https://arxiv.org/html/2608.20630#bib.bib19)\. They differ only at their front ends:AI\_SCALARexecutes rows directly,AI\_AGGcan compact redundant group members, andAI\_JOINuses a recipe\-card probe to select membership, relational, or reasoning execution\. A second, per\-query probe evaluates complete configurations under the current predicate and freezes the best one satisfying cost and latency budgets\. Figure[1](https://arxiv.org/html/2608.20630#S1.F1)summarizes the design\.
This organization changes the role of semantic join\. The original join\-only view made membership, relational, and reasoning predicates the top\-level taxonomy\. In the unified formulation they are physical subclasses ofAI\_JOINonly\. The top level is instead the three\-way division by relational cardinality: row preserving, group reducing, and pair generating\. The same quality–cost objective, confidence signal, configuration interface, and test\-time adaptation loop can therefore serve the full AI\-function surface\.
We realize this design inSAGE\(Self\-Adaptive Generative Execution\) and separate two kinds of evidence\. For logical breadth, an audit of 78 operators from eleven public systems maps 63 model\-invoking operators directly to the three primitives; the remainder are multimodal conversions or non\-semantic indexing and control constructs\. Separately, 37 semantic\-query intents require at most three primitives, and 94\.6% require at most two\. The unified evaluation reports SemBench Q1–Q10[21](https://arxiv.org/html/2608.20630#bib.bib22)and Multi\-XScience[26](https://arxiv.org/html/2608.20630#bib.bib25), thereby covering scalar, aggregate, join, and ranking workloads in one table\. For overlapping joins we use the current AI\-Join runs on SemBench Q5–Q7, FewRel[16](https://arxiv.org/html/2608.20630#bib.bib23), and BRIGHT[36](https://arxiv.org/html/2608.20630#bib.bib24); three compound joins are reported separately\.SAGEobtains the best SemBench average and the best or tied\-best quality on every updated join except Q5, while the fixed no\-racing variant gives the cheapest point on all three compound workloads\. The join specialization reduces one exact all\-pairs execution from16,25616\{,\}256generative calls to 128, a measured358×358\\timescost reduction\.
Our contributions are:
1\. A unified formulation of AI functions\.We define three typed logical primitives by their relational cardinality and dependency signatures, give compilation rules for common AI\-function APIs, and state the boundary of the formulation\. This separates user\-facing function names from the minimal model\-invoking core\.
2\. Primitive\-aware adaptive execution\.We factor physical execution into a shared confidence\-gated cascade and primitive\-specific front ends\. In particular, semantic\-join routing and predicate decomposition become one specialization of the pair primitive, alongside scalar and aggregate plans\.
3\. Per\-query configuration selection\.We formulate execution as constrained configuration selection over an entire AI\-function plan\. A label\-free probe races operator\-specific candidates and freezes a quality\-maximizing plan under cost and latency budgets\.
4\. Cross\-primitive evaluation with a pair\-primitive deep dive\.We evaluate scalar, aggregate, join, and ranking workloads together on SemBench Q1–Q10 and Multi\-XScience\. For the overlapping join columns and three compound predicates, we use the latest AI\-Join runs; these runs also support the mechanism ablations, recipe and proxy audits, slate analysis, convergence, scaling, and cross\-domain evaluation of the pair primitive\.
## 2 A Unified Algebra for AI Functions
We first define the logical layer independently of any model, prompt, or execution policy\. Let a relationRRcontain tuplesrr, letIIbe a natural\-language instruction, and letTTbe an SQL or structured output type\. An AI function is a typed, model\-evaluated expression whose relational role is determined by its input binding and cardinality effect\. This produces three primitive signatures\.
### 2\.1 Three Logical Primitives
#### AI\_SCALAR: row→\\rightarrowvalue\.
The scalar primitive evaluates each already\-bound tuple independently:
𝖲I,T:r∈R⟼v∈T\.\\mathsf\{S\}\_\{I,T\}:r\\in R\\longmapsto v\\in T\.\(1\)Applied to a relation, it preserves cardinality,N→NN\\\!\\rightarrow\\\!N, by appendingvvas a virtual column\. Classification, extraction, rewriting, scoring, question answering over row\-local context, and Boolean filtering all instantiate Equation[1](https://arxiv.org/html/2608.20630#S2.E1)\. A Boolean result can be consumed byWHERE; other types can appear inSELECT,ORDER BY, or a later primitive\.
SELECTreview\_id,
ai\_classify\(review\_text,
ARRAY\[’positive’,’negative’,’neutral’\]\)ASsentiment
FROMreviews;
#### AI\_AGG: group→\\rightarrowvalue\.
The aggregate primitive evaluates a bag of tuples sharing a relational group key:
𝖠I,T:ℬ\(Rk\)⟼vk∈T,\\mathsf\{A\}\_\{I,T\}:\\mathcal\{B\}\(R\_\{k\}\)\\longmapsto v\_\{k\}\\in T,\(2\)whereℬ\(Rk\)\\mathcal\{B\}\(R\_\{k\}\)is the bag of rows in groupkk\. It reduces cardinality fromNNrows toGGgroup outputs\. Summaries, group\-level judgments, semantic counts or estimates, consensus extraction, and structured theme lists are instances\. UnlikeSUMorCOUNT,𝖠\\mathsf\{A\}need not be associative or decomposable; that property belongs to its physical contract, not its logical signature\.
SELECTmovie\_title,
ai\_agg\(review\_text,’Summarizetheaudiencesentiment\.’\)ASsummary
FROMreviews
GROUPBYmovie\_title;
#### AI\_JOIN: pair→\\rightarrowpredicate\.
The join primitive evaluates a semantic condition over two independently ranged tuples:
𝖩I:\(a,b\)∈A×B⟼yab∈\{0,1\}\.\\mathsf\{J\}\_\{I\}:\(a,b\)\\in A\\times B\\longmapsto y\_\{ab\}\\in\\\{0,1\\\}\.\(3\)Its relational result is
A⋈IB=\{\(a,b\)∈A×B:𝖩I\(a,b\)=1\}\.A\\bowtie\_\{I\}B=\\\{\(a,b\)\\in A\\times B:\\mathsf\{J\}\_\{I\}\(a,b\)=1\\\}\.\(4\)This primitive is cardinality\-generating before selection:\|A\|×\|B\|→K\|A\|\\\!\\times\\\!\|B\|\\rightarrow K\. A physical implementation may produce a score and apply a threshold, but the logical contract is a pair predicate\. Semantic join, entity matching, query–document relevance, similarity search, and top\-kkretrieval use the same pair judgment; ordinary SQL performs the final selection or ordering\.
SELECTr\.review\_text,m\.title
FROMreviewsrJOINmoviesm
ONai\_join\(’Isthisreviewaboutthemovie?’,r\.review\_text,m\.title\);
Table 1:The primitives are separated by their role in relational dataflow, not merely by prompt arity\.
#### WhyAI\_JOINis a Boolean judge over pairs\.
Any cross\-table AI join can be viewed as a Boolean judgment over a candidate pair: givenr∈Rr\\in Rands∈Ss\\in S, the model decides whether they satisfy a semantic relation\. This covers matching, relevance, similarity, membership, and natural\-language relations\. The key difference fromAI\_SCALARis thatAI\_JOINoperates over anN×MN\\times Mpair space and determines which pairs survive\. Exposing this pair space lets the optimizer enumerate, block, retrieve, or factor candidates before model invocation\. Thus,AI\_JOINis essentially a semanticIFover row pairs, with the relational structure needed for join optimization\.
### 2\.2 Scope, Completeness, and Coverage
Our claim covers*single\-pass, query\-time semantic functions*, where each model call consumes relational data and returns a value or decision\. This follows classical relational query theory, where complex queries are built by composing a small set of operators, including tuple and join functions[7](https://arxiv.org/html/2608.20630#bib.bib2)and group aggregation[19](https://arxiv.org/html/2608.20630#bib.bib3)\. Under this view, every model call operates on one of three inputs: a row, a group, or a candidate pair, corresponding toAI\_SCALAR,AI\_AGG, andAI\_JOIN\. More complex tasks are compositions of these primitives with ordinary SQL\. Recursive agents, training, multimodal conversion, indexing, and side\-effecting actions are outside our scope\.
We further test this formulation against existing systems and workloads\. Table[2](https://arxiv.org/html/2608.20630#S2.T2)compares 78 operators from eleven public semantic\-query systems\. Among them, 63 semantic functions map directly to our three primitives, while the rest are conversion, indexing, ordinary SQL, or loop operations outside the scope\. Appendix[J\.1](https://arxiv.org/html/2608.20630#A10.SS1)provides the full mapping\. We also decompose 37 end\-to\-end semantic tasks into primitive plans\. Figure[2](https://arxiv.org/html/2608.20630#S2.F2)shows that almost all require no more than two AI primitives, and none requires more than three\. Together, these results show that the three primitives cover both the existing AI\-function surface and their common compositions in practical queries\.
Figure 2:Coverage of 37 semantic\-query intents by primitive composition depth\. Most require one or two primitives; all require at most three\.Table 2:Audited compilation of public operator surfaces\. MM denotes multimodal conversion and NS denotes non\-semantic infrastructure outside the model\-invoking core\.
### 2\.3 Plan\-Level Optimization Objective
Let a compiled query contain AI nodesFq=\(f1,…,fh\)F\_\{q\}=\(f\_\{1\},\\ldots,f\_\{h\}\), wherefi∈\{𝖲,𝖠,𝖩\}f\_\{i\}\\in\\\{\\mathsf\{S\},\\mathsf\{A\},\\mathsf\{J\}\\\}, and leta=\(a1,…,ah\)a=\(a\_\{1\},\\ldots,a\_\{h\}\)select one physical configuration for each node\. We evaluate the complete plan by task qualityQ\(q,a\)Q\(q,a\), monetary costC\(q,a\)C\(q,a\), and end\-to\-end latencyL\(q,a\)L\(q,a\)\. Given budgetsBCB\_\{C\}andBLB\_\{L\}, the optimizer seeks
aq⋆\\displaystyle a\_\{q\}^\{\\star\}=argmaxa∈𝒜\(Fq\)Q\(q,a\)\\displaystyle=\\argmax\_\{a\\in\\mathcal\{A\}\(F\_\{q\}\)\}Q\(q,a\)\(5\)s\.t\.C\(q,a\)\\displaystyle\\text\{s\.t\.\}\\quad C\(q,a\)≤BC,L\(q,a\)≤BL\.\\displaystyle\\leq B\_\{C\},\\qquad L\(q,a\)\\leq B\_\{L\}\.This plan\-level form matters\. A locally accurate scalar extraction may materially reduce join cost downstream; an early lossy join or aggregate may irreversibly remove evidence\.SAGEtherefore materializes reusable scalar values, pushes lossless and selective predicates early, and avoids partial execution of holistic aggregates\. Appendix[J](https://arxiv.org/html/2608.20630#A10)gives the composition and MapReduce conditions used by the optimizer\.
## 3 Primitive\-Aware Physical Execution
The logical layer defines what each AI function means, while the physical layer decides how to execute it efficiently\.SAGEshares confidence, escalation, and configuration mechanisms across primitives, while preserving the distinct optimization needs of rows, groups, and pair spaces\.
### 3\.1 A Shared Adaptive Skeleton
For a logical invocationfI\(x\)f\_\{I\}\(x\), letMfM\_\{f\}be an optional cheap front end,MsM\_\{s\}the model assigned the first generative attempt, andMℓM\_\{\\ell\}the model assigned uncertain cases\. The subscripts indicate routing roles, not model size: empirical quality need not increase monotonically with parameter count\. Execution has three decisions:
1. 1\.MfM\_\{f\}may settle or prune an input when its margin exceeds a front\-end cutoffτf\\tau\_\{f\};
2. 2\.otherwiseMsM\_\{s\}produces an answery^s\\hat\{y\}\_\{s\}and confidences\(x,y^s\)s\(x,\\hat\{y\}\_\{s\}\);
3. 3\.SAGEreturnsy^s\\hat\{y\}\_\{s\}whens\(x,y^s\)≥τes\(x,\\hat\{y\}\_\{s\}\)\\geq\\tau\_\{e\}and asksMℓM\_\{\\ell\}to re\-evaluate the input otherwise\.
For a chosen physical plan, letnfn\_\{f\}be the number of front\-end evaluations,nsn\_\{s\}the number of first\-model evaluations, andnℓn\_\{\\ell\}the number of escalations\. The model\-call component of cost is
Cmodel=nfcf\+nscs\+nℓcℓ,C\_\{\\mathrm\{model\}\}=n\_\{f\}\\,c\_\{f\}\+n\_\{s\}\\,c\_\{s\}\+n\_\{\\ell\}\\,c\_\{\\ell\},\(6\)with zero terms for absent stages\. The primitive\-specific physical plan determinesnfn\_\{f\}andnsn\_\{s\}—for example, a factorable join can replaceNMNMpair evaluations withN\+MN\+Mrow evaluations—while the confidence gate controlsnℓn\_\{\\ell\}\.
#### Answer\-bearing confidence\.
For an outputy=\(y1,…,yT\)y=\(y\_\{1\},\\ldots,y\_\{T\}\), a standard confidence score averages token log\-probabilities:
CLP\(y\)=1T∑t=1Tlogp\(yt∣y<t,x\)\.C\_\{\\mathrm\{LP\}\}\(y\)=\\frac\{1\}\{T\}\\sum\_\{t=1\}^\{T\}\\log p\(y\_\{t\}\\mid y\_\{<t\},x\)\.\(7\)This score can be dominated by confident but uninformative tokens\.SAGEinstead usesTokenSAR[13](https://arxiv.org/html/2608.20630#bib.bib19), which gives more weight to tokens that matter to the answer:
CTokenSAR\(y\)=∑t=1TR~tlogp\(yt∣y<t,x\),R~t=Rt∑j=1TRj,C\_\{\\mathrm\{TokenSAR\}\}\(y\)=\\sum\_\{t=1\}^\{T\}\\tilde\{R\}\_\{t\}\\log p\(y\_\{t\}\\mid y\_\{<t\},x\),\\qquad\\tilde\{R\}\_\{t\}=\\frac\{R\_\{t\}\}\{\\sum\_\{j=1\}^\{T\}R\_\{j\}\},\(8\)whereRtR\_\{t\}measures the relevance of tokenyty\_\{t\}to the output meaning\. Label\-valued functions use the answer\-token confidence directly, while free\-form functions use the relevance\-weighted score\. The query probe calibrates the escalation thresholdτe\\tau\_\{e\}\. In our AI\-Join runs, this signal separates correct and incorrect answers more reliably than mean log\-probability and improves routing over random escalation under the same large\-model budget \(Figures[14](https://arxiv.org/html/2608.20630#A3.F14)and[15](https://arxiv.org/html/2608.20630#A3.F15)\)\. More broadly, escalation is conditional rather than global:SAGEchooses the model that performs best on uncertain cases instead of assuming that the largest model is always strongest \(Table[11](https://arxiv.org/html/2608.20630#A2.T11)\)\.
### 3\.2AI\_SCALAR: Independent Row Execution
Figure 3:Shared cascade forAI\_SCALARandAI\_AGG\. Scalar calls enter per row; aggregate calls enter per group after optional compaction\. Low\-confidence outputs alone reach the escalation model\.ForAI\_SCALAR, the logical items are existing row bindings, so calls factorize exactly\.SAGEbatches or parallelizes rows without changing semantics, runs the assigned first model, and escalates only low\-confidence outputs\. A cheap labeler can serve asMfM\_\{f\}for closed\-set classification; for free\-form extraction or rewriting the front end is absent and all rows begin atMsM\_\{s\}\. The configuration is
a𝖲=\(Mf,Ms,Mℓ,τf,τe,reasoning mode,T,batch size\)\.a\_\{\\mathsf\{S\}\}=\(M\_\{f\},M\_\{s\},M\_\{\\ell\},\\tau\_\{f\},\\tau\_\{e\},\\text\{reasoning mode\},T,\\text\{batch size\}\)\.The decisive property is that one row’s answer does not depend on another row\. Thus caching, vectorized inference, and pass\-rate ordering of consecutive Boolean scalars are exact\. If several downstream nodes reuse a generated field,SAGEmaterializes it once instead of regenerating it inside every pair or group\.
### 3\.3AI\_AGG: Group Reduction
ForAI\_AGG, one logical item is a complete SQL group\. Groups often contain near\-duplicate evidence, so the optional front end embeds group members, clusters entries above cosine thresholdτc\\tau\_\{c\}, and represents each cluster once with a weight or exemplar\. The compacted group enters the shared cascade\. The configuration adds the compaction policy:
a𝖠=\(Ms,Mℓ,τc,τe,chunking,reasoning mode,T\)\.a\_\{\\mathsf\{A\}\}=\(M\_\{s\},M\_\{\\ell\},\\tau\_\{c\},\\tau\_\{e\},\\text\{chunking\},\\text\{reasoning mode\},T\)\.
Compaction and chunking have different correctness contracts\. Near\-duplicate compaction is an approximation whose effect is measured on the probe\. Chunking can be exact only when the aggregate is modular or algebraic: there must exist a partial statehh, merge operator⊕\\oplus, and finalizerggsuch that
h\(G1⊎G2\)=h\(G1\)⊕h\(G2\),𝖠\(G\)=g\(h\(G\)\)\.h\(G\_\{1\}\\uplus G\_\{2\}\)=h\(G\_\{1\}\)\\oplus h\(G\_\{2\}\),\\qquad\\mathsf\{A\}\(G\)=g\(h\(G\)\)\.Counts and sums over already materialized model\-extracted values, as well as mergeable vote summaries, may satisfy this contract\. Holistic median\-like judgments and summaries depending on cross\-document evidence generally do not\.SAGEtherefore keeps the full group for holistic aggregates rather than silently treating prompt chunking as an exact optimization\. The measured decomposability study appears in Appendix[J](https://arxiv.org/html/2608.20630#A10)\.
### 3\.4AI\_JOIN: Predicate\-Aware Pair Execution
AI\_JOINis the only primitive whose candidate domain may be quadratic\. Its physical plan must be chosen before the cascade because the predicate determines whether\|A\|\|B\|\|A\|\|B\|pair judgments are necessary\. The three join classes from the join\-specific system are retained here as*physical routes insideAI\_JOIN*, not as top\-level AI\-function primitives\.
Figure 4:Predicate\-awareAI\_JOIN\. A cached recipe card selects a membership, relational, or reasoning route; only the uncertain residual enters the shared cascade\.#### Virtual\-column test\.
An LLM compiler reads the predicate and a small sample of candidate pairs and emits a cached recipe card\. The card asks whether the predicate can be written as
p\(a,b\)≡ϕ\(f\(a\),g\(b\)\),p\(a,b\)\\equiv\\phi\(f\(a\),g\(b\)\),\(9\)whereffandggare stable row\-local virtual columns andϕ\\phiis a deterministic comparison\. If not, it asks whether a cheap pair model can score a closed relation label\. These two axes select one of three routes:
route\(p\)\\displaystyle\\mathrm\{route\}\(p\)=membership\\displaystyle=\\textsf\{membership\}ifp≡ϕ\(f\(a\),g\(b\)\),\\displaystyle\\text\{if \}p\\equiv\\phi\(f\(a\),g\(b\)\),\(10\)=relational\\displaystyle=\\textsf\{relational\}if a closed pair label exists,\\displaystyle\\text\{if a closed pair label exists\},=reasoning\\displaystyle=\\textsf\{reasoning\}otherwise\.\\displaystyle\\text\{otherwise\}\.The card also records the featurizer, labels, negative check, and candidate configuration space\. Figure[5](https://arxiv.org/html/2608.20630#S3.F5)shows the compilation artifact; card validity and sample sensitivity are evaluated in Appendices[A](https://arxiv.org/html/2608.20630#A1)and[A\.1](https://arxiv.org/html/2608.20630#A1.SS1)\.
Figure 5:Recipe\-card compilation\. A smallLIMIT\-style sample and the predicate produce a cached, executable join route rather than a natural\-language explanation alone\.
#### Membership route: materialize and hash\-join\.
For “same sentiment,”ffandggindependently assign labels in a closed set andϕ\\phitests equality\.SAGErunsGLiClass[35](https://arxiv.org/html/2608.20630#bib.bib26)or the scalar cascade once per row, materializes the two virtual columns, and applies an ordinary hash join\. Predicate work drops from\|A\|\|B\|\|A\|\|B\|pair evaluations to\|A\|\+\|B\|\|A\|\+\|B\|row evaluations\. The transformation is exact if Equation[9](https://arxiv.org/html/2608.20630#S3.E9)and the predicted row values are correct; model error remains visible as ordinary virtual\-column error\.
#### Relational route: filter the pair grid\.
For “personaais the spouse of personbb,” no useful label belongs to either row independently\. The predicate is a property of the pair, but a lightweight relation model such asGLiREL[5](https://arxiv.org/html/2608.20630#bib.bib27)can reject easy negatives\. The pair grid remains logically present; only pairs above the front\-end cutoff enter the generative cascade\.
#### Reasoning route: conservative negative pruning\.
For “documentaaprovides enough evidence to answer questionbb,” no stable closed label captures the decision\. Embedding similarity or a membership rewrite can remove valid matches\. The recipe card supplies a self\-descriptive negative condition; the front end commits only high\-margin negatives, and all ambiguous pairs receive generative reasoning\. This route spends more per survivor but avoids an unsafe factorization\.
#### Compound predicates\.
A join condition may bep=p1∧⋯∧pmp=p\_\{1\}\\wedge\\cdots\\wedge p\_\{m\}with atoms on different routes\. The compiler constructs one physical plan per atom and applies predicate pushdown\. On a shared probe, it estimates pass fractionσ^i\\hat\{\\sigma\}\_\{i\}and amortized per\-candidate costc^i\\hat\{c\}\_\{i\}, then orders atoms by
c^i1−σ^i,\\frac\{\\hat\{c\}\_\{i\}\}\{1\-\\hat\{\\sigma\}\_\{i\}\},\(11\)the estimated cost per eliminated candidate\. A cheap membership atom can therefore prune the pair space before a reasoning atom executes\. This is where the original AI\-Join decomposition fits the unified plan: it optimizes oneAI\_JOINnode and can itself consumeAI\_SCALARvirtual columns\.
#### Outer joins and dangling rows\.
The model\-invoking core still decides pair membership\.LEFT,RIGHT, andFULLsemantics are implemented by ordinary relational completion after the selected route, provided the engine tracks whether each preserved row received a qualifying match\. Appendix[G](https://arxiv.org/html/2608.20630#A7)verifies dangling\-row recall under selective predicates\.
Figure 6:Probe\-and\-race execution\. Primitive\-specific proposers generate a small slate of semantically valid whole\-plan configurations\. A shared probe measures quality proxy, cost, and latency; racing eliminates inferior or infeasible candidates and freezes one plan for full execution\.
## 4 Test\-Time Configuration Selection
### 4\.1 Configuration Spaces and Slates
For nodefif\_\{i\}, let𝒜fi\\mathcal\{A\}\_\{f\_\{i\}\}contain only configurations that preserve its logical contract\. A scalar candidate bundles model roles, confidence threshold, reasoning mode, temperature, and batching\. An aggregate candidate adds compaction and legally available partial\-reduction choices\. A join candidate adds recipe route, blocking or factorization parameters, and front\-end cutoff\. A query with AI nodesFq=\(f1,…,fh\)F\_\{q\}=\(f\_\{1\},\\ldots,f\_\{h\}\)has the product space
𝒜\(Fq\)=𝒜f1×⋯×𝒜fh,\\mathcal\{A\}\(F\_\{q\}\)=\\mathcal\{A\}\_\{f\_\{1\}\}\\times\\cdots\\times\\mathcal\{A\}\_\{f\_\{h\}\},which is too large to execute exhaustively\.
Each primitive therefore maintains a lightweight proposer\. Given an embedded instruction, logical type, input statistics, and previous probe outcomes, the proposer emits a small candidate set containing \(i\) a cheap anchor, \(ii\) a quality anchor, and \(iii\) history\-guided exploratory settings\. For a multi\-node query,SAGEassembles compatible node candidates into a slateSq⊂𝒜\(Fq\)S\_\{q\}\\subset\\mathcal\{A\}\(F\_\{q\}\)of at mostKKwhole\-plan configurations\. Cold start uses the anchors and space\-filling samples; later queries reuse primitive\-specific feedback\. This proposal stage reduces the number of plans tested but does not decide the winner\. Let𝒜qfeas=\{a∈𝒜\(Fq\):C\(q,a\)≤BC,L\(q,a\)≤BL\}\\mathcal\{A\}^\{\\mathrm\{feas\}\}\_\{q\}=\\\{a\\in\\mathcal\{A\}\(F\_\{q\}\):C\(q,a\)\\leq B\_\{C\},\\ L\(q,a\)\\leq B\_\{L\}\\\}andQq⋆=maxa∈𝒜qfeasQ\(q,a\)Q\_\{q\}^\{\\star\}=\\max\_\{a\\in\\mathcal\{A\}^\{\\mathrm\{feas\}\}\_\{q\}\}Q\(q,a\)denote the budget\-feasible oracle quality for queryqq\. The proposer seeks
Sq=argmaxS⊆𝒜\(Fq\)\|S\|≤KPr\[maxa∈S∩𝒜qfeasQ\(q,a\)≥\(1−ε\)Qq⋆\]\.S\_\{q\}=\\argmax\_\{\\begin\{subarray\}\{c\}S\\subseteq\\mathcal\{A\}\(F\_\{q\}\)\\\\ \|S\|\\leq K\\end\{subarray\}\}\\Pr\\\!\\left\[\\max\_\{a\\in S\\cap\\mathcal\{A\}^\{\\mathrm\{feas\}\}\_\{q\}\}Q\(q,a\)\\geq\(1\-\\varepsilon\)Q\_\{q\}^\{\\star\}\\right\]\.\(12\)
### 4\.2 Probe\-and\-Race Execution
SAGEdraws a small stratified probePqP\_\{q\}from the current data and evaluates every candidate on the same sampled rows, groups, or candidate pairs\. For composed queries, the sampled subplan is executed far enough to capture downstream effects\. On each probe block,SAGErecords actual token usage, cost, and latency, uses a fixed judge model to obtain the label\-free quality estimateQ^q\(a\)\\widehat\{Q\}\_\{q\}\(a\), and extrapolates resource usage to the full query\. An iRace\-style procedure[25](https://arxiv.org/html/2608.20630#bib.bib39)then progressively eliminates statistically inferior or budget\-infeasible candidates\. Reusing the same probe across candidates ensures that differences reflect configuration rather than sampling variation\. The final choice is
a^q=argmaxa∈AqQ^q\(a\)s\.t\.C^q\(a\)≤BC,L^q\(a\)≤BL,\\widehat\{a\}\_\{q\}=\\argmax\_\{a\\in A\_\{q\}\}\\widehat\{Q\}\_\{q\}\(a\)\\quad\\text\{s\.t\.\}\\quad\\widehat\{C\}\_\{q\}\(a\)\\leq B\_\{C\},\\quad\\widehat\{L\}\_\{q\}\(a\)\\leq B\_\{L\},\(13\)whereAqA\_\{q\}is the surviving slate\. No benchmark gold labels are used at deployment, and the resulting probe outcomes update the proposer for future queries\. Full pseudocode appears in Algorithm[1](https://arxiv.org/html/2608.20630#alg1)\(Appendix[E](https://arxiv.org/html/2608.20630#A5)\)\.
Figure 7:Configuration surface on SemBench Q5\. Color shows measured F1 over the front\-end and escalation thresholds\(τf,τe\)\(\\tau\_\{f\},\\tau\_\{e\}\), illustrating whySAGEselects configurations per query rather than using fixed thresholds\.#### Further validation of configuration racing\.
We further validate configuration racing onAI\_JOIN\. Figure[7](https://arxiv.org/html/2608.20630#S4.F7)uses SemBench Q5 as a representative case: quality varies substantially across\(τf,τe\)\(\\tau\_\{f\},\\tau\_\{e\}\), showing that fixed thresholds can miss the best configuration\. Additional results confirm that the selected configuration stabilizes with a small probe, the proposed slate achieves high near\-oracle coverage, and the label\-free proxy closely tracks a gold\-based oracle\.
SemBenchSupplementalMethodQ1Q2Q3Q4Q5Q6Q7Q8Q9Q10SummaryFewRelBRIGHTMXSTask\-normalized quality↑\\uparrowLotus1\.000\.730\.740\.970\.7200\.7100\.3700\.970\.780\.790\.7780\.8800\.6910\.25∗0\.25^\{\\ast\}Palimpzest1\.000\.600\.570\.940\.9440\.6000\.7000\.920\.820\.710\.7800\.8870\.7070\.26Sema0\.900\.750\.930\.990\.7600\.7600\.7600\.990\.730\.720\.8290\.8570\.428—thDB1\.000\.600\.790\.980\.9200\.6600\.7200\.96——0\.829†0\.829^\{\\dagger\}0\.8800\.563—FDJ————0\.7480\.7710\.755————0\.8260\.507—SAGE \(No Racing\)0\.980\.700\.950\.950\.8500\.7700\.7500\.980\.700\.800\.8430\.8680\.7740\.27SAGE0\.980\.920\.950\.950\.8500\.8500\.8500\.980\.910\.840\.9080\.9020\.8050\.27Cost\(USD\)↓\\downarrowLotus0\.2100\.0120\.0120\.0136\.1005\.6505\.6400\.0120\.0300\.21017\.8900\.0130\.0110\.0050∗0\.0050^\{\\ast\}Palimpzest0\.0040\.0100\.0150\.0150\.0150\.0216\.9900\.0150\.0550\.4087\.5490\.0160\.0140\.0006Sema0\.1300\.0070\.0080\.0072\.9502\.9402\.9400\.0070\.0300\.2009\.2200\.0110\.010—thDB0\.0020\.0060\.0100\.0100\.0060\.0060\.2360\.010——0\.2840\.0110\.011—FDJ————0\.4370\.3920\.481————0\.0110\.010—SAGE \(No Racing\)0\.01960\.00300\.00680\.00360\.0010\.0010\.0030\.00400\.01200\.10900\.1630\.0010\.0050\.0004SAGE0\.01960\.01010\.00680\.00360\.0010\.0010\.0030\.00400\.01600\.09420\.1590\.0010\.0090\.00008Latency\(s\)↓\\downarrowLotus450\.063\.022\.015\.01135612916951115\.032\.0748\.03512830\.067\.1150∗150^\{\\ast\}Palimpzest5\.08\.813\.512\.815\.822\.61296013\.148\.4427\.91352826\.419\.24\.3Sema258\.024\.023\.092\.038953565371120\.051\.0417\.012056101\.646\.4—thDB2\.76\.815\.315\.273\.266\.71970\.612\.6——216365\.216\.1—FDJ————124811871396————24\.926\.7—SAGE \(No Racing\)51\.53\.436\.76\.02\.025\.0109\.05\.118\.2157\.4414\.316\.718\.812\.7SAGE51\.55\.236\.76\.02\.827\.1181\.35\.16\.0167\.0488\.732\.627\.24\.7
Table 3:Unified results onSemBenchQ1–Q10 and supplemental workloads\. Quality uses precision@5 \(Q1–Q2\), clipped1−relative error1\-\\text\{relative error\}\(Q3, Q4, Q8\), F1 \(Q5–Q7, FewRel, BRIGHT\), a\[0,1\]\[0,1\]score transformed from Spearman correlation \(Q9–Q10\), and ROUGE\-1 \(MXS\)\. The SemBench Summary is the arithmetic mean for quality and the sum for cost and latency, computed before displayed rounding\. MXS cost and latency are per group\. Q5–Q7, FewRel, and BRIGHT use the latest AI\-Join repeated\-run means; the other columns use the full\-suite measurements\. Dashes mark unsupported workloads;†averages only supported queries;∗denotes an estimated infeasible LOTUS MXS run\.
## 5 Evaluation
We evaluate the complete three\-primitive surface and then study theAI\_JOINspecialization in depth\. Table[3](https://arxiv.org/html/2608.20630#S4.T3)combinesSemBenchQ1–Q10 and Multi\-XScience; overlapping joins use the latest repeated AI\-Join runs, as do the compound workloads and mechanism studies\. We ask whetherSAGEimproves cross\-primitive quality and efficiency \(RQ1\), executes confounded predicates near the cost of their selective atom \(RQ2\), requires each mechanism \(RQ3\), and obtains reliable label\-free estimates \(RQ4\)\.
#### Setup\.
SemBench[21](https://arxiv.org/html/2608.20630#bib.bib22)spans classification \(Q1–Q2\), aggregation \(Q3, Q4, Q8\), joins \(Q5–Q7\), and ranking \(Q9–Q10\); Multi\-XScience \(MXS\)[26](https://arxiv.org/html/2608.20630#bib.bib25)adds aggregation\. Membership uses SemBench Q5–Q7 at scale factor10001000; relational and reasoning joins use the*spouse*relation of FewRel[16](https://arxiv.org/html/2608.20630#bib.bib23)and the TheoremQA split of BRIGHT[36](https://arxiv.org/html/2608.20630#bib.bib24)\. Amazon–Google ER[20](https://arxiv.org/html/2608.20630#bib.bib35), x\-stance[37](https://arxiv.org/html/2608.20630#bib.bib36), and SciFact[38](https://arxiv.org/html/2608.20630#bib.bib37)provide compound predicates whose atoms have different classes\. Within a workload, all systems share inputs and pricing; we report normalized quality, USD cost, and wall\-clock latency\. Full\-suite traces usegranite\-3\.3\-8b\-instruct[17](https://arxiv.org/html/2608.20630#bib.bib33)andgpt\-oss\-120b[1](https://arxiv.org/html/2608.20630#bib.bib28)\. Current join runs pairGranite\-3\.0\-8B[15](https://arxiv.org/html/2608.20630#bib.bib32)withgpt\-oss\-120b, useGLiClass[35](https://arxiv.org/html/2608.20630#bib.bib26)andGLiREL[5](https://arxiv.org/html/2608.20630#bib.bib27), and compare with LOTUS[29](https://arxiv.org/html/2608.20630#bib.bib1), Palimpzest[23](https://arxiv.org/html/2608.20630#bib.bib4), SEMA[30](https://arxiv.org/html/2608.20630#bib.bib5), thDB[18](https://arxiv.org/html/2608.20630#bib.bib11), and FDJ[39](https://arxiv.org/html/2608.20630#bib.bib29)under the AI\-Join protocol; each external system otherwise uses its native configuration\.SAGE \(No Racing\)freezes one configuration; Appendix[I](https://arxiv.org/html/2608.20630#A9)gives full provenance and settings\.
Table 4:Confounded\-predicate results, separated from the unified primitive table\. Each workload conjoins two atoms of different classes; values are mean±\\pms\.e\.m\. over the current AI\-Join runs\.
#### Cross\-primitive and per\-query gains \(RQ1\)\.
Table[3](https://arxiv.org/html/2608.20630#S4.T3)places all ten SemBench queries and MXS in one comparison\.SAGEleads the SemBench average \(0\.908\), ties on MXS, and has the best or tied\-best updated\-join quality except Q5; racing is most visible on Q6 and Q7, whileSAGE \(No Racing\)retains a strong fixed quality–cost tradeoff\. Gains are largest on Q2, Q7, Q9, FewRel, and BRIGHT\. Under shift,SAGErecovers80\.8%80\.8\\%of the target\-trained ceiling, versus73\.5%73\.5\\%for LOTUS and60\.1%60\.1\\%for FDJ \(Figure[9](https://arxiv.org/html/2608.20630#S5.F9)\)\. Join F1 covers allNNpairs; predictions for thennprobe pairs are reused\. End\-to\-end cost and latency include recipe generation, probes, judge calls, and execution on the remainingN−nN\-npairs\.
#### Performance at Confounded Predicate \(RQ2\)\.
Table[4](https://arxiv.org/html/2608.20630#S5.T4)reports the confounded workloads separately\. Selective\-first execution givesSAGEthe best mean F1 \(0\.8460\.846\), whileSAGE \(No Racing\)is cheapest on all three \($0\.002–$0\.007 versus $0\.009–$0\.031\): the first atom prunes the pair space\. Removing an atom or decomposition degrades precision or nearly doubles pairwise calls \(Table[9](https://arxiv.org/html/2608.20630#A1.T9), Appendix[A](https://arxiv.org/html/2608.20630#A1)\)\.
#### Scalability
Table[5](https://arxiv.org/html/2608.20630#S5.T5)comparesSAGEwith an exact per\-pairAI\_JOINplan on a representative join, both run to completion\. It replaces16,25616\{,\}256pairwise calls with128128calls \(127×127\\timesfewer\), cutting wall\-clock by89×89\\timesand cost by358×358\\times\. In the Q6/Q7 sweeps \(Figure[8](https://arxiv.org/html/2608.20630#S5.F8)\), F1 stays stable while cost and latency fall by one to three orders of magnitude versus always\-large execution\.
Table 5:Predicate\-awareAI\_JOINagainst the exact all\-pairs plan on a representative join\. Both plans were executed in full and serially; all three columns are measured, not projected\.\(a\)SemBenchQ6\(b\)SemBenchQ7Figure 8:Measured scaling from10210^\{2\}to3×1063\\times 10^\{6\}candidate pairs on SemBench Q6 and Q7\. Left: F1; center: cost; right: latency\. Each operating point is executed and scored under the AI\-Join protocol\.Table 6:Component ablation on one join per class \(SemBench, FewRel, BRIGHT\); costs in USD, higher F1 is better\. Every mechanism carries weight; removing routing is the largest failure\. The mean\-log\-probability row retains escalation and changes only the confidence signal\.\(a\) Train on SemBench\(b\) Train on FewRel\(c\) Train on BRIGHT\(d\) Train on ConfoundedFigure 9:Cross\-domain recovery\. Each panel fixes the source domain and evaluates the three held\-out target domains; higher is better\. No target labels are used forSAGEconfiguration selection\.
#### Ablation across mechanisms \(RQ3\)\.
Table[6](https://arxiv.org/html/2608.20630#S5.T6)ablates one join per class; fullSAGEgives the strongest overall quality–cost tradeoff\. Mean log probability hurts membership and reasoning despite retaining escalation \(F10\.850→0\.6340\.850\\to 0\.634and0\.805→0\.7460\.805\\to 0\.746\)\. Removing routing is worse: the membership join becomes a $0\.563 pairwise scan and FewRel falls to0\.0390\.039\. The fixed no\-racing variant also loses quality on Q2, Q6–Q7, Q9–Q10, FewRel, BRIGHT, and all three compound joins, while tying on the remaining Table[3](https://arxiv.org/html/2608.20630#S4.T3)workloads\. Neither model tier alone is both cheap and reliable; fixed\-query interventions confirm the routing failure \(Table[8](https://arxiv.org/html/2608.20630#A1.T8), Appendix[A](https://arxiv.org/html/2608.20630#A1)\)\.
#### The proposer fills the slate \(RQ3\)\.
Racing can only choose from the slate, so a slate holding no good configuration cannot be repaired downstream\. We replay4040queries from each of four families after pre\-executing all9696configurations, so the oracle is known exactly\. A slate hits when it contains a configuration withinε\\varepsilonof the oracle \(Eq\.[12](https://arxiv.org/html/2608.20630#S4.E12); protocol in Appendix[F](https://arxiv.org/html/2608.20630#A6)\)\. AtK=3K\{=\}3, the learned proposer hits a near\-oracle configuration on60\.8%60\.8\\%of queries versus3\.4%3\.4\\%for a uniform slate, outperformingϵ\\epsilon\-greedy, UCB[2](https://arxiv.org/html/2608.20630#bib.bib38), and last\-winner baselines \(Figure[10](https://arxiv.org/html/2608.20630#S5.F10)\)\. A cold\-reset history falls to chance while a warm history sustains the hit rate; the proposer also reaches a near\-oracle incumbent at low probe cost and remains reliable when most configurations are poor \(Figure[17](https://arxiv.org/html/2608.20630#A6.F17)\)\.
Figure 10:Near\-oracle slate hit rate versus slate sizeKKon the160160\-query replay suite \(mean±\\pms\.e\.,2020seeds\)\. At the deployedK=3K\{=\}3, the proposer places a near\-oracle configuration in the slate60\.8%60\.8\\%of the time; a uniform slate,3\.4%3\.4\\%\.
#### Convergence Pace
The race stabilizes within about fifty probed samples, lifting deployed F1 from0\.6850\.685to0\.7460\.746\(Figure[11](https://arxiv.org/html/2608.20630#S5.F11)\); its overhead is bounded and front\-loaded\.
Figure 11:Configuration\-search convergence forAI\_JOIN\. About fifty probed samples stabilize the selected configuration; deployed F1 rises from0\.6850\.685to0\.7460\.746\.
#### Validation of Estimators \(RQ4\)\.
Proxy selection is compared with a gold oracle under the same candidates and budgets \(Figure[12](https://arxiv.org/html/2608.20630#S5.F12)\): proxy\-selected configurations average0\.8430\.843versus0\.8920\.892for gold selection, with the largest gap on BRIGHT\. Structural and sample\-shift checks separately audit the recipe\-card compiler \(Table[7](https://arxiv.org/html/2608.20630#A1.T7), Appendix[A](https://arxiv.org/html/2608.20630#A1)\)\. These diagnostics quantify, rather than eliminate, label\-free routing and selection error\.
Figure 12:Quality of the proxy\-selected and gold\-selected configurations under the same candidate sets and budgets\. Points and stems show the family\-level gap; the gold selector is a diagnostic upper bound\.
#### Cross\-domain recovery\.
We train on one family and evaluate each held\-out family without target labels, allowing onlySAGE’s unlabeled probe\. Across ten stratified splits and twelve directions, recovery—target F1 divided by the best target\-trained F1 amongSAGE, LOTUS, and FDJ—is80\.8%80\.8\\%forSAGE,73\.5%73\.5\\%for LOTUS, and60\.1%60\.1\\%for FDJ\. Thus weak in\-domain performance cannot inflate the score;SAGEleads or ties on eight directions \(Figure[9](https://arxiv.org/html/2608.20630#S5.F9)\)\.
## 6 Related Work
#### AI functions and relational structure\.
LOTUS, Palimpzest, ZenDB, Sema, ThalamusDB, DocETL, SUQL, and UQE expose model\-backed mapping, filtering, extraction, retrieval, joining, and aggregation[29](https://arxiv.org/html/2608.20630#bib.bib1);[23](https://arxiv.org/html/2608.20630#bib.bib4);[22](https://arxiv.org/html/2608.20630#bib.bib8);[30](https://arxiv.org/html/2608.20630#bib.bib5);[18](https://arxiv.org/html/2608.20630#bib.bib11);[33](https://arxiv.org/html/2608.20630#bib.bib6);[9](https://arxiv.org/html/2608.20630#bib.bib10); production warehouses provide similarly broad AI\-SQL suites[10](https://arxiv.org/html/2608.20630#bib.bib13);[34](https://arxiv.org/html/2608.20630#bib.bib14);[14](https://arxiv.org/html/2608.20630#bib.bib15)\. Building on the logical–physical separation of relational optimization[8](https://arxiv.org/html/2608.20630#bib.bib31);[32](https://arxiv.org/html/2608.20630#bib.bib16),SAGEasks which properties must survive beneath these surface APIs\. Its three signatures expose whether an invocation preserves rows, reduces a group, or tests a pair, thereby defining the semantic unit that each physical rewrite must preserve\.
#### Structure\-aware and adaptive execution\.
Semantic\-join systems reduce the naive\|A\|\|B\|\|A\|\|B\|search through retrieval, batching, approximation, decomposition, or per\-table factorization[29](https://arxiv.org/html/2608.20630#bib.bib1);[18](https://arxiv.org/html/2608.20630#bib.bib11);[39](https://arxiv.org/html/2608.20630#bib.bib29);SAGEguards these choices by predicate structure, retaining pair semantics when a join cannot factor and distinguishing exact mergeable aggregates from approximate compaction\. Model cascades similarly route easy inputs to cheaper models[6](https://arxiv.org/html/2608.20630#bib.bib17);[28](https://arxiv.org/html/2608.20630#bib.bib18)\.SAGEcombines item\-level answer\-relevance confidence[13](https://arxiv.org/html/2608.20630#bib.bib19)with a query\-local probe that selects and freezes a complete physical configuration\. This outer search is related to iterated racing and cross\-entropy methods[25](https://arxiv.org/html/2608.20630#bib.bib39);[31](https://arxiv.org/html/2608.20630#bib.bib20);[11](https://arxiv.org/html/2608.20630#bib.bib21), but its candidates are semantics\-preserving plans whose feasibility jointly reflects quality, cost, and latency without deployment labels\.
## 7 Discussion, Limitations, and Conclusion
#### Discussion\.
For the audited single\-pass, query\-time AI functions,SAGEreplaces one logical operator per surface API with three model\-invocation signatures: row to value, group to value, and pair to predicate\. These signatures impose the correctness obligations for physical planning: preserve row identity forAI\_SCALAR, preserve the group result under an explicit merge or approximation contract forAI\_AGG, and preserve pair truth forAI\_JOINunless the predicate is shown to factor through per\-row state\. The API and intent audits support the breadth of this mapping, Table[3](https://arxiv.org/html/2608.20630#S4.T3)tests end\-to\-end behavior across primitive classes, and the repeated\-run study provides mechanism\-level evidence for predicate\-aware routing, decomposition, blocking, and racing on the evaluated joins\. Because the full\-suite and updated join columns use disclosed but different model stacks, comparisons remain valid within each workload and protocol rather than as hardware\-normalized ratios across columns\.
#### Limitations and conclusion\.
The three\-way coverage result is empirical, and excludes recursive agents, training, side effects, raw multimodal conversion, and index construction\. Scale results cover two membership joins, while transfer results measure configuration recovery with an unlabeled target probe rather than universal task transfer\. The reference\-free recipe compiler and self\-judged proxy may make correlated errors; aggregate compaction remains approximate without an equivalence contract; and probing must be amortized over enough inputs\. Broader scalar and aggregate ablations, additional models, and production concurrency are therefore needed\. Within this scope,SAGEachieves the best or tied\-best updated\-join quality except on Q5, replaces16,25616\{,\}256pairwise calls with128128on a representative factorable join, and reduces measured cost by358×358\\times\. The result is a small logical interface with guarded, primitive\-specific execution—not a claim that all primitives share one implementation—whose richest current specialization isAI\_JOIN\.
## References
- S\. Agarwal, L\. Ahmad, J\. Ai, S\. Altman, A\. Applebaum, E\. Arbus, R\. K\. Arora, Y\. Bai, B\. Baker, H\. Bao,et al\.Gpt\-oss\-120b & gpt\-oss\-20b model card\.arXiv preprint arXiv:2508\.10925\.Cited by:[Appendix I](https://arxiv.org/html/2608.20630#A9.SS0.SSS0.Px2.p1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Aueret al\.\(2002\)P\. Auer, N\. Cesa\-Bianchi, and P\. FischerFinite\-time analysis of the multiarmed bandit problem\.Machine learning47\(2\),pp\.235–256\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px6.p1.1)\.
- BerriAI \(2024\)BerriAILiteLLM: call all LLM apis using the OpenAI format\.Note:Software library[https://github\.com/BerriAI/litellm](https://github.com/BerriAI/litellm)Cited by:[Appendix I](https://arxiv.org/html/2608.20630#A9.SS0.SSS0.Px2.p1.1)\.
- Borovinsky \(2021\)K\. Borovinsky“Pitchfork’s reviews section by the numbers\.Pitchfork\.Cited by:[Appendix G](https://arxiv.org/html/2608.20630#A7.SS0.SSS0.Px1.p1.1)\.
- Boylanet al\.\(2025\)J\. Boylan, C\. Hokamp, and D\. G\. GhalandariGLiREL\-generalist model for zero\-shot relation extraction\.InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies \(Volume 1: Long Papers\),pp\.8230–8245\.Cited by:[§3\.4](https://arxiv.org/html/2608.20630#S3.SS4.SSS0.Px3.p1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Chenet al\.\(2023\)L\. Chen, M\. Zaharia, and J\. ZouFrugalgpt: how to use large language models while reducing cost and improving performance\.arXiv preprint arXiv:2305\.05176\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p3.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Codd \(1972\)E\. F\. CoddRelational completeness of data base sublanguages\.Research Report / RJ / IBM / San Jose, CaliforniaRJ987\.External Links:[Link](https://api.semanticscholar.org/CorpusID:41445196)Cited by:[§2\.2](https://arxiv.org/html/2608.20630#S2.SS2.p1.1)\.
- Codd \(1970\)E\. F\. CoddA relational model of data for large shared data banks\.Communications of the ACM13\(6\),pp\.377–387\.Cited by:[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Daiet al\.\(2024\)H\. Dai, B\. Y\. Wang, X\. Wan, B\. Dai, S\. Yang, A\. Nova, P\. Yin, P\. M\. Phothilimthana, C\. Sutton, and D\. SchuurmansUqe: a query engine for unstructured databases\.Advances in Neural Information Processing Systems37,pp\.29807–29838\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.11.1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Databricks \(2025\)DatabricksAI functions on Databricks\.Note:Databricks Documentation[https://docs\.databricks\.com/aws/en/large\-language\-models/ai\-functions](https://docs.databricks.com/aws/en/large-language-models/ai-functions)Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.2.1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- De Boeret al\.\(2005\)P\. De Boer, D\. P\. Kroese, S\. Mannor, and R\. Y\. RubinsteinA tutorial on the cross\-entropy method\.Annals of operations research134\(1\),pp\.19–67\.Cited by:[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Dorbaniet al\.\(2025\)A\. Dorbani, S\. Yasser, J\. Lin, and A\. MhedhbiBeyond quacking: deep integration of language models and rag into duckdb\.arXiv preprint arXiv:2504\.01157\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.7.1.1)\.
- Duanet al\.\(2024\)J\. Duan, H\. Cheng, S\. Wang, A\. Zavalny, C\. Wang, R\. Xu, B\. Kailkhura, and K\. XuShifting attention to relevance: towards the predictive uncertainty quantification of free\-form large language models\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\.5050–5063\.Cited by:[Appendix C](https://arxiv.org/html/2608.20630#A3.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p4.1),[§3\.1](https://arxiv.org/html/2608.20630#S3.SS1.SSS0.Px1.p1.2),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Google Cloud \(2025\)Google CloudGenerative AI in BigQuery: AI\.GENERATE and ML inference functions\.Note:Google Cloud BigQuery Documentation[https://cloud\.google\.com/bigquery/docs/generative\-ai\-overview](https://cloud.google.com/bigquery/docs/generative-ai-overview)Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.5.1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Granite Team \(2024\)I\. Granite TeamGranite 3\.0 language models\.URL: https://github\. com/ibm\-granite/granite\-3\.0\-language\-models\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Hanet al\.\(2018\)X\. Han, H\. Zhu, P\. Yu, Z\. Wang, Y\. Yao, Z\. Liu, and M\. SunFewRel: a large\-scale supervised few\-shot relation classification dataset with state\-of\-the\-art evaluation\.InProceedings of the 2018 conference on empirical methods in natural language processing,pp\.4803–4809\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p6.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- IBM Granite Team \(2025\)IBM Granite TeamGranite 3\.3 8B Instruct Model Card\.Note:[https://huggingface\.co/ibm\-granite/granite\-3\.3\-8b\-instruct](https://huggingface.co/ibm-granite/granite-3.3-8b-instruct)Accessed 28 July 2026Cited by:[Appendix I](https://arxiv.org/html/2608.20630#A9.SS0.SSS0.Px2.p1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Jo and Trummer \(2024\)S\. Jo and I\. TrummerThalamusdb: approximate query processing on multi\-modal data\.Proceedings of the ACM on Management of Data2\(3\),pp\.1–26\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.9.1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Klug \(1982\)A\. C\. KlugEquivalence of relational algebra and relational calculus query languages having aggregate functions\.J\. ACM29,pp\.699–717\.External Links:[Link](https://api.semanticscholar.org/CorpusID:38402199)Cited by:[§2\.2](https://arxiv.org/html/2608.20630#S2.SS2.p1.1)\.
- Köpckeet al\.\(2010\)H\. Köpcke, A\. Thor, and E\. RahmEvaluation of entity resolution approaches on real\-world match problems\.Proceedings of the VLDB Endowment3\(1\-2\),pp\.484–493\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Laoet al\.\(2025\)J\. Lao, A\. Zimmerer, O\. Ovcharenko, T\. Cong, M\. Russo, G\. Vitagliano, M\. Cochez, F\. Özcan, G\. Gupta, T\. Hottelier, H\. V\. Jagadish, K\. Kissel, S\. Schelter, A\. Kipf, and I\. TrummerSemBench: a benchmark for semantic query processing engines\.arXiv preprint arXiv:2511\.01716\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p6.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Linet al\.\(2024\)Y\. Lin, M\. Hulsebos, R\. Ma, S\. Shankar, S\. Zeigham, A\. G\. Parameswaran, and E\. WuTowards accurate and efficient document analytics with large language models\.arXiv preprint arXiv:2405\.04674\.Cited by:[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Liuet al\.\(2024a\)C\. Liu, M\. Russo, M\. Cafarella, L\. Cao, P\. B\. Chen, Z\. Chen, M\. Franklin, T\. Kraska, S\. Madden, and G\. VitaglianoA declarative system for optimizing ai workloads\.arXiv preprint arXiv:2405\.14696\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.8.1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Liuet al\.\(2024b\)S\. Liu, J\. Xu, W\. Tjangnaka, S\. Semnani, C\. Yu, and M\. LamSUQL: conversational search over structured and unstructured data with large language models\.InFindings of the Association for Computational Linguistics: NAACL 2024,pp\.4535–4555\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.10.1.1)\.
- López\-Ibáñezet al\.\(2016\)M\. López\-Ibáñez, J\. Dubois\-Lacoste, L\. Pérez Cáceres, M\. Birattari, and T\. StützleThe irace package: iterated racing for automatic algorithm configuration\.Operations Research Perspectives3,pp\.43–58\.Cited by:[§4\.2](https://arxiv.org/html/2608.20630#S4.SS2.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Luet al\.\(2020\)Y\. Lu, Y\. Dong, and L\. CharlinMulti\-xscience: a large\-scale dataset for extreme multi\-document summarization of scientific articles\.InProceedings of the 2020 conference on empirical methods in natural language processing \(EMNLP\),pp\.8068–8074\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p6.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Madaanet al\.\(2023\)A\. Madaan, N\. Tandon, P\. Gupta, S\. Hallinan, L\. Gao, S\. Wiegreffe, U\. Alon, N\. Dziri, S\. Prabhumoye, Y\. Yang,et al\.Self\-refine: iterative refinement with self\-feedback\.Advances in neural information processing systems36,pp\.46534–46594\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.12.1.1)\.
- Onget al\.\(2024\)I\. Ong, A\. Almahairi, V\. Wu, W\. Chiang, T\. Wu, J\. E\. Gonzalez, M\. W\. Kadous, and I\. StoicaRoutellm: learning to route llms with preference data\.arXiv preprint arXiv:2406\.18665\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p3.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Patelet al\.\(2024\)L\. Patel, S\. Jha, M\. Pan, H\. Gupta, P\. Asawa, C\. Guestrin, and M\. ZahariaSemantic operators: a declarative model for rich, ai\-based data processing\.arXiv preprint arXiv:2407\.11418\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.4.1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Qiet al\.\(2026\)K\. Qi, D\. Xie, W\. Li, H\. Zhang, Y\. Zhu, J\. X\. Yu, and K\. ZhaoSema: a high\-performance system for llm\-based semantic query processing\.arXiv preprint arXiv:2603\.11622\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Rubinstein \(1999\)R\. RubinsteinThe cross\-entropy method for combinatorial and continuous optimization\.Methodology and computing in applied probability1\(2\),pp\.127–190\.Cited by:[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
- Selingeret al\.\(1979\)P\. G\. Selinger, M\. M\. Astrahan, D\. D\. Chamberlin, R\. A\. Lorie, and T\. G\. PriceAccess path selection in a relational database management system\.InProceedings of the 1979 ACM SIGMOD international conference on Management of data,pp\.23–34\.Cited by:[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Shankaret al\.\(2024\)S\. Shankar, T\. Chambers, T\. Shah, A\. G\. Parameswaran, and E\. WuDocetl: agentic query rewriting and evaluation for complex document processing\.arXiv preprint arXiv:2410\.12189\.Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.6.1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Snowflake \(2025\)SnowflakeSnowflake Cortex AISQL \(ai functions\)\.Note:Snowflake Documentation[https://docs\.snowflake\.com/en/user\-guide/snowflake\-cortex/aisql](https://docs.snowflake.com/en/user-guide/snowflake-cortex/aisql)Cited by:[§J\.1](https://arxiv.org/html/2608.20630#A10.SS1.p1.1),[§1](https://arxiv.org/html/2608.20630#S1.p1.1),[Table 2](https://arxiv.org/html/2608.20630#S2.T2.3.1.3.1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px1.p1.1)\.
- Stepanovet al\.\(2025\)I\. Stepanov, M\. Shtopko, D\. Vodianytskyi, O\. Lukashov, A\. Yavorskyi, and M\. YaroshenkoGLiClass: generalist lightweight model for sequence classification tasks\.arXiv preprint arXiv:2508\.07662\.Cited by:[§3\.4](https://arxiv.org/html/2608.20630#S3.SS4.SSS0.Px2.p1.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Suet al\.\(2025\)H\. Su, H\. Yen, M\. Xia, W\. Shi, N\. Muennighoff, H\. Wang, L\. Haisu, Q\. Shi, Z\. Siegel, M\. Tang,et al\.Bright: a realistic and challenging benchmark for reasoning\-intensive retrieval\.InInternational Conference on Learning Representations,Vol\.2025,pp\.48941–48991\.Cited by:[§1](https://arxiv.org/html/2608.20630#S1.p6.1),[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Vamvas and Sennrich \(2020\)J\. Vamvas and R\. SennrichX\-stance: a multilingual multi\-target dataset for stance detection\.arXiv preprint arXiv:2003\.08385\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Waddenet al\.\(2020\)D\. Wadden, S\. Lin, K\. Lo, L\. L\. Wang, M\. van Zuylen, A\. Cohan, and H\. HajishirziFact or fiction: verifying scientific claims\.InProceedings of the 2020 Conference on Empirical Methods in Natural Language Processing \(EMNLP\),pp\.7534–7550\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1)\.
- Zeighamiet al\.\(2025\)S\. Zeighami, S\. Shankar, and A\. ParameswaranFeaturized\-decomposition join: low\-cost semantic joins with guarantees\.arXiv preprint arXiv:2512\.05399\.Cited by:[§5](https://arxiv.org/html/2608.20630#S5.SS0.SSS0.Px1.p1.1),[§6](https://arxiv.org/html/2608.20630#S6.SS0.SSS0.Px2.p1.1)\.
## Contents of the Technical Appendix
[A](https://arxiv.org/html/2608.20630#A1)Recipe\-card compiler and routing reliability\.[A](https://arxiv.org/html/2608.20630#A1)
[B](https://arxiv.org/html/2608.20630#A2)Zero\-shot front\-end comparison\.[B](https://arxiv.org/html/2608.20630#A2)
[C](https://arxiv.org/html/2608.20630#A3)Confidence signal and escalation\.[C](https://arxiv.org/html/2608.20630#A3)
[D](https://arxiv.org/html/2608.20630#A4)Threshold sensitivity\.[D](https://arxiv.org/html/2608.20630#A4)
[E](https://arxiv.org/html/2608.20630#A5)Bandit proposer\.[E](https://arxiv.org/html/2608.20630#A5)
[F](https://arxiv.org/html/2608.20630#A6)Proposer replay evaluation\.[F](https://arxiv.org/html/2608.20630#A6)
[G](https://arxiv.org/html/2608.20630#A7)Outer\-join correctness and dangling rows\.[G](https://arxiv.org/html/2608.20630#A7)
[H](https://arxiv.org/html/2608.20630#A8)Prompt templates\.[H](https://arxiv.org/html/2608.20630#A8)
[I](https://arxiv.org/html/2608.20630#A9)Detailed Experiment Setup\.[I](https://arxiv.org/html/2608.20630#A9)
## Appendix ARecipe\-Card Compiler and Routing Reliability
Figure[5](https://arxiv.org/html/2608.20630#S3.F5)in the main paper illustrates the recipe\-card compiler\. For a predicate and a smallLIMIT\-style sample of at most five candidate pairs, the compiler returns the fields used by the planner: predicate type, featurizer, labels, entity labels, and comparison direction\. Appendix[H](https://arxiv.org/html/2608.20630#A8)reproduces the corresponding prompt strings\.
Because one generated card controls the route for the full join, we test both structural validity and robustness to changes in the sampled rows\. Table[7](https://arxiv.org/html/2608.20630#A1.T7)reports reference\-free format checks and a sample\-shift evaluation in which the predicate is held fixed while sampled rows are perturbed\. The conditional “semantic correct if parseable” metric evaluates semantic routing only among successfully parsed cards; parse failures remain a separate failure mode\.
Table 7:Validation of the recipe\-card compiler\. Conditional metrics use only the subset identified in the metric name\.#### Route\-type intervention\.
Syntactic validity alone does not establish that the selected execution family is semantically appropriate\. Table[8](https://arxiv.org/html/2608.20630#A1.T8)therefore changes the route while holding the evaluated query and data fixed\. Removing membership factorization onSemBenchincreases cost, flipping sentiment direction changes the pair decisions, and removing the relational route on FewRel sharply reduces F1\. On BRIGHT, substituting the relational route for the reasoning route reduces F1 and increases cost on the evaluated query\. Because the route is fixed by the card and is not part of the raced configuration \(Appendix[E](https://arxiv.org/html/2608.20630#A5)\), these interventions are the only evidence we report on route choice\.
Table 8:Route interventions on fixed diagnostic queries, not reruns of Table[3](https://arxiv.org/html/2608.20630#S4.T3)\. The table isolates the effect of replacing or removing the route selected for each predicate\.
#### Compound\-predicate intervention\.
Table[9](https://arxiv.org/html/2608.20630#A1.T9)separately studies a conjunction of a cheap candidate\-generation condition and a semantic residual condition\. Removing either condition changes the target predicate\. Removing the semantic condition admits false positives; removing the cheap condition preserves more matches but eliminates pruning\. Executing the whole conjunction pairwise recovers the result of the decomposed plan at a higher pairwise\-call count\.
Table 9:Compound\-predicate intervention\. The valid target is the conjunction in the first two rows\. The last two rows intentionally remove one condition and therefore evaluate a different predicate\.
### A\.1 Probe\-Set Sensitivity of Recipe\-Card Generation
We evaluate whether the size of the probe set affects recipe\-card generation\. For each workload, we fix the join predicate and vary only the sampled row pairs provided to the recipe\-card compiler\. We consider probe sets ofn∈\{1,2,3,5\}n\\in\\\{1,2,3,5\\\}row pairs and independently sample eight probe sets for each workload and size\.
We compare recipe cards using their structural signature—operator type, featurizer, and direction—while ignoring wording differences that do not change execution\. Agreement is the fraction of compilations whose structural signature matches the workload’s modal five\-pair recipe card\. Correspondingly,1−agreement1\-\\text\{agreement\}measures probe\-induced structural variance\.
Figure[13](https://arxiv.org/html/2608.20630#A1.F13)shows that SemBench and BRIGHT are stable even with one pair\. FewRel is sensitive to small probe sets, but its agreement increases from62\.5%62\.5\\%to100%100\\%at five pairs\. Confounded predicates improve from75\.0%75\.0\\%to91\.7%91\.7\\%\. Thus, recipe\-card variance largely converges by five probe pairs: it disappears for SemBench, FewRel, and BRIGHT, with only8\.3%8\.3\\%residual disagreement on the Confounded workloads\. We therefore use five row pairs as the default probe\-set size\.
Figure 13:Recipe\-card stability as the probe\-set size increases\. Agreement measures the fraction of generated cards matching the workload’s modal five\-pair structural recipe card\. Small probe sets introduce structural noise for FewRel and Confounded predicates, while the generated recipes largely converge by five row pairs\.
## Appendix BZero\-Shot Front\-End Comparison
Table[10](https://arxiv.org/html/2608.20630#A2.T10)comparesGLiRELandGLiClasson hard, balanced pair sets\. The comparison is a component diagnostic: it measures how well each zero\-shot encoder ranks positive and negative pairs under the reported setup\. It does not by itself specify the runtime assignment of front\-end models\.
Table 10:GLiRELversusGLiClasson balanced 100\-pair diagnostic sets\. Values are AUROC\.Table[11](https://arxiv.org/html/2608.20630#A2.T11)provides a second diagnostic on the opposite\-sentiment join\. Accuracy is not monotone in parameter count on this task, so the cascade’s two tiersMsM\_\{s\}andMℓM\_\{\\ell\}were chosen empirically from this measurement rather than by size\. That choice is made once, offline, and holds for every join: the model pair is not part of the configurationaathat the race searches \(Appendix[E](https://arxiv.org/html/2608.20630#A5)\)\.
Table 11:Per\-model accuracy on the evaluated SemBench opposite\-sentiment join\.
## Appendix CConfidence Signal and Escalation
The cascade escalates inputs for which the small\-model confidence is low\. Figure[14](https://arxiv.org/html/2608.20630#A3.F14)compares mean log\-probability with theTokenSARscore on the same diagnostic sample\.TokenSARis reported as a relevance\-weighted uncertainty in its original formulation[13](https://arxiv.org/html/2608.20630#bib.bib19); we plot its negation so that both panels read as confidence, larger being more trusted\. The plotted distributions show stronger separation forTokenSARin this sample; the figure is a diagnostic of the confidence ordering rather than a universal calibration claim\.
Figure 14:Per\-pair confidence under mean log\-probability \(left\) andTokenSAR\(right\) on the evaluated diagnostic sample\. Green and red denote correct and incorrect small\-model answers\.Figure[15](https://arxiv.org/html/2608.20630#A3.F15)evaluates the ordering induced by confidence against randomly selecting the same number of escalations\. On the opposite\-sentiment join, the confidence\-ordered curve reaches the large\-model reference after escalating about40%40\\%of pairs\.
Figure 15:Confidence\-ordered escalation \(red\) versus random escalation \(grey\) on the evaluated opposite\-sentiment join\. The dashed line is the large\-model reference\.The saturation point differs across evaluated predicates, motivating per\-query selection of the escalation threshold rather than one global threshold\.
## Appendix DThreshold Sensitivity
We study the local sensitivity ofAI\_JOINto the two cascade thresholds, writtenτ1\\tau\_\{1\}andτ2\\tau\_\{2\}below \(τ1=τf\\tau\_\{1\}\{=\}\\tau\_\{f\}andτ2=τe\\tau\_\{2\}\{=\}\\tau\_\{e\}in the main text\)\. Figure[7](https://arxiv.org/html/2608.20630#S4.F7)shows representative membership and reasoning surfaces in the main text; Figure[16](https://arxiv.org/html/2608.20630#A4.F16)reports all five workloads\. The arrows show the configurations visited from the default to the selected setting\.
\(a\) SemBench Q5\(b\) SemBench Q6\(c\) SemBench Q7\(d\) FewRel\(e\) BRIGHTFigure 16:AI\-Jointhreshold sensitivity on the five evaluated workloads\. Each heatmap shows the local F1 surface over the searched\(τ1,τ2\)\(\\tau\_\{1\},\\tau\_\{2\}\)region\.
## Appendix EBandit Proposer
Algorithm[1](https://arxiv.org/html/2608.20630#alg1)summarizes the per\-query proposer and race\. The recipe card fixes the route and cascade tiers before racing\. The proposer selects a slate of at mostKKuntested configurations, which are evaluated in rounds on the same probe\. After each round, iRace removes statistically inferior or infeasible configurations\. If none survives, the observations update the posterior and another slate is generated\. This continues until a feasible configuration is found or the action space is exhausted\.
Algorithm 1Per\-query slate proposal and racing forAI\_JOIN\(Section[4](https://arxiv.org/html/2608.20630#S4)\)0:Query
qqwith context
xqx\_\{q\}; action space
𝒜\\mathcal\{A\}; budgets
\(BC,BL\)\(B\_\{C\},B\_\{L\}\); probe size
nn; slate size
KK; history
ℋ\\mathcal\{H\}
0:Selected configuration
a^q\\widehat\{a\}\_\{q\}orInfeasible
1:
\{Pq\(t\)\}t=1T←ProbeRounds\(q,n\)\\\{P\_\{q\}^\{\(t\)\}\\\}\_\{t=1\}^\{T\}\\leftarrow\\textsc\{ProbeRounds\}\(q,n\)
2:
𝒜qrem←𝒜\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}\\leftarrow\\mathcal\{A\};
ℱq←∅\\mathcal\{F\}\_\{q\}\\leftarrow\\emptyset
3:repeat
4:
k←min\(K,\|𝒜qrem\|\)k\\leftarrow\\min\(K,\|\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}\|\)
5:if
ℋ\\mathcal\{H\}insufficientthen
6:
Sq←UniformSlate\(𝒜qrem,k\)S\_\{q\}\\leftarrow\\textsc\{UniformSlate\}\(\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\},k\)
7:else
8:
r~\(a\)∼p\(r\(a,xq\)∣ℋ\)\\widetilde\{r\}\(a\)\\sim p\(r\(a,x\_\{q\}\)\\mid\\mathcal\{H\}\)for
a∈𝒜qrema\\in\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}
9:
Sq←TopK\(𝒜qrem,r~,k\)S\_\{q\}\\leftarrow\\textsc\{TopK\}\(\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\},\\widetilde\{r\},k\)
10:endif
11:
ℛq←Sq\\mathcal\{R\}\_\{q\}\\leftarrow S\_\{q\}
12:for
t=1,…,Tt=1,\\ldots,Tdo
13:foreach
a∈ℛqa\\in\\mathcal\{R\}\_\{q\}do
14:run
aaon
Pq\(t\)P\_\{q\}^\{\(t\)\}and update
Q^q\(a\),C^q\(a\),L^q\(a\)\\widehat\{Q\}\_\{q\}\(a\),\\widehat\{C\}\_\{q\}\(a\),\\widehat\{L\}\_\{q\}\(a\)
15:endfor
16:
ℛq←\{a∈ℛq:C^q\(a\)≤BC,L^q\(a\)≤BL\}\\mathcal\{R\}\_\{q\}\\leftarrow\\\{a\\in\\mathcal\{R\}\_\{q\}:\\widehat\{C\}\_\{q\}\(a\)\\leq B\_\{C\},\\widehat\{L\}\_\{q\}\(a\)\\leq B\_\{L\}\\\}
17:
ℛq←iRaceEliminate\(ℛq,Pq\(1:t\)\)\\mathcal\{R\}\_\{q\}\\leftarrow\\textsc\{iRaceEliminate\}\(\\mathcal\{R\}\_\{q\},P\_\{q\}^\{\(1:t\)\}\)
18:if
\|ℛq\|≤1\|\\mathcal\{R\}\_\{q\}\|\\leq 1then
19:break
20:endif
21:endfor
22:foreach evaluated
a∈Sqa\\in S\_\{q\}do
23:
r\(a,xq\)←Q^q\(a\)𝟏\[C^q\(a\)≤BC\]𝟏\[L^q\(a\)≤BL\]r\(a,x\_\{q\}\)\\leftarrow\\widehat\{Q\}\_\{q\}\(a\)\\mathbf\{1\}\[\\widehat\{C\}\_\{q\}\(a\)\\leq B\_\{C\}\]\\mathbf\{1\}\[\\widehat\{L\}\_\{q\}\(a\)\\leq B\_\{L\}\]
24:endfor
25:append
\{\(xq,a,r\(a,xq\)\)\}a∈Sq\\\{\(x\_\{q\},a,r\(a,x\_\{q\}\)\)\\\}\_\{a\\in S\_\{q\}\}to
ℋ\\mathcal\{H\}; refit the posterior
26:
ℱq←ℛq\\mathcal\{F\}\_\{q\}\\leftarrow\\mathcal\{R\}\_\{q\}
27:
𝒜qrem←𝒜qrem∖Sq\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}\\leftarrow\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}\\setminus S\_\{q\}
28:until
ℱq≠∅\\mathcal\{F\}\_\{q\}\\neq\\emptysetor
𝒜qrem=∅\\mathcal\{A\}\_\{q\}^\{\\mathrm\{rem\}\}=\\emptyset
29:if
ℱq=∅\\mathcal\{F\}\_\{q\}=\\emptysetthen
30:returnInfeasible
31:endif
32:
a^q←argmaxa∈ℱqQ^q\(a\)\\widehat\{a\}\_\{q\}\\leftarrow\\argmax\_\{a\\in\\mathcal\{F\}\_\{q\}\}\\widehat\{Q\}\_\{q\}\(a\)
33:execute the remaining
N−nN\-npairs with
a^q\\widehat\{a\}\_\{q\}
34:return
a^q\\widehat\{a\}\_\{q\}
## Appendix FProposer Replay Evaluation
The proposer is evaluated by replay, separating slate composition from the final proxy\-based choice\. We sample4040queries from each of four workload families, giving160160replay queries\. For each query, all9696configurations in𝒜\\mathcal\{A\}are executed, which supplies an observed oracle configuration for the replay analysis\. A slate is counted as a hit when it contains a configuration satisfying the near\-oracle criterion in Eq\.[12](https://arxiv.org/html/2608.20630#S4.E12)\. Curves report the mean over2020random seeds\.
Figure 17:Proposer replay evaluation \(mean and band over2020seeds\): \(a\) warm\-history and cold\-reset streams; \(b\) incumbent quality against measured probe cost; and \(c\) a controlled stress test that changes the fraction of low\-quality configurations in the pool\.Figure[17](https://arxiv.org/html/2608.20630#A6.F17)reports three views of the replay\. Panel \(a\) compares a history accumulated along the query stream with a cold reset\. Panel \(b\) charges each strategy the measured cost of the probes it requests\. Panel \(c\) varies the fraction of low\-quality configurations in the replay pool\. These results evaluate the specified replay stream; they do not assume that an identical history is available for a new deployment domain\.
## Appendix GOuter\-Join Correctness and Dangling Rows
This section checks the structural behavior of the outer\-join execution path\. ALEFT JOINmust preserve each left row for which no qualifying partner is returned\.
#### Evaluation setup\.
We use a selective predicate based on a whole\-number Pitchfork\-style score \(0–10\) inferred from review prose[4](https://arxiv.org/html/2608.20630#bib.bib30)\. The right table contains only scores\{7,8\}\\\{7,8\\\}\. Under the deterministic evaluation labels, 15 of 40 left rows are dangling; the two tables produce 240 candidate pairs\.
SELECTa\.\*,b\.\*
FROMtableA\_lefta
LEFTJOINtableB\_rightb
ONai\_join\(a\.review,b\.review,
’tworeviewsearnthesame
whole\-numberPitchforkscore\(0\-10\)’\);
#### Results\.
Table[12](https://arxiv.org/html/2608.20630#A7.T12)reports one run\. Dangling recall measures whether the execution path preserves unmatched left rows; dangling F1 and inner F1 additionally depend on the pairwise semantic decisions\.
Table 12:Standalone outer\-join diagnostic on the selective Pitchfork\-score predicate; these values are not part of the main benchmark tables\. Gold dangling rows: 15 of 40; one indicative run\.
#### Scope\.
This experiment checks outer\-join structure on a small controlled input; it is not used as a general quality benchmark\. Gold labels are defined for the left\-side dangling\-row evaluation\.
## Appendix HPrompt Templates and Runtime Assignment
### H\.1 Recipe\-card prompts
Card 1\.Recipe\-cardsystemprompt
CompileaSQLAI\_JOINpredicateintoanexecutionrecipe\.ReturnSTRICTJSONonlywith:
"type":"per\_side","joint",or"reasoning"\.
"featurizer":"gliclass","gliner","numeric","embed",or"glirel"\.
"labels":alistofclassorrelationlabels\.
"entity\_labels":entitytypesforGLiNER;otherwise\[\]\.
"direction":"same","opposite","similar",or"none"\.
Routing:
\-"per\_side":eachrowindependentlyyieldsavaluethatisthencompared\.Use"gliclass"forclosedattributes,"gliner"forentityspans,"numeric"fornumbers,and"embed"forgradedsimilarity\.
\-"joint":AandBmustbescoredtogether,withoutmulti\-hoporexternalknowledge\.Use"glirel"\.
\-"reasoning":thedecisionrequiresevidencecomposition,multi\-hopinference,orexternalknowledge\.Use"glirel"onlyasahigh\-confidencenegativefilter;thegenerativecascadedecidestherest\.
For"gliclass",providemutuallyexclusiveper\-rowlabels\.For"glirel",providetwoself\-descriptiverelationlabels,withthepositivelabelfirst\.Leave"labels"emptyfor"gliner","numeric",and"embed"\.Use"direction"onlyfor"per\_side";otherwiseuse"none"\.
Examples:
"thetworeviewsexpressoppositesentiment"\-\>
\{"type":"per\_side","featurizer":"gliclass","labels":\["positive","negative"\],"entity\_labels":\[\],"direction":"opposite"\}
"bothmentionthesamecompany"\-\>
\{"type":"per\_side","featurizer":"gliner","labels":\[\],"entity\_labels":\["company"\],"direction":"same"\}
"thetwoentitiesarespouses"\-\>
\{"type":"joint","featurizer":"glirel","labels":\["thetwoentitiesarespouses","thetwoentitiesarenotspouses"\],"entity\_labels":\[\],"direction":"none"\}
"thedruginAiscontraindicatedfortheconditioninB"\-\>
\{"type":"reasoning","featurizer":"glirel","labels":\["thedrugiscontraindicatedforthecondition","thedrugisnotcontraindicatedforthecondition"\],"entity\_labels":\[\],"direction":"none"\}
Card 2\.Recipe\-carduserprompt
Predicate:<predicate\>
Example\(A,B\)rowpairs:
A:<leftrow1\>\|B:<rightrow1\>
\.\.\.\(upto5pairs\)\.\.\.
ReturntheJSONrecipe\.
Card 3\.Row\-labelinguserprompt
Instruction:<attr\_instruction\>
Allowedlabels:<label1\>,<label2\>\[,<label3\>\]
Text:"""<rowtext\>"""
Returnexactlyoneallowedlabel\.Ifnolabelapplies,returnnone\.
Card 4\.Closed\-labelclassification prompt
Forthepredicate"<predicate\>",classifythevalueintoexactlyonelabelfromtheclosedlabelset\.Ifnolabelapplies,returnnone\.Ifthevalueisitselfoneofthelabels,returnthatexactlabel\.Returnonlytheselectedlabelornone\.
Card 5\.Concisemodel\-role system prompt
Followthesuppliedtaskinstructioncarefully\.Maketherequesteddecisionusingonlytheprovidedinput\.Followtheselectedoutput\-modecardexactly\.
Card 6\.Authoritativemodel\-role system prompt
Actastheauthoritativeverifierforthesuppliedtask\.Resolveambiguityusingthepredicateandtheprovidedevidence,andproducethemostaccuratedecisionpossible\.Followtheselectedoutput\-modecardexactly\.
Card 7\.Strictpair\-judging task prompt
DecidewhetherthestatedrelationshipholdsbetweentheLeftitemandtheRightitem\.Treatthepredicateliterally\.Thedecisionistrueonlyiftherelationshipclearlyholdsforthisspecificpair;otherwiseitisfalse\.Donotbelenientorspeculative\.
Card 8\.Paraphrase\-awarepair\-judging task prompt
DecidewhetherthestatedrelationshipholdsbetweentheLeftitemandtheRightitem\.Accountforabbreviations,synonyms,andparaphrases,butdonotaddunsupportedfacts\.Thedecisionistrueonlyiftherelationshipclearlyholdsforthisspecificpair;otherwiseitisfalse\.
Card 9\.Pair\-judginguserprompt
Left:<leftrow\>
Right:<rightrow\>
Relationshiptotest:<predicate\>
InterpretthisrelationshiponlywithrespecttothesuppliedLeft\-Rightpair\.Determinewhetheritholds\.
Card 10\.Direct Booleanoutput mode
===OUTPUTMODE:DIRECTBOOLEAN===
Respondwithexactlyonelowercaseword:trueorfalse\.
Donotincludequotes,punctuation,explanation,oranyothertext\.
Card 11\.Reasoned Booleanoutput mode
===OUTPUTMODE:REASONEDBOOLEAN===
Giveaconcise,task\-relevantrationaleinatmostthreeshortsentences\.Thenwriteexactlyonefinallineinoneofthesetwoforms:
Answer:true
Answer:false
Writenothingafterthefinalanswerline\.
## Appendix IDetailed Experimental Setup
#### Cross\-primitive suite\.
Table[3](https://arxiv.org/html/2608.20630#S4.T3)additionally reports SemBench Q1–Q4 and Q8–Q10 plus Multi\-XScience\. These workloads follow their standard task definitions and the quality metrics stated in the table caption\. The remainder of this section documents the current repeated\-run join experiments, including the compound workloads in Table[4](https://arxiv.org/html/2608.20630#S5.T4)\.
#### Metrics and provenance\.
The full\-suite quality scores are scaled to\[0,1\]\[0,1\]: precision@5 for Q1–Q2,max\(0,1−relative error\)\\max\(0,1\-\\text\{relative error\}\)for Q3, Q4, and Q8,\(ρ\+1\)/2\(\\rho\+1\)/2for the Spearman coefficientρ\\rhoon Q9–Q10, and ROUGE\-1 for Multi\-XScience\. The full\-suiteSAGEexecution traces identifygranite\-3\.3\-8b\-instruct[17](https://arxiv.org/html/2608.20630#bib.bib33)andgpt\-oss\-120b[1](https://arxiv.org/html/2608.20630#bib.bib28); external systems use their native execution configurations, and their token usage is priced with one shared LiteLLM schedule[3](https://arxiv.org/html/2608.20630#bib.bib34)\. For Q5–Q7, FewRel, and BRIGHT, Table[3](https://arxiv.org/html/2608.20630#S4.T3)replaces the earlier point estimates with the current AI\-Join repeated\-run means described below\. Within each workload column, methods therefore share inputs and pricing; the SemBench Summary aggregates the displayed cross\-primitive columns\.
Table[13](https://arxiv.org/html/2608.20630#A9.T13)summarizes the evaluated predicates and whether aLimitclause restricts the candidate set\.
JoinPredicateLimitSemBench\(Movie\)Q5*same sentiment*YesQ6*opposite sentiment*YesQ7*opposite sentiment*NoFewRel*the two entities are spouses*NoBRIGHT*the document supports answering the query*NoAmazon–Google*same product family*∧\\wedge*same underlying product*Nox\-stance*same question*∧\\wedge*opposite stances*NoSciFact*same topic*∧\\wedge*citable evidence*NoTable 13:Evaluated join workloads\.
#### Execution settings\.
For every current join column, all systems evaluate the same candidate pairs under the same OpenRouter price schedule\. The cascade usesGranite\-3\.0\-8Bas the small model andgpt\-oss\-120bas the large model\. The 96 configurations combineτf∈\{0\.05,0\.10,0\.15,0\.20\}\\tau\_\{f\}\\in\\\{0\.05,0\.10,0\.15,0\.20\\\},τe∈\{0\.70,0\.80,0\.85,0\.90\}\\tau\_\{e\}\\in\\\{0\.70,0\.80,0\.85,0\.90\\\}, reasoning on/off, andT∈\{0,0\.2,0\.5\}T\\in\\\{0,0\.2,0\.5\\\}\. Each race evaluatesK=3K=3configurations on the same uniform probe ofn=min\(50,N\)n=\\min\(50,N\)pairs\. Probe cost and latency are scaled linearly to the full candidate set and include recipe generation, racing, and judging\.
#### Proposal and selection\.
We use a Bayesian linear Thompson sampler over Granite predicate representations and recipe\-card classes\. History is initialized with uniform slates and updated with the three observations from each query\. The fixedgpt\-oss\-120bjudge, run at temperature zero and blinded to configuration identity, assigns each candidate its mean probability of correctness\. Default query budgets are $0\.030\.03and240240seconds; if no candidate is feasible, the query reports a budget violation\. Proposer evaluation usesK=3K=3andϵ=0\.05\\epsilon=0\.05\.
## Appendix JPrimitive\-Core Coverage and Decomposability
This bundle backs the claim that three primitives suffice: the audited map from public operator surfaces onto the primitives, the decomposition of semantic intents by composition depth, and the limits of MapReduce factorization per operator class\.
### J\.1 Audited Operator\-to\-Primitive Map
We audited public semantic\-query APIs—LOTUS[29](https://arxiv.org/html/2608.20630#bib.bib1), Palimpzest[23](https://arxiv.org/html/2608.20630#bib.bib4), ThalamusDB[18](https://arxiv.org/html/2608.20630#bib.bib11), DocETL[33](https://arxiv.org/html/2608.20630#bib.bib6), FlockMTL[12](https://arxiv.org/html/2608.20630#bib.bib7), SUQL[24](https://arxiv.org/html/2608.20630#bib.bib9), UQE[9](https://arxiv.org/html/2608.20630#bib.bib10), an agentic refine\-until\-stable loop[27](https://arxiv.org/html/2608.20630#bib.bib12), and the Databricks[10](https://arxiv.org/html/2608.20630#bib.bib13), Snowflake Cortex[34](https://arxiv.org/html/2608.20630#bib.bib14), and BigQuery[14](https://arxiv.org/html/2608.20630#bib.bib15)AI\-SQL function suites—and mapped each exposed operator to the primitive whose documented input\-output shape it implements\. The audit used five annotators and reached high agreement \(Fleiss’κ=0\.933\\kappa=0\.933\)\. Two boundary rules matter\. First, similarity, search, retrieval, vector search, and reranking are counted asAI\_JOINwhen they expose a hidden pair predicate such as “is this row relevant to the query?” Second, raw embedding construction is not a query\-level semantic primitive: it is an index or blocking mechanism and is therefore marked non\-semantic \(NS\), notAI\_SCALAR\.
Table 14:Exact operator\-level map, part 1\.Table 15:Exact operator\-level map, part 2\.Table 16:Exact operator\-level map, part 3\.
### J\.2 Intent Decomposition by Depth
A semantic\-query intent is a relational query whose values or predicates appeal to the meaning of text\. Within the stated single\-pass scope, every model invocation has one of three signatures, and each of the 37 audited intents decomposes into a finite plan over them:ai\_scalarfor a per\-tuple judgment \(→11\\\!\\rightarrow\\\!1\),ai\_aggfor a per\-group reduction \(N→GN\\\!\\rightarrow\\\!G\), andai\_joinfor a per\-pair match \(N×M→pairsN\\\!\\times\\\!M\\\!\\rightarrow\\\!\\text\{pairs\}\)\. Broader verbs reduce to them: a whole\-relation judgment isai\_aggover the trivial group; search, top\-kk, and similarity areai\_joinunder a synthesized relevance predicate; deduplication is pairwiseai\_joinfollowed by relational component construction; and ranking uses either anai\_scalarkey or query\-dependentai\_joinrelevance followed by ordinary sorting\. Tables[17](https://arxiv.org/html/2608.20630#A10.T17)to[19](https://arxiv.org/html/2608.20630#A10.T19)enumerate the audited intents: the longest chain has depth three, and most intents sit at depth one or two\.
Table 17:Depth\-1 intent decompositions\. Retrieval and similarity \(R01, R02\) are the one\-sided or pairwiseAI\_JOINunder a synthesized predicate; there is no embedding operator\.Table 18:Depth\-2 intent decompositions\.Table 19:Depth\-3 intent decompositions\.
### J\.3 MapReduce Decomposability
Not every operator class factorizes\. Table[20](https://arxiv.org/html/2608.20630#A10.T20)classifies which plans admit an exact MapReduce decomposition and at what predicate cost\. This table states algebraic execution conditions independently of the measurements in Table[3](https://arxiv.org/html/2608.20630#S4.T3)\. Modular aggregation and membership joins factorize exactly, and membership joins additionally drop predicate cost toN\+MN\\\!\+\\\!Mvia per\-row keys\. Holistic aggregation has no exact factorization without an application\-supplied merge contract\. Relational and reasoning joins are MapReduce\-executable but not work\-reducing, since their predicates read both rows jointly and the fullN×MN\\\!\\times\\\!Mgrid must still be evaluated\.
Table 20:MapReduce decomposability by operator class\. For joins, exact MapReduce tiles the fullN×MN\\\!\\times\\\!Mpair grid and unions positive pairs\. Predicate cost is the number of AI predicate evaluations required by the cheapest exact decomposition\.ClassExample predicateMap \(per\-chunk\)ReduceExact?CostModular aggcount positive, mean,min/maxbounded partial stateadd / extremum / tally\\checkmarkNNHolistic aggmedian, top\-kkthemes, summarynaive partial answerpartition\-dependent merge×\\times—Membership joinsame category / sentimentper\-item key labelhash\-join on key\\checkmarkN\+MN\\\!\+\\\!MRelational joinR\(head,tail\)R\(\\text\{head\},\\text\{tail\}\)pair\-tile evaluationunion positive pairs\\checkmarkN×MN\\\!\\times\\\!MReasoning joindocument answers querypair\-tile evaluationunion positive pairs\\checkmarkN×MN\\\!\\times\\\!M#### Optimizer consequences\.
The primitive label alone is not an optimization license\. ForAI\_AGG, the optimizer may push partial aggregation into partitions only when the user\-visible result is induced by a bounded mergeable state; otherwise it must preserve the group as the semantic unit\. ForAI\_JOIN, distributed tiling is always an exact execution strategy, but it reduces model work only when the predicate first compiles to independent row keys\. Thus “MapReduce\-executable” and “model\-call reducing” are distinct properties\.
This distinction also determines which physical choices may be raced\. Chunk size, batching, and worker placement are safe alternatives for every primitive because they preserve the logical input unit\. Partial\-state schemas forAI\_AGGand per\-side key extractors forAI\_JOINare conditional rewrites: they enter the candidate set only after the recipe proves the corresponding decomposition\. The three\-primitive formulation therefore narrows the optimizer’s search space without pretending that every surface AI function has the same factorization law\.Similar Articles
SAGE: A Statistical Acceptance Gate for Self-Evolving Agents
The paper introduces SAGE, a statistical acceptance gate for LLM agents that self-evolve by editing persistent skill documents, using per-item paired comparisons and a one-sided paired test to prevent regressions and avoid the Optimizer's Curse, achieving lower regression rates and higher scores across five benchmarks and four backbone LLMs.
SAGE: Mitigating Long-Horizon Reasoning Biases via Topological Guidance
SAGE is a framework that mitigates exploration and compounding biases in long-horizon reasoning for large language models through algebraic sparsification and hyperbolic structural guidance, achieving significant improvements across benchmarks.
SAAG: A Practical Methodology for Deciding Where AI Actually Fits
SAAG (Simplify, Automate, Agentify, Guard) is a practical methodology for deciding where AI fits in a business, emphasizing simplification before automation and agentification, with guardrails for risk mitigation.
Sage-A1.5: From Long-Horizon Execution to Scientific Exploration with Capability Composition
Sage-A1.5 is a 35B mixture-of-experts agentic model that advances long-horizon problem solving through adaptive capability composition, featuring agentic orchestration with subagent delegation, reflective verification, and open exploratory scientific discovery.
SAGEAgent: A Self-Evolving Agent for Cost-Aware Modality Acquisition in Multimodal Survival Prediction
SAGEAgent is an LLM-based clinical agent that sequentially decides which diagnostic modalities to acquire for cancer patients to balance predictive accuracy with clinical invasiveness, reducing acquisition burden by 55% while maintaining competitive survival prediction performance.