Manuscript Offprint
arXiv:2610.28551NousDB - A Fast Query Engine for Semantic Analytics
Christos Tsapelas
Department of Informatics and
Telecommunications, National and
Kapodistrian University of Athens
Archimedes, Athena Research Center
Athens, Greece
Georgia Koutrika
Archimedes, Athena Research Center
Athens, Greece
Yannis Ioannidis
Department of Informatics and
Telecommunications, National and
Kapodistrian University of Athens
Archimedes, Athena Research Center
Athens, Greece
Abstract
Semantic data analytics systems integrate AI-powered operators into query pipelines, enabling declarative queries over structured and unstructured data. However, existing systems rely on per-tuple model invocations, ad hoc operator designs, and lack principled cost models, resulting in poor scalability and limited optimization. We present NousDB, a high-performance semantic analytics engine built on Apache DataFusion[22]. Through NousDB we propose an extended relational algebra with three semantic operators and formal algebraic properties that enable principled query rewriting and cross-operator optimization. We further propose a token-based cost model using equi-depth token histograms to optimize batch sizing under context-window constraints and provide statistical guarantees for safe batching. Experiments show that NousDB achieves up to ×86 speedups with both local and enterprise LLMs, while leading competitors in token efficiency and accuracy. These gains extend to complex JOB and Stack workloads augmented with semantic operators, supporting both traditional and semantic analytics.
1 Introduction
Foundation models [2, 33, 45] have showcased strong capabilities in processing unstructured data, such as language and images. This new form of data processing has given rise to semantic query engines (SQEs), which treat models as query operators and allow users to filter, join, extract information from, and summarize textual content in combination with conventional relational operations. However, they challenge several fundamental assumptions underlying database systems, including operator semantics, cost estimation, and parallel execution, among others.
Motivating example. Consider the query “which actors are mentioned in movie reviews?” over the IMDB schema extended with a relation of reviews. Figure 1 shows this query, denoted Q11 in our evaluation, expressed in NousDB. Its natural execution plan first extends each review with the actors mentioned in its text, join the result with the name relation on whether the extracted mention and a person’s name refer to the same actor, and projects the review, movie title and actor name. A naive execution invokes the model once per review for extraction and once per review-name pair for matching, with each invocation processing only one tuple or tuple pair. Avoiding this costly tuple-at-a-time execution requires the planner to reason about semantic operators, for which existing SQEs provide insufficient foundations. Using this query as a running example, we next identify the following problems.
// Q11: which actors are mentioned in movie reviews? let reviews = ctx.nousdb_sql("SELECT * FROM reviews") .extend("mentioned_actor",Utf8), model, "Extract the actor name mentioned in this review", &["review"); let names = ctx.nousdb_sql("SELECT * FROM name"); let result = reviews semantic_join(names, &["mentioned_actor"], &["name"], model, "Does the extracted actor match this person?") .select_columns(&["review", "title", "name"]); result.show().await;
Figure 1: NousDB example program.
Problem 1: Semantic operators without semantics. Existing SQEs expose semantic operators to the query planner as opaque model invocations that use task-specific prompts [11, 29, 36]. This limitation hinders query optimization in SQEs because it prevents the definition of algebraic properties to reason about result-preserving rewrites. In our example, treating semantic operators as black boxes prevents the planner from determining whether it can safely push a selective filter on name below the semantic join, fuse mention extraction and matching into a single model invocation, or partition the work across threads. Missing such rewrites can incur substantial model work, often linear in the input cardinality and far costlier per invocation than conventional tuple comparisons.
Challenge 1: Defining semantics that enable sound plan transformations. A semantic operator is jointly determined by its model and prompt, may behave stochastically, and may be undefined for some inputs. Classical relational-algebra properties therefore cannot be assumed. The challenge is to define semantics that make these behaviors explicit and identify which properties, and thus which plan transformations, are valid under which assumptions.
Problem 2: Finite context windows. Singleton calls underutilize the context window. In our running example, invoking the model separately for every review and review-name pair repeatedly pays the fixed cost of the prompt while leaving most of the context window unused. Batching multiple tuples into each invocation amortizes this cost and reduces the number of model calls, but risks exceeding the model's capacity. Thus, batching must respect a hard token budget determined by the prompt and the model's context window, and becomes a critical optimization decision.
Challenge 2: Token-distribution estimation. Enforcing this budget requires estimating the token footprint of the input tuples without tokenizing the entire input in advance. The engine therefore needs compact per-column token statistics that can be collected and maintained at negligible time and space overhead.
Challenge 3: Probabilistic batch sizing. Given these statistics and the available token budget, the engine must select the largest batch that fits with high probability. The sizing algorithm must balance invocation efficiency against the risk of truncation or rejection, particularly under skewed token-length distributions.
Problem 3: Over-batching can degrade result quality. Although a batch may fit within the model's context window, batching can change the output produced for each tuple relative to singleton execution due to leakage from neighboring tuples, tuple position in the batch, or formatting errors that misalign inputs and outputs. In our experiments, batching without checking output fidelity reduces F1 by up to 0.42 for a selection query with Qwen3-8B. The engine must therefore determine the largest batch size that preserves fidelity, meaning agreement with singleton execution, rather than merely the largest batch that fits within the context window.
Challenge 4: Safe batch sizes cannot be predicted a priori. The batch size at which output quality degrades depends on the model, prompt, and data. At query time, fidelity must be assessed without ground truth or independence assumptions and at a cost substantially lower than the execution being validated.
Problem 3: Token-skew in row-balanced partitions. Classical engines distribute rows evenly across workers, assuming similar per-row costs. In SQEs, cost depends on token volume, so row-balanced partitions may have highly unequal loads. In our example, a partition containing longer reviews carries several times the token load of its peers, becoming a straggler while other workers sit idle. We call this imbalance token skew. Existing SQEs inherit row-based partitioning from their host engines and do not account for it.
Challenge 5: Token-aware partitioning. The challenge is to detect token skew and partition tuples by expected processing cost rather than count, while keeping repartitioning overhead below the gains from improved load balance.
NousDB Contributions. NousDB addresses all four problems. It defines semantic operators declaratively as relation-to-relation functions parameterized by a model and a prompt. These definitions provide engine-independent reference semantics for evaluating implementations and reasoning about plan equivalence. We define these semantics at the tuple level, separating what an operator computes from how its inputs are grouped into model invocations. Singleton execution, in which each tuple is evaluated independently, serves as the reference semantics. Batching is therefore a physical execution choice whose fidelity can be evaluated against this reference, rather than an implicit change to the operator's meaning. NousDB is built as an extension of Apache DataFusion [22] over Apache Arrow's [3] columnar format (Figure 2). Its semantic operators are first-class DataFusion operators, enabling vectorized, columnar, and partition-parallel execution. In a nutshell, NousDB makes the following contributions:
• An algebra for semantic operators. We define three tuple-level semantic operators (Extend, Selection, Join) under an explicit oracle assumption, which allows us to derive a set of algebraic properties, along with four rewrite rules, two push-downs and two fusions, that NousDB's optimizer applies.
• Token-aware batch sizing. We introduce equi-depth token histograms as the catalog statistic of token-priced operators, an iterative algorithm that maximizes k subject to an overflow probability , and batched streaming operators that keep a window of packed requests in flight.
• A fidelity certificate. We define batch fidelity as the probability that a tuple has the same output in a batch as in a singleton

