Many applications store records with structured columns and a text document, and ask how many records in a filtered set meet a criterion that only a reader of the text can judge, such as "How many patients with type 2 diabetes, aged 40 to 70, stopped metformin because their blood sugar stayed high?" An interactive application needs this count in seconds, as the user types the criterion, to decide whether the matching set is worth materializing with a batch pipeline in which an LLM judges the records. Prior approximate query processing over such semantic predicates has an expensive model, the oracle, label a sample at query time, so every query waits for the oracle. We present SignalCount, a production system that answers COUNT queries with structured and semantic predicates and calls no oracle at query time, even for ad-hoc criteria. Its oracle is the production LLM judge, and the judge's logged verdicts calibrate, offline, the fast classifier that already runs in front of the judge. At query time, SignalCount counts the filtered set exactly and draws a uniform sample of at most 1,000 records in one columnar scan, scores the sample with the classifier, and multiplies the average calibrated probability by the exact count. Its 90% interval combines a sampling term with one-sided, rate-dependent margins for calibration error, fitted by split conformal prediction across tenants. In a multi-tenant production deployment, latency has a p99 of 3.8 s and stays flat as the filtered set grows beyond the sample. On tenants held out from fitting, the interval covers the count that the production pipeline returns in 92% of estimates, although estimates run about 15% high in aggregate, because a calibration nearly unbiased per record is still biased per criterion.
Figures & tables
Figure 1. Shaping a cohort as the user types the criterion. Each estimate arrives in seconds; bars show its likely range against the screening capacity (dashed). Saving runs the batch pipeline. A cohort builder for trial recruitment. Filter chips read Diagnosis Type 2 diabetes, Age 40 to 70, Seen since Jan 1 and Near a trial site, and 50,000 patients match. The criterion box reads Stopped metformin because blood sugar stayed high. Below it, the versions of the criterion are listed newest first, each with its estimate and the time the estimate took: the current one, Stopped metformin because blood sugar stayed high, about 2,000 patients, estimated in 2.5 seconds; and, grayed out, Stopped metformin, about 4,000 patients in 2.7 seconds, and Tried metformin, about 9,000 patients in 2.4 seconds. Under each attempt, a bar shows its likely range against a dashed line at a screening capacity of 3,000 charts; only the current range lies below it. At the bottom, About 2,000 patients match your filters and criterion, next to a button Save cohort and find all patients.
Figure 2. Latency of 112 production estimates against the size of the filtered set. Sets of at most 1,000 records are scored in full (shaded). Lines join percentiles per size group. Scatter plot of end-to-end latency against filtered-set size on a log axis for 112 estimates, with percentile lines per size group and a dashed 5 second line. Latency rises with size up to 1,000 records, where the whole set is scored, and stays flat near 2.5 to 3.9 seconds above that, below the 5 second line.
Figure 3. Request path of an estimate. Every stage after the analytical query does work bounded by the sample cap of 1,000. Labels give p90 / p99 per stage over the latency workload (Section 5.2 ). A left-to-right pipeline of five boxes: API route, analytical query on a columnar store, document fetch from a row store, scoring with one classifier call per record, and the estimator, which returns the estimate, interval, flags and counts to the route. The query, fetch and scoring boxes are labeled with p90 and p99 latencies of 812/1045, 481/1365 and 1753/2294 ms.
Table, pairs
Pairs
All
≥ 0.10
Initial, in-sample study
188,757
0.0065
0.0262
Initial, main study
1,660,862
0.0083
0.0275
Deployed form, main study, out of fold
1,660,862
0.0037
0.0012
Calibrated probability
Records
Predicted
Observed
0 (score below 0.10)
1,373,189
0
0.0042
[0,0.1)
20,165
0.0736
0.0573
Table 1. Expected calibration error of the calibration table. Out of fold: refitted on 5 tenant folds of the main study’s pairs, each pair scored by the table fitted without its tenant. Bottom: reliability of the initial table on the main study’s pairs.
Quantity
Meaning
Set
N
size of the filtered set
per query, counted exactly
n
records scored, at most 1,000
per query
Yi , θ
verdict on record i (1 or 0); true count, their sum
unknown at query time
pi
record i ’s calibrated probability
per record, read from the table
pˉ , θ^
estimated rate; estimate Npˉ
per query, from the sample
V , W
variance of pi ; average of pi(1−pi)
per query, from the sample
Table 2. Quantities in the interval, and when each is set.
Figure 4. The running example’s 90% interval around the estimate of 2,000 patients: the calibration margin (wider on the low side) and the sampling term on each side. Of the width of 2,390, the margins contribute about 1,490 and the sampling term about 900; the floor of about 115 patients does not bind. A horizontal bar on a patient-count axis showing the interval from 418 to 2,808 around an estimate of 2,000. Each side is split into a calibration-margin segment and a sampling segment of about 450 patients, and the low-side margin segment is the widest.
Estimated rate
below 1%
1–5%
5–20%
above 20%
Group center
0.3%
2.24%
10%
44.7%
Low factor fL
0.81
0.47
0.38
0.53
High factor fU
1.31
1.11
1.30
1.53
Table 3. Deployed margin factors by estimated-rate group.
Latency
In-sample
Main
Tenants
fewer than 25
fewer than 25
hundreds
Estimates issued / answered
112 / 112
244 / 244
2,123 / 2,119
Filtered sets
112
142
1,687
Criteria
14
136
1,766
Estimates per tenant, median / max
7 / 20
13 / 19
1 / 19
N , median
2,435
5,561
2,362
Table 4. The three workloads. Size and predicate rows count each issued filtered set once. True-count rows count answered estimates and leave out the in-sample study’s 23 check pairs.
Figure 5. Coverage on held-out tenants over 200 repeated tenant splits, by group, for the deployed calibration: mean (dot and number) and 5th percentile (line end). Dot plot of the deployed calibration's interval coverage, overall and by estimated rate, filtered-set size and true rate, with dots at the mean over 200 tenant splits and lines to the 5th percentile, against the nominal 90 percent. The deployed calibration's mean is 0.920 overall and between 0.90 and 0.951 in every group except sets of 1k to 10k records at 0.881.
Interval
Coverage
Worst group
Width
Global symmetric margin
90.0%
–
1.79
Global one-sided pair
90.3%
80.7%
–
One-sided per group
90.5%
90.4%
1.50
EM prior shift + margins
≤ 86.3%
–
7.63
Point estimate
Med. err.
< 1%
1–5%
5–20%
> 20%
Averaging (SignalCount)
29.6%
1.45
1.58
1.12
0.92
Table 5. Design alternatives, evaluated out of fold. Top: intervals on the main study, cross-fitted by tenant. Bottom: point estimates on the 208 positive-truth in-sample estimates with reproduced scores, 5 tenant folds, initial calibration; ratio of sums by true rate.
Semantic query engines evaluate natural-language filters with a large language model, and every evaluation is a costly oracle call. Optimizers that reduce these calls face a dilemma: cascades that trust a cheap proxy miss their precision and recall targets on many queries, methods with finite-sample guarantees save little, and all of them discard the oracle's labels when the query ends. We present SemViews, a certified semantic filter that orders tuples by signals that cost no oracle calls (the labels that earlier queries left behind as semantic views, a local embedding, and a helper model's score), refines that order with labels it must pay for anyway, and certifies its answer with fresh stratified oracle samples. The answer meets user precision and recall targets with probability at least 1−δ for every workload and every catalog, so a stale or misleading view can cost oracle calls but never accuracy. On four workloads replayed against 725,000 recorded oracle labels, SemViews meets both targets on 99.63% of queries and saves 28%-45% of the oracle calls, whereas the only prior method in our study with the same guarantee needs 1.32x-1.71x as many calls. When a question returns in different words, views cut its calls by a further 27%-36%, with both targets met on at least 99.8% of such queries; similarity caches and entailment-based reuse meet them on only 17%-47%.
User-facing LLM agents must identify which behavioral policies apply at each turn, but evaluating every policy with an LLM is costly. We introduce Signals and Queries (S&Q), a lightweight first-stage relevance filter developed for Parlant 4.0 that removes at least 30% of candidate policies before downstream evaluation while preserving high recall. For each policy, an LLM generates activating examples and hard negatives offline. An independent logistic classifier trained on their embeddings then predicts relevance using embeddings and vector dot products, with no per-turn LLM calls. This shifts expensive relevance evaluation to a smaller candidate set, while allowing each policy's classifier to be updated independently. Evaluated against 9,144 LLM-judge relevance labels covering 254 τ2-bench conversation prefixes and 36 airline policies, S&Q achieves higher precision than top-K and cosine-threshold retrieval at every evaluated recall level, with consistent results across two embedding providers. These findings support inexpensive, per-policy classification as a practical first stage for reducing downstream evaluation workload in customer-facing agents.
Cardinality estimation is essential for query optimization, but most existing learned estimators focus on a single predicate type, such as string LIKE clauses or numerical range filters. In practice, analytical workloads often combine both types, while the accuracy of string estimators tends to decrease with longer patterns. We introduce MultiCard, a comprehensive learned cardinality estimator that unifies LIKE predicates and numerical filters within a single end-to-end architecture. By combining a Transformer for long-range sparse patterns with an LSTM for short, frequent patterns, MultiCard achieves robust pattern modeling. In parallel, a numerical encoder integrates catalog histograms and structural predicate features, enabling the model to dynamically assess histogram estimation accuracy across different operators and data skew conditions. A final Transformer layer captures interactions among heterogeneous predicates before a multilayer perceptron predicts query cardinalities. We also introduce UPCI, a workload generator that produces length-balanced LIKE patterns, multi-column numerical predicates, and exact cardinality labels for training and evaluation. Experiments on five real-world datasets show that, for string-only workloads, MultiCard achieves the best or near-best Q-error across all datasets compared with state-of-the-art methods. For mixed multi-attribute queries, MultiCard reduces PostgreSQL's mean Q-error by up to 16 times while maintaining an inference latency below 5 ms.
Mobina Koochaknia, Maryam Ramezani, Mohammad Hasan Shafaat