Figure 2: NousDB system architecture.
invocation and certify it at query time with a one-probe-per-batch calibration that restores independent samples and an exact Clopper–Pearson test. In query execution, certified runs agree with singleton execution on at least 86% of the tuples of every query.
• Token-aware repartitioning. We implement a token repartition operator with list-scheduling and zigzag assignment, a corrected balance guarantee, and a wave-barrier protocol that embeds it in DataFusion execution engine.
• Strong performance. On IMDB and SemBench, against LOTUS, Palimpzest, Abacus and per-row DataFusion, with a local (Qwen3-8B) and a hosted (GPT-5.4-nano) model, NousDB is the fastest system, up to 86×, uses up to 19× fewer tokens, and lies on the quality–runtime Pareto frontier. On JOB and STACK augmented with semantic operators (43 queries, up to 17 relations) it keeps its lead, up to 35×.
Batching and guarantees. Batch prompting amortizes instruction tokens over the inputs of one prompt [6, 26], at a quality cost reported as discounted output [30] and cross-query interference [51]. Statistical guarantees for LLM-powered operators [19, 36, 53] bound a cheap proxy against an oracle to decide which tuples the expensive model must see. NousDB's certificate is orthogonal: it bounds the fidelity of batched execution to singleton execution (Theorem 4.6) to decide how many tuples may share one call.
3 NousDB Algebra
3.1 NousDB Model
In the relational model, a relation has a set of attributes, each with a domain (numeric, boolean or categorical); for a tuple , is the value of in , and for , denotes the projection of on . Relational systems also admit unstructured attributes through general-purpose types such as TEXT or BLOB, but these remain opaque to query semantics: no relational operator or optimizer can reason about their content. NousDB lifts this limitation by drawing models from a registered pool of foundation models (LLMs, VLMs) that interpret and execute natural-language instructions over their inputs.
A model maps input values to output values, , and is steered by a prompt. We define a prompt constructor from an operator-specific instruction template . Given an input , instantiates with the relevant attribute values from , producing the prompt submitted to . Combining a prompt constructor with the model gives a prompted model invocation (simply model invocation hereafter) through which our semantic operators compose model inference with classical query processing.
Singleton semantics. We define the reference semantics of semantic operators in terms of singleton model invocations: each input tuple, or tuple pair for a join, is evaluated independently.
Deterministic-oracle assumption. Repeated model invocations with the same prompt and input may produce different outputs. We abstract away this stochasticity by assuming that, for a fixed model m, prompt p, and input x, every invocation of returns the same output. Removing model stochasticity from the logical semantics allows us to reason about semantic operators using standard set-theoretic arguments. It is analogous to simplifying assumptions used by relational optimizers, such as uniformity and statistical independence, which enable selectivity estimates to compose across predicates [24].
The logical semantics impose these requirements:
-
Model totality. The invocation is defined and produces a well-formed output for every input x in the operator's domain.
-
Tuple-local prompt construction. Under singleton execution, the prompt constructor is deterministic and uses only the declared input attributes of the tuple r. Thus, for a fixed template and tuple, it always produces the same prompt.
Together, singleton execution, deterministic-oracle evaluation, and tuple-local prompt construction provide input locality: the output associated with a tuple depends only on its declared input attributes and not on other tuples, the container relation, its evaluation order, or its assigned partition. Consequently, each NousDB semantic operator, Extend, Semantic Selection, and Semantic Join that are presented next, defines a well-defined function from relations to relations. Furthermore, NousDB logical semantics allows us to define algebraic properties and rewrite rules.
3.2 NousDB Query Operators
3.2.1 Extend Operator. The Extend operator, , extends a relation with a set of attributes that are computed by a model over 's attributes, given a task instruction prompt .
Definition 3.1 (Extend Operator). Let be an input relation, a subset of 's attributes, the desired extended attributes, a model and the final prompt to the model.
The Extend operator, , is a relation defined as:
3.2.2 Semantic Selection. In traditional relational algebra, the selection operator returns all tuples in a relation that satisfy a boolean condition defined over 's attributes. However, is restricted to comparisons between attribute values (e.g., =, <, ). NousDB extends the expressive power of selection by allowing a model to evaluate the filtering condition.
Definition 3.2 (Semantic Selection). Let be an input relation, and a subset of 's attributes. Let be a model-based selection predicate defined as a filtering condition in a formal or natural language description, evaluated by a model . is defined as:
The semantic selection of R on attributes B, given a model-based selection predicate , is the relation:
3.2.3 Semantic Join Operator. The join operator in relational algebra combines tuples from two relations when they satisfy a join condition . This join condition defines the criteria under which tuples from the input relations are matched, involving comparisons in the form of equality, inequality, or ordering relations between the join attributes of each relation. NousDB redefines join semantics by replacing traditional predicate evaluation with model-based inference. In NousDB, a join condition is evaluated by a model , enabling joins to capture semantic relationships across both structured and unstructured data.
Definition 3.3 (Semantic Join). Let and be two input relations. Let be a model with prompt . The model-based join predicate is defined as: ,
Let B and C be the join attribute sets from R and S respectively, specifying which attributes from each relation participate in the join condition. The semantic join of R and S on attribute sets B and C given a model-based join condition is defined as:
The model-based join condition can be evaluated by any model m that decides whether two tuples should be joined. In all cases, the model returns a boolean outcome used to evaluate .
Semantic Operator Properties. Under the NousDB model, we can define a set of algebraic properties, emerging from the definitions of the semantic operators. Table 1 summarizes all eighteen properties and marks which ones the current implementation NousDB supports. Three (E1, S1, J1) are premises of the four rewrite rules of Section 4.4, i.e., selection pushdown through Extend and through
Implementations may reduce output variability through deterministic inference configurations, such as model temperature settings and constrained decoding strategies, but the assumption remains an abstraction used to define the logical semantics.
Table 1: Properties of the NousDB operators. Role: Rewrite, premise of a rule of Section 4.4. Exec., justifies an execution mechanism, Future, not exploited by the current optimizer.
| # | Property | Role in NousDB |
|---|---|---|
| E1 | Rewrite: premise of 4.4.1, 4.4.3, 4.4.4 | |
| E2 | totality: calls, rows | |
| E3 | Exec.: pipelining; LIMIT early stop | |
| E4 | Exec.: (re)partitioning, batching | |
| E5 | for any permutation , where , | Future: split or merge multi-attribute Extends |
| S1 | Rewrite: premise of 4.4.1, 4.4.2 | |
| S2 | Exec.: early stop under LIMIT | |
| S3 | Exec.: (re)partitioning, batching | |
| S4 | ; | - |
| S5 | - | |
| S6 | Future: cost-based ordering of selections | |
| J1 | Rewrite: premise of 4.4.2, 4.4.4; Cost: pairs | |
| J2 | Exec.: early stop under LIMIT | |
| J3 | , also in ; so | Exec.: block nested loop over blocks; repartitioning |
| J4 | As , for and | - |
| J5 | Future: choice of the outer input | |
| J6 | Future: semantic-join reordering | |
| J7 | Future: projection pushdown below |
| reserved output | ||||||||
|---|---|---|---|---|---|---|---|---|
| system and instructions | ||||||||
Figure 3: LLM context window decomposition. System and user prompt are followed by per-row input tokens
Semantic Join, and Extend–Selection and Extend–Join fusion, seven justify the execution and costing mechanisms of Section 4 and the remaining eight are left for future work.
4 NousDB Optimizer
To bridge DataFusion’s row-oriented execution model with the token-oriented cost and behavior of model inference, NousDB introduces four complementary optimizations: (a) Token-aware batch sizing introducing equi-depth token histograms (Section 4.1) (b) Batch-fidelity certification for preserving output fidelity in batched execution (Section 4.2), (c) token repartition operator for balancing token load across partitions (Section 4.3), and (d) algebraic rewrite rules to cut model invocations through semantic selection push-down and operator fusion (Section 4.4).
LLM Context Window. Every model imposes a maximum context window , bounding the total input plus output tokens that a single invocation can process. The input prompt comprises fixed overhead, a system prompt ( tokens) and an instruction template ( tokens), followed by the serialized input tuples, each separated by a delimiter of tokens (Figure 3). We denote by the expected output tokens per processed tuple.
Definition 4.1 (Batch Input Token Decomposition). The total input tokens for a batch B with tuples decomposes as:
Table 2: Notation for batching and token repartitioning
| Symbol | Meaning |
|---|---|
| token count of tuple over the input attributes | |
| context window of model , input plus output tokens of one invocation | |
| tokens of the system prompt and the instruction template, paid once per invocation | |
| delimiter tokens and expected output tokens, per tuple | |
| equi-depth token histogram of the input and its number of buckets (??) | |
| mean and -quantile of the token count, read from | |
| overflow probability, the chance that a batch exceeds | |
| window-safe batch size (Algorithm 1), the largest candidate | |
| per-row output, the output of tuple invoked alone | |
| output of inside a batch of tuples (pairs, for a join | |
| batch fidelity at size , | |
| tolerance (fraction of tuples that may deviate from ) and confidence | |
| candidate sizes and their number | |
| probe tuples, a uniform sample of the input; is the probe budget, Eq. (11) | |
| probe batch, a batch that contains the probe tuple in a random slot | |
| agreement count, the number of probes with | |
| error budget of one candidate, | |
| Clopper–Pearson lower confidence bound on , Eq. (10) | |
| fidelity-certified batch size, the largest certified candidate | |
| executed batch size, | |
| number of partitions and the -th partition of relation | |
| token repartition operator with strategy , greedy or zigzag (Theorem 4.9) | |
| token load of partition , | |
| imbalance ratio, | |
| token skew, the coefficient of variation of the per-tuple token counts | |
| mean partition load and largest token count of a tuple |
Every batch must satisfy the token budget constraint:
Since total output tokens cannot be known a priori, we reserve a fixed fraction of the context window for output predictions, in our case the 30% of the context window. This constraint is the foundation of the batch size optimization: maximizing k amortizes the fixed overhead across more tuples, reducing both the number of LLM invocations and token consumption.
4.1 Token Distributions and Token Histograms
Since tokens are the fundamental unit of computation for LLMs, to capture the token count distribution, we introduce token histograms, adopting the abstract partitioning framework of Ioannidis et al. [37].
Let denote the tokenizer of model , and let be the number of tokens in string using . When is clear, we write . For a tuple in relation with schema and input attribute set used for model inference, the tuple token count is . For attribute in , let be the set of distinct values in , with corresponding frequencies where . The token distribution of is .
Definition 4.2 (Cumulative Token Distribution). The cumulative token distribution function gives the fraction of tuples with token count at most :
where is the total number of tuples.
Definition 4.3 (Token Histogram). A token histogram on attribute has buckets and is constructed by sorting the token distribution according to token counts and frequencies, partitioning it into disjoint buckets subject to a partitioning constraint, and storing summary statistics for each bucket. Each bucket stores: (a) the minimum and maximum token counts, and , resp. (b) the number of distinct attribute values (c) the total frequency , i.e., the number of tuples represented, and (d) the frequency-weighted mean token count .
The choice of partition constraint yields different histogram families. For NousDB we adopt equi-depth partitioning, where each bucket is constrained to contain approximately the same number of tuples.
Definition 4.4 (Equi-Depth Token Histogram). An equi-depth token histogram with buckets partitions the token distribution such that each bucket contains approximately tuples, i.e.: , . The bucket boundaries are defined by the token count quantiles. Let and, for :
where is the cumulative token distribution from Theorem 4.2. Bucket contains all values with .
We chose equi-depth histograms for three reasons:
a) Quantile access. Batch size optimization (Section 4.2) requires quantile queries of the form “what token count is exceeded by at most of tuples?” In an equi-depth histogram, the boundary between buckets and is precisely the -quantile, so these queries reduce to bucket lookups with intra-bucket interpolation.
(b) Tail estimation. Exceeding the context limit causes runtime failure. Accurate tail-quantile estimates are therefore critical for preventing overflow. Equi-depth histograms support such estimates by isolating high-token-count values in dedicated bins.
(c) Sum estimation. For a batch of k tuples, the cost model estimates . Equi-depth histograms enable efficient sum estimation via quantile-based bounds, since each quantile range contributes proportionally to the total token mass.
Given an equi-depth histogram, we extract arbitrary quantiles via linear interpolation within the target bucket.
Definition 4.5 (Quantile Extraction from Equi-Depth Histograms). For an equi-depth histogram with buckets, the -quantile (for ) is estimated as:
where is the index of the bucket containing the -quantile. The expression is the fractional position within bucket , and the formula assumes a uniform distribution of token counts within each bucket.
Histogram Summary Statistics. From the per-bucket statistics stored in , we derive two global summary statistics that are consumed directly by the batch sizing algorithm (Section 4.2) and the token repartitioning operator (Section 4.3), namely the mean token count and total tokens :
Algorithm 1 Iterative Safe Batch Size Computation
Require: ; ; ; ; confidence
Ensure: Safe batch size
1:
2:
3:
4: for to MAXITER do
5:
6:
7:
8: if then
9: return
10: end if
11:
12: end for
13: return
The mean provides the initial batch size estimate (Algorithm 1), while determines the per-partition token budget for the repartitioning operator (Theorem 4.9).
Construction. Histograms are built once per table and text attribute, offline, by one tokenization pass over the attribute, and stored in a catalog that the optimizer loads at planning time. When the input attribute set I of an operator has several attributes, is the token count of the whole rendered row, and the quantile of a sum is not the sum of the per-attribute quantiles. NousDB therefore rebuilds one histogram for I by summing the per-attribute bucket profiles per bin, i.e., under a comonotone coupling of the attributes, for which quantiles are additive.
4.2 Batch Size Optimization
The operator definitions in Section 3.2 assume singleton execution, under which each tuple's output depends only on that tuple (input locality). Batching reduces the singleton invocations to invocations of up to tuples, amortizing per-call overhead to reduce token usage and improve throughput [6, 8, 16, 26]. However, a batch must both fit within the context window and preserve singleton outputs. Batching is thus a physical optimization valid only when it preserves the logical operator semantics.
To define safe batching, we distinguish the two outputs of a tuple under a fixed operator, model mmm, and prompt template.
Definition 4.6 (Batched Invocation and Batch-Composition Invariance). Let be a batch of tuples. The prompt constructor renders one prompt that holds all tuples, and one invocation returns one output per tuple. We write for the output returned for , and
for its per-row output, the value that Definitions 3.1–3.3 assign to . The operator is batch-composition invariant at size if for every batch of tuples and every .
The batch size k is therefore the central physical decision for a semantic operator, and its choice is governed by two constraints: (i) Safe context-window utilization. The k tuples and their outputs must fit in the context window , since a batch that does not fit is not rejected or truncated, but results to query failure. Because a batch fit depends only on the token lengths of its tuples, the optimizer can determine the maximum feasible batch size at planning time using token histograms, without invoking the model.
(ii) Safe batching against per-row invocation. A batch can affect per row results: the output a tuple receives inside a batch may differ from the one it receives when invoked alone. This failure is silent, and it depends on the model, the prompt and the data, so it can only be measured by invoking the model.
The two problems are orthogonal. The first concerns the relationship between tuple token lengths and the window capacity, while the second concerns the model behavior. Neither implies the other: batches that fill a small fraction of the window may already lose quality. Figure 4 illustrates this distinction for two cases: IMDB and SemBench reviews. The top row shows the token-length distributions of the review columns, which vary substantially across datasets. For example, the 90th-percentile review length in SemBench is approximately equal to the mean review length in IMDB. In the bottom row, we execute four queries from IMDB under different batch size k and measure their quality: the candidate batch sizes are , starting from singleton execution and doubling at each step, plus two larger settings that utilize the 50% and 75% of the model's context window. The results are mixed: in some cases batching provides a boost in the total accuracy, like Q1, Q4, while it can be catastrophic, like in Q2 and Q7.
Definition 4.7 (Maximum Feasible Batch Size). The maximum feasible batch size , given a token histogram , is the largest such that the expected batch, based on its estimated token demand, fits within the context window: . Solving for :
Recall that is the estimated mean number of input tokens per tuple from , is the delimiter tokens, and is the estimated number of output tokens per tuple. Algorithm 1 computes in three steps, without invoking the model. It first subtracts the fixed prompt from the window, which leaves the budget for the tuples and their outputs, and starts from the mean-based size of Equation (8) (lines 1–3). This start is optimistic: it sizes the batch for the mean tuple, so any batch of longer-than-average tuples overflows. Each iteration therefore sizes the batch for a long tuple instead, the -quantile of (lines 5–7): a batch of tuples of at most tokens each fits, and by the union bound one of its tuples exceeds with probability at most , whether or not the tuple lengths are independent. Finally, depends on : larger batches are more likely to contain long tuples and therefore require higher quantiles, which in turn reduces the feasible batch size. The algorithm therefore repeats until stops changing (lines 8–11) and returns this fixed point as , a batch size that overflows the window with probability at most .
4.2.1 Fidelity-Aware Batch Size. Algorithm 1 bounds batch capacity, but does not ensure that the model preserves its singleton behavior in the batch. The bottom row of Figure 4 shows that sensitivity to batching varies across queries and models. With Qwen3-8B, the F1 score of Q2 falls from 0.89 at k = 1 to 0.77 at k = 8 and 0.30 at k = 64. In contrast, for Q1, the F1 score stays between 0.87 and 0.90 up to k = 32, dropping to 0.70 only at k = 64. With GPT-5.4-nano, the F1 scores of both queries remain within 0.05 of their singleton values up to k = 64, but collapse at 75% of GPT's context window.

Figure 4: Reviews tokens distribution (up) and impact of batching in quality (bottom)
reaching 0.24 for Q1 and 0.14 for Q2. The top row of Figure 4 reveals additionally the role of tuple length. an IMDB review spans 213 tokens at the median and 1,145 at the 95th percentile, against 27 and 213 for a SemBench review, so the same k packs about eight times more text into one invocation on IMDB, and batches of equal k differ in length even within one column.
Estimating the largest batch size such that output quality is close to that of singleton execution, at query time has three challenges. (a) Because no ground truth is available, we measure agreement against the engine's singleton outputs, . This follows prior work, which states statistical guarantees for LLM-powered operators relative to a gold algorithm [36, 53] and evaluates batched plans against unbatched execution [30, 38]. (b) The k outputs produced by a batch share the same context and may therefore be dependent, hence they cannot be treated as independent samples. (c) The solution must be substantially cheaper than the query it protects, and its cost must not grow with . We therefore ask: given a semantic operator, an error tolerance , and a failure probability , what is the largest batch size k such that, with probability at least , the batched outputs differ from the corresponding per-row outputs on at most an fraction of tuples?
Definition 4.8 (Batch Fidelity). Given a batch B that ranges over the batches of k tuples that the engine forms, the batch fidelity of an operator at size k is the probability that a tuple receives its per-row output inside a batch of k tuples:
To measure fidelity, a natural approach is to sample tuples and compare their batched outputs with their singleton outputs. However, outcomes for tuples within the same batch are dependent because the tuples share a context and may influence one another. We therefore evaluate one probe tuple per independently constructed batch. For a fixed batch size k, each probe defines a Bernoulli trial that succeeds when its batched output agrees with its singleton output. Assuming that probe batches are sampled independently, the agreement count follows
where is the fidelity of operator at batch size , is the probe budget, and is the number of successful probes.
Algorithm 2 Batch-Fidelity Certification
Require: input tuples; ; tolerance ; confidence
Ensure: Fidelity-certified batch size
1: ; ;
2:
Eq. (11)
3: draw probes and fillers from the input
4: for
n singleton calls
5: for in descending order do
6: in a random slot of , rest fillers,
7:
n batched calls
8: if then
9: return
10: end if
11: end for
12: return 1
More specifically, NousDB estimates fidelity through a calibration run over a sample of the operator input. In addition to , (Theorem 4.6), , and , calibration uses:
• the set of candidate batch sizes
which doubles from 2 up to the histogram-derived maximum feasible batch size ;
-
the probe tuples , sampled uniformly from the operator input, where is the probe budget fixed before calibration;
-
for each probe and candidate size , an independently constructed probe batch , which places in a uniformly random position and fills the remaining positions with tuples sampled from the operator input; and
• the agreement count .
Certifying a batch size. The fraction estimates without a guarantee, so certification uses a one-sided lower confidence bound: overestimating fidelity certifies a size that silently corrupts outputs, whereas underestimating it merely forfeits speed. The exact Clopper–Pearson bound [7] is the smallest fidelity under which or more agreements remain -plausible,
and satisfies for every true fidelity. A candidate is certified if , and spending on each of the candidates bounds the probability that any certificate is wrong by (union bound).
We call , the batch size that preserves the fidelity of the batch and Algorithm 2 computes it once per semantic operator inside a query. It obtains the singleton outputs once (line 4) and tries the candidates from the largest down (lines 5–8), starting from the batch size , provided by Algorithm 1. A candidate is abandoned as soon as its disagreements make a pass impossible, which saves model calls. Finally, we must determine the probe budget , i.e., the number of tuples needed to test to measure engine's fidelity. If all probes agree ( ), Equation (10) attains , so a perfect count passes once
at and this gives . Calibration then costs at most singleton and batched calls; the budget depends only on and not on , so, like histogram construction, its share of the query cost shrinks as the data grows.
Final batch size. Since a candidate batch size is at most , the executed size is whenever certification runs ( otherwise). The plan thus carries one guarantee per problem of Section 4.2: each batch overflows the window with probability at most , and fidelity is at least with confidence .
Example. Consider the sentiment selection of Figure 4 over IMDB reviews, with pt rendering “Does {review} express positive sentiment? Answer yes or no.” The default values for the failure probability and fraction of tuples are , meaning at most a 5% tuple-level deviation from reference semantics, wrong with probability at most 5%. The first step of the optimizer, predicts the histogram guided batch size from Algorithm 1, which yields , hence the set if candidate batch sizes are , , , and the probe budget by Equation (11). The descending scan first tests : calibration returns , an empirical fidelity of 0.90, and Equation (10) gives , so the candidate fails. Next, at every probe agrees, , the bound attains its closed form , and the scan stops. Thus and : with confidence at least 0.95, the fidelity at is at least 0.95. Calibration requires 90 singleton calls and 180 batched calls, corresponding to the two candidates tested. This cost is independent of .
4.3 Token-Based Repartitioning
Modern query engines distribute rows uniformly across parallel workers. In semantic query engines, however, cost is driven by token volume, so row-balanced partitions may be token-skewed. We quantify this risk using the coefficient of variation of per-tuple token counts, , where and are their mean and standard deviation. Larger values indicate greater variation in token load despite equal row counts.
Definition 4.9 (Token repartition operator). Given a relation , the input attributes of the downstream semantic operator, output partitions and a strategy , the operator produces a partition of that assigns each tuple by its token count under , aiming to minimize the imbalance ratio , where .
Strategies (Figure 5). Greedy Bin-Packing (the default) assigns each tuple to the partition with the fewest accumulated tokens, analogous to the Longest Processing Time (LPT) scheduling heuristic for identical parallel machines [12]. Zigzag sorts the tuples of each wave by decreasing token count and deals them to the partitions in a boustrophedon order , for downstream operators that want equal row counts.
THEOREM 4.10 (BALANCE OF GREEDY BIN-PACKING). With and the largest token count, greedy bn-packing guarantees at every point of the stream and ; hence whenever . Zigzag guarantees that the row counts of the partitions differ by at most one within each wave.
PROOF. A tuple of size joins a partition of minimum load ; the new maximum is either the old one or , and the
(a) Greedy Bin-Packing

Figure 5: Token-aware partitioning for P=3 and 6 rows. (a) Greedy bin-packing assigns each row to the least-loaded partition; , variable row counts (3, 1, 2). (b) Zigzag sorts by descending , sweeps forward then backward; equal rows ( ), .
new minimum is at least , so the spread stays at most by induction. The partition that attains the maximum received its last tuple while it was the least loaded, i.e. at most the average, which gives the second bound and the ratio follows from . Zigzag deals the tuples of a wave cyclically, so each partition receives or of them.
NousDB inserts a repartition node when the token distribution is sufficiently skewed to justify the overhead. Given a token histogram , it computes estimating the row-uniform imbalance ratio via Central Limit Theorem (CLT) bounds on the maximum partition load [39]. Repartitioning triggers when either (i) ( ), indicating the slowest partition exceeds ideal load by , or (ii) the tail ratio (default ), independently capturing heavy-tail risk where CLT convergence is slow. When triggered, the default strategy is GREEDY. ZIGZAG is chosen, when the downstream operator requires uniform partition cardinality.
4.4 Query Plan Rewrites
The algebraic properties in Section 3.2 concern individual semantic operators and set operations. We now derive cross-operator equivalences that justify two classes of plan rewrites: pushdown rules reduce the input to an expensive operator by moving a cheaper operator below it, while fusion rules combine multiple operators into a single model invocation and avoid intermediate materialization.
PROPERTY 4.4.1 (SELECTION PUSHDOWN THROUGH EXTEND). Given an extend , and a semantic selection whose predicate depends only on the base attributes A. Then:
PROOF. By 3.1, where . The left-hand side applies to these extended tuples: . Since depends only on and not on , we have , so the predicate reduces to . This gives: . On the right-hand side, first filters to obtain , and then extends to produce . The two expressions are identical.
PROPERTY 4.4.2 (SEMANTIC SELECTION PUSHDOWN THROUGH SEMANTIC JOIN). Let be a Semantic Selection whose predicate mp depends only on attributes of R. Then:
PROOF. We prove the left-pushdown case and the right case is symmetric. Let as the model-based selection predicate of the semantic selection. By hypothesis, depends only on the sch(R) of each output tuple of the semantic join, so the selection predicate will be applied on . The left-hand side is: . Since and are independent predicates and conjunction is commutative, this equals: . The inner condition is precisely , giving . Symmetrically, we can prove the same for S.
PROPERTY 4.4.3 (EXTEND-SELECTION FUSION). Let be an Extend and a Semantic Selection, both using the same oracle model , whose predicate depends only on the extended attributes , i.e., . Assume is not required by downstream operators (so the final schema is ). Define a composed prompt such that for all : . Then:
PROOF. By Definition 3.1, . Applying the selection yields . Projecting to gives . Since , we have . By the definition of , this equals for all , which yields precisely .
PROPERTY 4.4.4 (EXTEND-JOIN FUSION). Let R and S be two input relations. The following three fusion rules eliminate Extend operators whose output attributes are used solely as join keys and are not required in the final output.
(a) Left fusion. Let be produced by and used only to join with S on attributes B via prompt . If s.t. , then:
(b) Right fusion. Let be produced by and used only as right-side join attributes. If s.t. : , then:
(c) Bilateral fusion. If both input relations are extended and and both sets of extended attributes are used only as join keys, and composed prompt such that for all , :

Figure 6: End-to-end system workflow for query Q11. The user program (1) builds a logical plan (2) with separate and operators requiring two LLM calls per row. The optimizer (3) applies the new rules.
then:
Case (c) follows from applying case (a) and then case (b) in sequence.
PROOF. We prove case (a); case (b) is symmetric, and case (c) follows by composing the two. By Definition 3.1, . By Definition 3.2.3, the left-hand side is: . Projecting to removes the extended attributes , yielding: . By the hypothesis: for all . Substituting gives .
Figure 6, shows how NousDB puts in action all the proposed optimizations. NousDB applies query rewriting to fuse the two semantic operators and based on input token distribution, it estimates the batch size and whether to insert the token repartition operator.
5 Experiments
We evaluate NousDB through four research questions:
RQ1: How does NousDB perform end to end? We compare NousDB with competing systems on IMDB, SemBench [23], and semantic extensions of JOB [24] and STACK [13] (Section 5.2).
RQ2: How do batching and fidelity constraints affect execution? We measure the token savings from batching and the effects of fidelity constraints on batch size, runtime, and quality (Section 5.3).
RQ3: What is the contribution of each optimization? We ablate histogram-guided batch sizing, fidelity-aware batching, token-aware repartitioning, and algebraic rewrites (Section 5.4).
RQ4: What are the benefits of the semantic algebra? We evaluate its effects on query performance and output quality and discuss it across all sections.
5.1 Experimental Setup
All experiments run on a server equipped with two NVIDIA A6000 GPUs (48 GB VRAM each), Intel(R) Xeon(R) Gold 5318Y CPU @ 2.10GHz and 377GB memory. For model serving we used vLLM [21]. For our experiments we use Qwen3-8B [52], a GPT-5.4-nano [43] and a Qwen3-32B for the ablation study only.

Figure 7: Mean quality against runtime with GPT-5.4-nano: the six NousDB variants and competitors on the Pareto frontier.
Systems. NousDB default setup is histogram-guided batched execution (Batched), without model reasoning enabled, and when necessary, we specify when it computes the batch fidelity (+Certified) and when it uses model reasoning (+Thinking). We compare against two state-of-the-art semantic query processing engines: LOTUS [35] and Palimpzest [28], a declarative system w/o its sample-based cost optimizer Abacus [40]. In our analysis we include a vanilla DataFusion [22] version, with naive semantic operator implementation, processing their input row-by-row. All competitors use the same models (Qwen3-8B via vLLM and GPT-5.4-nano via cloud with 32K and 400K context each) with 10 parallel workers to ensure a fair comparison of system-level optimizations.
Workloads. We use 4 different benchmarks in our evaluation: IMDB extends the JOB schema [24] with 10.5K reviews [31]. It contains 11 queries in total, having six single operator queries (Q1–Q4, and the extend-to-aggregate Q5 and Q6) and the rest are pipelines of several semantic operators (Q7–Q11), four of which the rewrites target (Q7, Q8, Q10, Q11). SemBench-Movie [23] has ten queries: retrieval with a LIMIT (SB1, SB2), aggregates (SB3, SB4, SB8), self-joins of one movie's reviews (SB5 and SB6 with a LIMIT, SB7 exhaustive over 13,924 pairs) and ranking (SB9, SB10). Finally, we extend JOB [24] and StackExchange benchmarks (24M rows under the STACK schema [13], with semantic operators, augmenting standard benchmarks used in the query optimization literature.
5.2 Comparison against Workloads
Quality against runtime. With GPT-5.4-nano (Figure 7) only NousDB variants form the Pareto frontier: Batched is the fastest point (7.4s on IMDB, 3.6s on SemBench), and Batched+think, achieving 0.69 at 22s and 0.84 at 12s, dominates every external system, whose best mean quality is Palimpzest's 0.61 at 132s on IMDB and LOTUS's 0.62 at 45s on SemBench. Similarly with Qwen3-8B, the IMDB frontier is again NousDB's alone, from Batched (0.58 at 22s) to Certified+think (0.72), while on SemBench LOTUS joins it (0.76 at 12s, between Batched's 0.70 at 6.2s and V.DataFusion+think's 0.77 at 638s), the competitor that no NousDB configuration dominates. From our experiments, reasoning multiplies the decode cost of every call, since 90–97% of the thinking arms' output tokens on Qwen are reasoning tokens, and packing k rows per call amortizes exactly that cost, leading to a if you think, batch rule of thumb.
Runtime. Batched NousDB is the fastest system in every benchmark and model setting (Figure 8). With GPT-5.4-nano it is 15–19× faster than V. DataFusion, LOTUS and Palimpzest on IMDB and 9–19× on SemBench, and 59–86× faster than Abacus, whose plan search dominates its runtime. On Qwen3-8B it is 1.9× faster than LOTUS, 10× than Palimpzest and 38–73× than Abacus, but only 1.08× faster than V. DataFusion on IMDB, where both run their
| IMDB (11 queries) | SemBench (10 queries) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| F1 | Qual. | Wall (s) | Tok. M | × | F1 | Qual. | Wall (s) | Tok. M | × | |
| Qwen3-8B (sf 1000) | ||||||||||
| Batched | 0.54 | 0.58 | 22 | 3.0 | 1 | 0.62 | 0.70 | 6.2 | 1.1 | 1 |
| Certified | 0.56 | 0.59 | 83 | 7.4 | 3.79 | 0.47 | 0.64 | 27 | 28.9 | 4.42 |
| Row-by-row+think | 0.64 | 0.67 | 980 | 18.9 | 44.6 | 0.77 | 0.77 | 638 | 61.6 | 103.3 |
| Batched+think | 0.67 | 0.71 | 151 | 4.2 | 6.90 | 0.78 | 0.75 | 90 | 5.1 | 14.6 |
| Certified+think | 0.69 | 0.72 | 1204 | 10.3 | 54.8 | 0.79 | 0.74 | 924 | 53.8 | 149.6 |
| V.DataFusion | 0.48 | 0.52 | 24 | 9.5 | 1.08 | 0.47 | 0.62 | 16 | 29.0 | 2.59 |
| LOTUS | 0.28 | 0.37 | 42 | 4.7 | 1.91 | 0.75 | 0.76 | 12 | 5.7 | 1.94 |
| Palimpzest | 0.67 | 0.69 | 221 | 8.7 | 10.1 | 0.65 | 0.61 | 64 | 9.5 | 10.4 |
| Abacus | 0.61 | 0.67 | 837 | 2.7 | 38.1 | 0.60 | 0.67 | 337 | 0.45 | 72.6 |
| GPT-5.4-nano (sf 1000) | ||||||||||
| Row-by-row | 0.56 | 0.61 | 113 | 10.2 | 15.2 | 0.48 | 0.49 | 68 | 31.8 | 18.9 |
| Batched | 0.50 | 0.58 | 7.4 | 2.6 | 1 | 0.63 | 0.72 | 3.6 | 1.8 | 1 |
| Certified | 0.64 | 0.67 | 95 | 5.8 | 12.8 | 0.50 | 0.60 | 71 | 31.6 | 19.7 |
| Row-by-row+think | 0.68 | 0.70 | 197 | 17.1 | 26.6 | 0.78 | 0.67 | 114 | 53.8 | 31.6 |
| Batched+think | 0.66 | 0.69 | 22 | 3.0 | 2.97 | 0.85 | 0.84 | 12 | 2.9 | 3.31 |
| Certified+think | 0.69 | 0.72 | 221 | 7.3 | 29.8 | 0.79 | 0.70 | 152 | 53.8 | 41.9 |
| V.DataFusion | 0.48 | 0.52 | 24 | 9.5 | 1.08 | 0.47 | 0.62 | 16 | 29.0 | 2.59 |
| LOTUS | 0.22 | 0.34 | 141 | 4.3 | 19.3 | 0.66 | 0.62 | 45 | 3.1 | 12.3 |
| Palimpzest | 0.57 | 0.61 | 131 | 8.1 | 17.8 | 0.62 | 0.47 | 34 | 8.0 | 9.32 |
| Abacus | 0.46 | 0.56 | 411 | 14.0 | 59.3 | 0.66 | 0.60 | 269 | 1.4 | 86.3 |
Table 3: NousDB variants and competitors: mean F1, mean normalized quality over all queries (Qual.), geometric-mean wall clock (s), total tokens (M), and paired geometric-mean speedup of NousDB
semantic operators on ten partitions and vLLM's continuous batching and prefix cache already make per-row requests cheap. On SemBench, the movie filter leaves only 77–118 rows on five queries, which NousDB, V. DataFusion and LOTUS finish within 1.5× of one another while Palimpzest and Abacus pay 10–66 s and 205–400 s of fixed overhead. On the LIMIT-bounded SB1, SB5 and SB6, NousDB answers from a bounded prefix of its input (Ref section 1 of the experimental), 2.5–38× faster than V. DataFusion and LOTUS. Doubling the input (dots in Figure 8) grows NousDB's runtime by 1.26–1.92× and that of V. DataFusion, LOTUS and Palimpzest by 1.7–2.2× (geometric means per benchmark and model), so 14 of the 16 speedups grow, up to 85× on IMDB and 82× on SemBench, while the two that shrink are against Abacus, whose fixed-budget plan search takes about as long at either scale.
Quality and Total Tokens. Focusing on the token consumption reported in Table 3, batching and plan rewrites make NousDB having the lowest token consumption in total on 40 out of 42 queries. In terms of quality, no system is dominant on every query, with Qwen3-8B Palimpzest and Abacus lead IMDB and LOTUS on SemBench, paying the overhead of of NousDB's runtime.
NousDB achieves Pareto frontier optimality primarily through its implementation of the proposed extended algebra, especially the pushdowns and fusions. Pushing Q7's selection below its Extend operator, reduces the tuples reaching the model from 2000 to 1606 on Qwen3 and to 1166 to GPT, achieving a and reduction on token consumption respectively, while the application of semantic filter before the semantic join on Q8, cuts the of the tokens to reach the second semantic opertor. In all the cases above the F1 score varied only 0.01, compared to full execution of the plan. On Q10 the fusion of the Extend-selection halves the total rows sent to the model, while improving the F1 score from 0.24 to 0.47 and from 0.13 to 0.57 for Qwen and GPT respectively. Finally the fused plan on Q11, managed to achieve the best F1 score across all systems.
JOB and STACK workloads. We augment two well-known benchmarks for query optimization with semantic operators, keeping each source query's join graph, predicates and outputs and adding semantic operators on a text attribute its joins reach: JOB [24] gets the reviews relation, joined to title, and STACK [13] already exposes question, answer and comment bodies. Each query gets one semantic configuration (a selection, a one- or multi-attribute Extend, a selection-Extend pipeline, or a semantic join), yielding 33 JOB queries and 10 STACK queries. Figure 9 contains the comparison between the systems on these two benchmarks. In 19 of them the original join predicates drive the intermediate result to zero cardinality before the semantic operator fires, where on this relational-dominant subset the three systems fall within of one another, showing that semantic augmentation adds negligible overhead when the operator is inactive. The remaining 14 semantic-active queries trigger between 3 and 1,265 LLM calls. On this subset NousDB achieves a geometric-mean speedup of over LOTUS and over Palimpzest, winning 13 of 14 and 12 of 14 respectively. The advantage peaks on complex-tier queries whose join graphs emit intermediate rows: on J8, NousDB finishes in 717 s versus 25,038 s (LOTUS, ) and 22,204 s (Palimpzest, ), and consumes 16.1 M tokens versus 29.9 M ( fewer), as the shared instruction prefix is amortised across the batch. The regression on J24, where NousDB trails LOTUS by due to a join topology that limits the greedy bin-packing operator.

Figure 8: End-to-end latency per query (log scale) bars indicate at sf 1,000, dots at sf 2,000
In STACK benchmark, we evaluate NousDB at sf=10,000 while LOTUS and Palimpzest run at sf=1,000. Despite 10× more data, NousDB achieves geometric-mean latency 4.9× lower than LOTUS and 5.3× lower than Palimpzest, winning 8 of 10 and 9 of 10 pairwise comparisons. The two near-parity queries (S1, S10) are relational-dominant, each triggering at most two LLM calls. On the most token-intensive query (S11), NousDB processes 7,146 rows and 2.37 M tokens in 84 s, versus 222 s (LOTUS) and 268 s (Palimpzest).
5.3 Batch Sizing and Batch Fidelity
Impact on token consumption. Histogram-guided batching alone (C1 in Table 4) cuts model calls to and tokens to of per-row execution on every model and benchmark. The saving is on the input side: packing rows shares the instruction

Figure 9: JOB (top) and STACK (bottom). NousDB at sf 10,000, rest at sf 1,000) latency per query (log scale).

Figure 10: Share of the input tuples on which Certified and Batched execution return the singleton answer. Batch sizes as in Figure 11a.
prefix while still the model generates an answer per input row, so the joins, whose per-pair prompts repeat the instructions for every pair, save most (Q3 with Qwen3-8B: 880 K to 91 K tokens).
Impact on quality. On most queries batching has a small impact on overall quality: over the 36 pairs of Figure 10, a batched variant departs from its per-row counterpart on 15% of the tuples on average (median 10%), with one extreme case, Q7 with Qwen3-8B (45%). Qwen3-8B is the more batch-sensitive model (17% against 12% for GPT-5.4-nano), and its quality degradation comes earlier, as shown in Figure 4. The above behavior is regulated on both models when their reasoning capabilities are enabled.
What the certificate guarantees and costs. Certified execution returns the per-row answer on 97.5–99.8% of the tuples with Qwen3-8B and 86–99% with GPT-5.4-nano, above 1 – in every cell, including where the predicted batch sizes where large ( with GPT-5.4-nano: 91–95%). At sf 2,000, Batched falls below 1 – on 8 of 16 cells and Certified on none. With Qwen3-8B the certificate returns on 10 of 11 and on IMDB queries and on every SemBench query. GPT-5.4-nano, is more resistant to batching as a bigger model, where it keeps between 16 and 64 on four queries (Figure 11a). The calibration prologue takes 6–118 s (Qwen3-8B) and 11–97 s (GPT-5.4-nano) per IMDB query, about half of a certified run, and does not grow with the input, whereas Abacus's plan search takes 157–1,259 s (Figure 11b).
Quality of the variants. The choice of variant moves F1 as much as the choice of system (Figure 12): on Q3 the variants span 0.11 (Row-by-row) to 0.93 (Row-by-row+think) with Qwen3-8B, and on Q9 0.12 (Batched) to 0.81 (Certified+think) with GPT-5.4-nano. The best variant matches or beats the best external system on 6 of 9

(a) Rows per call of Batched and of the certificate without and with thinking

(b) Seconds per IMDB query in the certificate’s calibration prologue, without and with thinking, and in Abacus’s plan search.
Figure 11: What the fidelity certificate chooses and what it costs, per query at sf 1,000.

Figure 12: F1 per query at sf 1,000 of the six NousDB, per IMDB query and the best variant against the best of LOTUS, Palimpzest and Abacus (right).
IMDB queries with Qwen3-8B and 7 of 9 with GPT-5.4-nano, where it concedes only Q1 and Q7 to Palimpzest, by 0.004 and 0.016. The one large gap is Q8 with Qwen3-8B (0.36 against Palimpzest's 0.63), which GPT-5.4-nano's best variant wins by 0.11. Finally on SemBench, Batched is the best variant on SB2 (0.80) with both models, and the thinking variants take the pair queries (Batched+think: 0.90 on SB5 and 1.00 on SB6 with GPT-5.4-nano).
5.4 Ablation Study
We isolate the three optimizations on queries that cover every operator type on IMDB and SemBench at sf 1,000, adding also
Table 4: Optimizations benefits. Top: geometric-mean ratio to C0 over each benchmark's ablation queries (below 1 = better). Bottom: answer quality of every cell (F1; SB3: relative error, lower is better; SB10: Spearman ; bold = best of the six configurations per model).
| Qwen3-8B | Qwen3-32B | GPT-5.4-nano | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| C0 | C1 | C2 | C3 | C4 | C5 | C0 | C1 | C2 | C3 | C4 | C5 | C0 | C1 | C2 | C3 | C4 | C5 | |
| IMDB: ratio to C0 (geometric mean) | ||||||||||||||||||
| calls | 0.08 | 1.00 | 0.51 | 0.11 | 0.07 | 0.07 | 1.00 | 0.49 | 0.13 | 0.08 | 0.05 | 1.01 | 0.91 | 0.11 | 0.05 | |||
| tokens | 0.26 | 1.00 | 0.68 | 0.35 | 0.26 | 0.26 | 1.00 | 0.65 | 0.37 | 0.29 | 0.29 | 1.00 | 0.99 | 0.44 | 0.25 | |||
| wall | 1.39 | 0.59 | 0.69 | 1.08 | 0.74 | 1.22 | 0.95 | 0.84 | 0.80 | 0.57 | 0.25 | 0.24 | 1.06 | 0.24 | 0.18 | |||
| SemBench: ratio to C0 (geometric mean) | ||||||||||||||||||
| calls | 0.14 | 1.03 | 0.89 | 0.16 | 0.17 | 0.17 | 0.84 | 0.93 | 0.18 | 0.18 | 0.09 | 1.04 | 1.00 | 0.09 | 0.09 | |||
| tokens | 0.15 | 1.00 | 1.00 | 0.17 | 0.17 | 0.17 | 1.00 | 1.00 | 0.18 | 0.18 | 0.32 | 1.06 | 1.00 | 0.41 | 0.41 | |||
| wall | 4.76 | 0.90 | 0.89 | 2.05 | 1.52 | 3.77 | 0.97 | 0.96 | 1.49 | 1.49 | 0.49 | 0.33 | 0.94 | 0.30 | 0.31 | |||
| Answer quality | ||||||||||||||||||
| Q1 | .892 | .883 | .892 | .892 | .888 | .890 | .917 | .922 | .916 | .916 | .930 | .930 | .927 | .931 | .931 | .930 | .895 | .892 |
| Q3* | .114 | .484 | .114 | .396 | .370 | .759 | .776 | .846 | .783 | .792 | .796 | .818 | .677 | .537 | .608 | .900 | .800 | .718 |
| Q4 | .585 | .438 | .585 | .585 | .456 | .456 | .595 | .583 | .595 | .607 | .513 | .513 | .500 | .538 | .582 | .537 | .526 | .500 |
| Q7 | .411 | .433 | .413 | .411 | .414 | .410 | .460 | .429 | .462 | .464 | .455 | .486 | .368 | .292 | .369 | .366 | .226 | .316 |
| Q11* | .582 | .421 | .582 | .611 | .435 | .789 | .686 | .568 | .686 | .909 | .495 | .835 | .525 | .421 | .571 | .819 | .500 | .467 |
| SB7* | .428 | .290 | .428 | .428 | .327 | .328 | .456 | .394 | .455 | .455 | .389 | .381 | .591 | .180 | .604 | .601 | .169 | .216 |
| SB3 | .111 | .556 | .111 | .111 | .222 | .222 | .556 | .667 | .556 | .556 | .111 | .111 | .667 | .444 | .556 | .556 | .111 | .111 |
| SB10 | .286 | .202 | .286 | .286 | .335 | .349 | .329 | .311 | .333 | .329 | .343 | .352 | .303 | .319 | .301 | .289 | .317 | .358 |
Qwen3-32B. C0 is per-row execution, C1, C2 and C3 each enable one optimization from batching, token repartitioning and rewrites respectively, C4 = C1+C2, and C5 is full NousDB (Table 4).
Batch sizing leads to significant cost reduction (C1). Batching alone cuts calls to ×0.05–0.17 and tokens to ×0.15–0.32 of C0 on every model and benchmark. With GPT-5.4-nano the wall clock follows (×0.25 on IMDB, ×0.49 on SemBench): the join Q3 packs 986 per-pair calls into 34, taking 62 K tokens instead of 944 K and 8 s instead of 122 s. The self-hosted models however, get slower (×1.22–4.76): vLLM's continuous batching already batches concurrent per-row requests, so packing mainly lengthens each request (Q4 with Qwen3-8B: 204 s against 97 s on the same ten partitions).
Token repartitioning as a new shuffling technique (C2). Token Repartition shuffles rows, so in terms of tokens and calls is identical to C0. Its gain is the granularity of the shuffle: DataFusion's round-robin partitioning operator shuffles record batches across partitions, while token repartitioning shuffles them based on their tokens. GPT-5.4 shows big gains when the repartitioning is enables, while the exchange already dealt single rows to ten partitions (session batch size of one), and C2 stays within 6% of C0: balance has little to fix. The true gains of this operator come hand-to-hand when paired with batching, as we observe in C5.
Rewrites change what is computed (C3). From query rewrites only IMDB is affected, since only Q7 applies filter pushdown, and Q11 fusion of semantic operators, leading to 20–36% fewer calls, preserving or boosting F1 score. The rest of the queries remain unchanged, leading to overall gains in all observed axes, hinting that the extended algebra and its properties play a significant role when integrated with traditional query engines.
Repartitioning smooths batches (C4). On top of batching, repartitioning removes most of C1's wall-clock penalty on the self-hosted models (with Qwen3-8B, ×1.39 → 1.08 on IMDB and ×4.76 → 2.05 on SemBench) but returns part of the token consumption savings (IMDB: ×0.35–0.44, from ×0.26–0.29). The operator deflate the partitions' token loads ( on row inputs) and this s spread is what produces: ×0.33–0.84 speedups on the 12 Qwen pairs. Thus, repartitioning operator is valuable only when the engine is capable of processing rows in batches, and
Putting all together (C5). Full NousDB contains all optimizations leading to the following reductions: ×0.05–0.18 on model calls, ×0.17–0.41 on token consumption and ×0.18–0.31 at wall clock with GPT-5.4-nano and ×0.57–0.74 on IMDB with Qwen. On SemBench with Qwen, stays slower than C0 (×1.5) through SB1 and SB3, which C0 finishes in 2–12 s, but in this setting SB1 has a LIMIT operator on the query and the whole benchmark consists of single semantic operator queries, making the rewrites never applied. On the joins Q3 and Q11, Qwen3-8B reaches its best F1 of the six configurations (0.759 and 0.789, from 0.114 and 0.582 in C0) at ×0.10 and ×0.15 of C0's tokens. However, C5 is not the quality optimum everywhere: in 64-pair blocks GPT-5.4-nano's joins fall to 0.467 on Q11 and 0.216 on SB7, from 0.819 (C3) and 0.591 (C0), which is what the certificate guards against.
5.5 Summary of Findings
From our evaluation we extracted the following findings: RQ1: NousDB is the fastest system in every benchmark and model setting (up to and in geometric mean on JOB and STACK), spends the fewest tokens on 40 of 42 query cells, and a NousDB configuration is the most accurate in each. RQ2: Batch sizing cuts tokens to of per-row execution without a context overflow, but changes up to 45% of the answers. The certificate keeps at least 86% of them, and reasoning, affordable only when batched, raises quality. RQ3: Batch sizing carries the cost reduction, rewriting reduces the work itself, repartitioning lowers latency by spreading requests over all partitions, and the three compose. All optimizations together smoothen the weaknesses caused from each one separately, making NousDB optimizations work cooperatively rather than competitively. RQ4: Pushdowns remove 20–47% of the tuples that reach a model and preserve the answers up to run-to-run noise, while fusion improves them (Q10's F1 doubles with Qwen3-8B and quadruples with GPT-5.4-nano).
6 Conclusions
We presented an extended algebra for semantic query processing by formalizing semantic operators that compose with relational algebra, enabling semantic query rewriting and a system that implements it, NousDB. We showed that semantic analytics fundamentally departs from classical optimization by shifting the unit of cost from rows to tokens, which introduces new challenges in batch sizing and parallel execution under token skew. We addressed these challenges with a token-based cost model, statistical guarantees for safe and accurate batching, and token-aware repartitioning, integrated into a modern query engine. Future work includes extending the algebra with additional semantic operators, incorporating quality into cost models, and query optimization.
References
[1] Eric Anderson, Jonathan Fritz, Austin Lee, Bohou Li, Mark Lindblad, Henry Lindeman, Alex Meyer, Parth Parmar, Tanvi Ranade, Mehul A Shah, et al. 2024. The design of an llm-powered unstructured analytics system. arXiv preprint arXiv:2409.00847 (2024).
[2] AI Anthropic. 2024. The claude 3 model family: Opus, sonnet, haiku. Claude-3 Model Card 1, 1 (2024), 4.
[3] Apache Software Foundation. 2026. Apache Arrow. https://arrow.apache.org/
[4] Mikhail Beck, Madeleine Knapp Corneli, Torsten Kilian, Marlene Krefß, Christoph Kuhnke, Marco Nätlitz, and Thomas Übensee. 2025. Exasol Text AI: In-Database
Continuous Text Analytics. In INFORMATIK 2025. Gesellschaft für Informatik eV, 1509.
[5] Asim Biswal, Liana Patel, Siddarth Jha, Amog Kamsetty, Shu Liu, Joseph E Gonzalez, Carlos Guestrin, and Matei Zaharia. 2024. Text2sql is not enough: Unifying ai and databases with tag. arXiv preprint arXiv:2408.14717 (2024).
[6] Zhoujun Cheng, Jungo Kasai, and Tao Yu. 2023. Batch Prompting: Efficient Inference with Large Language Model APIs. In Conference on Empirical Methods in Natural Language Processing. https://api.semanticscholar.org/CorpusID:256080546
[7] C. J. CLOPPER and E. S. PEARSON. 1934. THE USE OF CONFIDENCE OR FIDUCIAL LIMITS ILLUSTRATED IN THE CASE OF THE BINOMIAL. Biometrika 26, 4 (12 1934), 404–413. https://doi.org/10.1093/biomet/26.4.404 arXiv:https://academic.oup.com/biomet/article-pdf/26/4/404/823407/26-4-404.pdf
[8] Peizhuang Cong, Qizhi Chen, Haochen Zhao, and Tong Yang. 2025. BATON: Enhancing Batch-wise Inference Efficiency for Large Language Models via Dynamic Re-batching. In Proceedings of the ACM on Web Conference 2025 (Sydney NSW, Australia) (WWW '25). Association for Computing Machinery, New York, NY, USA, 2309–2318. https://doi.org/10.1145/3696410.3714950
[9] Hanjun Dai, Bethany Wang, Xingchen Wan, Bo Dai, Sherry Yang, Azade Nova, Pengcheng Yin, Mangpo Phothilimthana, Charles Sutton, and Dale Schuurmans. 2024. UQE: A Query Engine for Unstructured Databases. Advances in Neural Information Processing Systems 37 (2024), 29807–29838.
[10] Victor Giannakouris. [n.d.]. SwellDB: GenAI-Native Query Processing via On-the-Fly Table Generation. Proceedings of the VLDB Endowment. ISSN 2150 ([n. d.]), 8097.
[11] Parker Glenn, Parag Pravin Dakle, Liang Wang, and Preethi Raghavan. 2024. Blendsql: A scalable dialect for unifying hybrid question answering in relational algebra. arXiv preprint arXiv:2402.17882 (2024).
[12] R. L. Graham. 1969. Bounds on Multiprocessing Timing Anomalies. SIAM J. Appl. Math. 17, 2 (1969), 416–429. https://doi.org/10.1137/0117039 arXiv:https://doi.org/10.1137/0117039
[13] Yuxing Han, Ziniu Wu, Peizhi Wu, Rong Zhu, Jingyi Yang, Liang Wei Tan, Kai Zeng, Gao Cong, Yanzhao Qin, Andreas Pfadler, Zhengping Qian, Jingren Zhou, Jiangneng Li, and Bin Cui. 2021. Cardinality estimation in DBMS: a comprehensive benchmark evaluation. Proc. VLDB Endow. 15, 4 (dec 2021), 752–765. https://doi.org/10.14778/3503585.3503586
[14] Benjamin Hättasch. 2021. WannaDB: Ad-hoc Structured Exploration of Text Collections Using Queries.. In DESIRES. 179–180.
[15] Benjamin Hättasch, Jan-Micha Bodensohn, Liane Vogel, Matthias Urban, and Carsten Binnig. 2023. WannaDB: Ad-hoc SQL Queries over Text Collections. In BTW 2023. Gesellschaft für Informatik eV, 157–181.
[16] Zhaoxuan Ji, Xinlu Wang, Zhaojing Luo, Zhongle Xie, and Meihui Zhang. 2025. Optimized Batch Prompting for Cost-Effective LLMs. Proc. VLDB Endow. 18, 7 (March 2025), 2172–2184. https://doi.org/10.14778/3734839.3734853
[17] Saehan Jo and Immanuel Trummer. 2023. Demonstration of thalamusdb: answering complex sql queries with natural language predicates on multi-modal data. In Companion of the 2023 International Conference on Management of Data. 179–182.
[18] Saehan Jo and Immanuel Trummer. 2024. Thalamusdb: Approximate query processing on multi-modal data. Proceedings of the ACM on Management of Data 2, 3 (2024), 1–26.
[19] Daniel Kang, Edward Gan, Peter Bailis, Tatsunori Hashimoto, and Matei Zaharia. 2020. Approximate selection with guarantees using proxies. arXiv preprint arXiv:2004.00827 (2020).
[20] Rohit Khoja, Devanshu Gupta, Yanjie Fu, Dan Roth, and Vivek Gupta. 2025. Weaver: Interweaving SQL and LLM for Table Reasoning. arXiv preprint arXiv:2505.18961 (2025).
[21] Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient Memory Management for Large Language Model Serving with PagedAttention. In Proceedings of the 29th Symposium on Operating Systems Principles (Koblenz, Germany) (SOSP '23). Association for Computing Machinery, New York, NY, USA, 611–626. https://doi.org/10.1145/3600006.3613165
[22] Andrew Lamb, Yijie Shen, Daniël Heres, Jayjeet Chakraborty, Mehmet Ozan Kabak, Liang-Chi Hsieh, and Chao Sun. 2024. Apache Arrow DataFusion: A Fast, Embeddable, Modular Analytic Query Engine. In Companion of the 2024 International Conference on Management of Data (Santiago AA, Chile) (SIGMOD '24). Association for Computing Machinery, New York, NY, USA, 5–17. https://doi.org/10.1145/3626246.3653368
[23] Jiale Lao, Andreas Zimmerer, Olga Ovcharenko, Tianji Cong, Matthew Russo, Gerardo Vitagliano, Michael Cochez, Fatma Özcan, Gautam Gupta, Thibaud Hottelier, H. V. Jagadish, Kris Kissel, Sebastian Schelter, Andreas Kipf, and Immanuel Trummer. 2025. SemBench: A Benchmark for Semantic Query Processing Engines. arXiv:2511.01716 [cs.DB] https://arxiv.org/abs/2511.01716
[24] Viktor Leis, Andrey Gubichev, Atanas Mirchev, Peter Boncz, Alfons Kemper, and Thomas Neumann. 2015. How good are query optimizers, really? Proc. VLDB Endow. 9, 3 (Nov. 2015), 204–215. https://doi.org/10.14778/2850583.2850594
[25] Zequn Li, Yuanhao Zhong, Chengliang Chai, Zhaoze Sun, Yuhao Deng, Ye Yuan, Guoren Wang, and Lei Cao. 2025. DocDB: A Database for Unstructured Document Analysis. Proceedings of the VLDB Endowment 18, 12 (2025), 5387–5390.
[26] Jianzhe Lin, Maurice Diesendruck, Liang Du, and Robin Abraham. 2024. Batch-prompt: Accomplish more with less. In International Conference on Learning Representations, Vol. 2024. 21590–21612.
[27] Yiming Lin, Madelon Hulsebos, Ruiying Ma, Shreya Shankar, Sepanta Zeigham, Aditya G Parameswaran, and Eugene Wu. 2024. Towards accurate and efficient document analytics with large language models. arXiv preprint arXiv:2405.04674 (2024).
[28] Chunwei Liu, Matthew Russo, Michael Cafarella, Lei Cao, Peter Baile Chen, Zui Chen, Michael Franklin, Tim Kraska, Samuel Madden, Rana Shahout, et al. 2025. Palimpzest: Optimizing ai-powered analytics with declarative query processing. In Proceedings of the Conference on Innovative Database Research (CIDR). 2.
[29] Chunwei Liu, Matthew Russo, Michael Cafarella, Lei Cao, Peter Baile Chen, Zui Chen, Michael Franklin, Tim Kraska, Samuel Madden, and Gerardo Vitagliano. 2024. A declarative system for optimizing ai workloads. arXiv preprint arXiv:2405.14696 (2024).
[30] Jia-Yi Liu, Tinghan Yang, and Jennifer Neville. 2024. CliqueParcel: An Approach For Batching LLM Prompts That Jointly Optimizes Efficiency And Faithfulness. In SmaLLEXT@CIKM. https://api.semanticscholar.org/CorpusID:267897588
[31] Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, Dekang Lin, Yuji Matsumoto, and Rada Mihalcea (Eds.). Association for Computational Linguistics, Portland, Oregon, USA, 142–150. https://aclanthology.org/P11-1015/
[32] Farhad Nooralahzadeh, Yi Zhang, Jonathan Furst, and Kurt Stockinger. 2024. Explainable Multi-Modal Data Exploration in Natural Language via LLM Agent. arXiv preprint arXiv:2412.18428 (2024).
[33] OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, Red Avila, Igor Babuschkin, Suchir Balaji, Valerie Balcom, Paul Baltescu, Haiming Bao, Mohammad Bavarian, Jeff Belgium, Irwan Bello, Jake Berdine, Gabriel Bernadett-Shapiro, Christopher Berner, Lenny Bodonoff, Oleg Boiko, Madelaine Boyd, Anna-Luisa Brakman, Greg Brockman, Tim Brooks, Miles Brundage, Kevin Button, Trevor Cai, Rosie Campbell, Andrew Cann, Brittany Carey, Chelsea Carlson, Rory Carmichael, Brooke Chan, Che Chang, Fotis Chantzis, Derek Chen, Sully Chen, Ruby Chen, Jason Chen, Mark Chen, Ben Chess, Chester Cho, Casey Chu, Hyung Won Chung, Dave Cummings, Jeremiah Currier, Yunxing Dai, Cory Decareaux, Thomas Degry, Noah Deutsch, Damien Deville, Arka Dhar, David Dohan, Steve Dowling, Sheila Dunning, Adrien Ecoffet, Atty Eleti, Tyna Eloundou, David Farhi, Liam Fedus, Niko Felix, Simón Posada Fishman, Juston Forte, Isabella Fulford, Leo Gao, Elie Georges, Christian Gibson, Vik Goel, Tarun Gogineni, Gabriel Goh, Rapha Gontijo-Lopes, Jonathan Gordon, Morgan Grafstein, Scott Gray, Ryan Greene, Joshua Gross, Shixiang Shane Gu, Yufei Guo, Chris Hallacy, Jesse Han, Jeff Harris, Yuchen He, Mike Heaton, Johannes Heidecke, Chris Hesse, Alan Hickey, Wade Hickey, Peter Hoeschele, Brandon Houghton, Kenny Hsu, Shengli Hu, Xin Hu, Joost Huizinga, Shantan Jain, Shawn Jain, Joanne Jang, Angela Jiang, Roger Jiang, Haozhun Jin, Denny Jin, Shino Jomoto, Billie Jonn, Heewoo Jun, Tomer Kaftan, Lukasz Kaiser, Ali Kamali, Ingmar Kanitscheider, Nitish Shirish Keskar, Tabarak Khan, Logan Kilpatrick, Jong Wook Kim, Christina Kim, Yongjik Kim, Jan Hendrik Kirchner, Jamie Kiros, Matt Knight, Daniel Kokotajlo, Lukasz Kondraciuk, Andrew Kondrich, Aris Konstantinidis, Kyle Kosic, Gretchen Krueger, Vishal Kuo, Michael Lampe, Ikai Lan, Teddy Lee, Jan Leike, Jade Leung, Daniel Levy, Chak Ming Li, Rachel Lim, Molly Lin, Stephanie Lin, Mateusz Litwin, Theresa Lopez, Ryan Lowe, Patricia Lue, Anna Makanju, Kim Malfacini, Sam Manning, Todor Markov, Yaniv Markovski, Bianca Martin, Katie Mayer, Andrew Mayne, Bob McGrew, Scott Mayer McKinney, Christine McLeavey, Paul McMillan, Jake McNeil, David Medina, Aalok Mehta, Jacob Menick, Luke Metz, Andrey Mishchenko, Pamela Mishkin, Vinnie Monaco, Evan Morikawa, Daniel Mossing, Tong Mu, Mira Murati, Oleg Murk, David Mély, Ashvin Nair, Reichiro Nakano, Rajeev Nayak, Arvind Neelakantan, Richard Ngo, Hyeonwoo Noh, Long Ouyang, Cullen O'Keefe, Jakub Pachocki, Alex Paino, Joe Palermo, Ashley Pantuliano, Giambattista Parascandolo, Joel Parish, Emy Parparita, Alex Passos, Mikhail Pavlov, Andrew Peng, Adam Perelman, Filipe de Avila Belbute Peres, Michael Petrov, Henrique Ponde de Oliveira Pinto, Michael, Pokorny, Michelle Pokrass, Vitchyr H. Pong, Tolly Powell, Alethea Power, Boris Power, Elizabeth Proehl, Raul Puri, Alec Radford, Jack Rae, Aditya Ramesh, Cameron Raymond, Francis Real, Kendra Rimbach, Carl Ross, Bob Rotsted, Henri Roussez, Nick Ryder, Mario Saltarelli, Ted Sanders, Shibani Santurkar, Girish Sastry, Heather Schmidt, David Schnurr, John Schulman, Daniel Selsam, Kyla Sheppard, Toki Sherbakov, Jessica Shieh, Sarah Shoker, Pranav Shyam, Szymon Sidor, Eric Sigler, Maddie Simens, Jordan Sitkin, Katarina Slama, Ian Sohl, Benjamin Sokolowsky, Yang Song, Natalie Staudacher, Felipe Petroski Such, Natalie Summers, Ilya Sutskever, Jie Tang, Nikolas Tezak, Madeleine B. Thompson, Phil Tillet, Amin Tootoonchian, Elizabeth Tseng, Preston Tuggle, Nick Turley, Jerry Tworek, Juan Felipe Cerón Uribe,
Andrea Vallone, Arun Vijayvergiya, Chelsea Voss, Carroll Wainwright, Justin Jay Wang, Alvin Wang, Ben Wang, Jonathan Ward, Jason Wei, CJ Weinmann, Akila Welihinda, Peter Welinder, Jiayi Weng, Lilian Weng, Matt Wiethoff, Dave Willner, Clemens Winter, Samuel Wolrich, Hannah Wong, Lauren Workman, Sherwin Wu, Jeff Wu, Michael Wu, Kai Xiao, Tao Xu, Sarah Yoo, Kevin Yu, Qiming Yuan, Wojciech Zaremba, Rowan Zellers, Chong Zhang, Marvin Zhang, Shengjia Zhao, Tianhao Zheng, Juntang Zhuang, William Zhuk, and Barret Zoph. 2024. GPT-4 Technical Report. arXiv:2303.08774 [cs.CL] https://arxiv.org/abs/2303.08774
[34] Liana Patel, Negar Arabzadeh, Harshit Gupta, Ankita Sundar, Ion Stoica, Matei Zaharia, and Carlos Guestrin. 2025. DeepScholar-Bench: A Live Benchmark and Automated Evaluation for Generative Research Synthesis. arXiv preprint arXiv:2508.20033 (2025).
[35] Liana Patel, Siddharth Jha, Parth Asawa, Melissa Pan, Carlos Guestrin, and Matei Zaharia. 2024. Semantic Operators: A Declarative Model for Rich, AI-based Analytics Over Text Data. arXiv:2407.11418 [cs.DB] https://arxiv.org/abs/2407.11418
[36] Liana Patel, Siddharth Jha, Melissa Pan, Harshit Gupta, Parth Asawa, Carlos Guestrin, and Matei Zaharia. 2024. Semantic Operators: A Declarative Model for Rich, AI-based Data Processing. arXiv preprint arXiv:2407.11418 (2024).
[37] Viswanath Poosala, Peter J. Haas, Yannis E. Ioannidis, and Eugene J. Shekita. 1996. Improved histograms for selectivity estimation of range predicates. SIGMOD Rec. 25, 2 (June 1996), 294–305. https://doi.org/10.1145/235968.233342
[38] Kangkang Qi, Dongyang Xie, Wenbo Li, Hao Zhang, Yuanyuan Zhu, Jeffrey Xu Yu, and Kangfei Zhao. 2026. Sema: A High-performance System for LLM-based Semantic Query Processing. PVLDB 19, 11 (2026), 3231–3244. https://doi.org/10.14778/3836663.3836685
[39] Martin Raab and Angelika Steger. 1998. "Balls into Bins" - A Simple and Tight Analysis. In Proceedings of the Second International Workshop on Randomization and Approximation Techniques in Computer Science (RANDOM '98). Springer-Verlag, Berlin, Heidelberg, 159–170.
[40] Matthew Russo, Sivaprasad Sudhir, Gerardo Vitagliano, Chunwei Liu, Tim Kraska, Samuel Madden, and Michael Cafarella. 2025. Abacus: A Cost-Based Optimizer for Semantic Operator Systems. arXiv preprint arXiv:2505.14661 (2025).
[41] Mohammed Saeed, Nicola De Cao, and Paolo Papotti. 2023. Querying large language models with SQL. arXiv preprint arXiv:2304.00472 (2023).
[42] Shreya Shankar, Tristan Chambers, Tarak Shah, Aditya G Parameswaran, and Eugene Wu. 2024. Docetl: Agentic query rewriting and evaluation for complex document processing. arXiv preprint arXiv:2410.12189 (2024).
[43] Aaditya Singh, Adam Fry, Adam Perelman, Adam Tart, Adi Ganesh, Ahmed El-Kishky, Aidan McLaughlin, Aiden Low, AJ Ostrow, Akhila Ananthram, et al. 2025. Openai gpt-5 system card. arXiv preprint arXiv:2601.03267 (2025).
[44] Ji Sun, Guoliang Li, Peiyao Zhou, Yihui Ma, Jingzhe Xu, and Yuan Li. 2025. Agenticdata: An agentic data analytics system for heterogeneous data. arXiv preprint arXiv:2508.05002 (2025).
[45] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971 (2023).
[46] Matthias Urban and Carsten Binnig. 2024. Efficient learned query execution over text and tables [technical report]. arXiv preprint arXiv:2410.22522 (2024).
[47] Matthias Urban and Carsten Binnig. 2024. Eleet: Efficient learned query execution over text and tables. Proceedings of the VLDB Endowment 17, 13 (2024), 4867–4880.
[48] Jiayi Wang, Yuan Li, Jianming Wu, Shihui Xu, and Guoliang Li. 2025. Unify: A System For Unstructured Data Analytics. Proceedings of the VLDB Endowment 18, 12 (2025), 5287–5290.
[49] Tianqing Wang, Xun Xue, Guoliang Li, and Yong Wang. 2025. AnDB: Breaking Boundaries with an AI-Native Database for Universal Semantic Analysis. arXiv preprint arXiv:2502.13805 (2025).
[50] Jingfei Wu, Chaoyuan Shen, Qiyan Deng, Yuping Wang, Jiajun Li, Yuhao Deng, and Minghe Yu. [n.d.]. TabAgent: A Multi-Agent Table Extraction Framework for Unstructured Documents. Proceedings of the VLDB Endowment. ISSN 2150 ([n.d.]), 8097.
[51] Haotian Xu, Kangfei Zhao, and Jiadong Xie. 2026. Towards Cost-effective LLMs Routing with Batch Prompting. ArXiv abs/2605.28268 (2026). https://api.semanticscholar.org/CorpusID:288701848
[52] An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, et al. 2025. Qwen3 technical report. arXiv preprint arXiv:2505.09388 (2025).
[53] Sepanta Zeighami, Shreya Shankar, and Aditya Parameswaran. 2025. Cut Costs, Not Accuracy: LLM-Powered Data Processing with Guarantees. Proc. ACM Manag. Data 3, 6, Article 311 (Dec. 2025), 26 pages. https://doi.org/10.1145/3769776
[54] Hengrui Zhang, Yulong Hui, Yihao Liu, and Huanchen Zhang. 2025. ScaleDoc: Scaling LLM-based Predicates over Large Document Collections. arXiv preprint arXiv:2509.12610 (2025).
[55] Fuheng Zhao, Divyakant Agrawal, and Amr El Abbadi. 2024. Hybrid querying over relational databases and large language models. arXiv preprint arXiv:2408.00884 (2024).
[56] Yuanhao Zhong, Yuhao Deng, Chengliang Chai, Ruixin Gu, Ye Yuan, Guoren Wang, and Lei Cao. 2025. Doctopus: A System for Budget-aware Structural Data Extraction from Unstructured Documents. In Companion of the 2025 International Conference on Management of Data. 275–278.