Imagine you’re a researcher at a hospital trying to find patients for a clinical trial. You need people with Type 2 diabetes who stopped taking Metformin specifically because their blood sugar stayed high—not because of stomach aches or other side effects.
Filtering by "Type 2 diabetes" is easy; that’s a checkbox in a database. But finding the reason they stopped? That’s buried in thousands of pages of messy clinical notes. Usually, you’d have to run a slow, expensive batch process where a Large Language Model (LLM) "reads" every file. By the time you get the count, you’ve finished your coffee, and the count might be so small the trial isn't even viable.
The authors of SignalCount want to give you that answer in the time it takes to type the sentence.
TL;DR
SignalCount is a production system that provides approximate counts for complex, natural-language queries (like "patients who stopped meds due to high blood sugar") in under four seconds. It achieves this by using a fast, "proxy" classifier calibrated against past LLM decisions, allowing it to skip expensive LLM calls at query time while providing statistically rigorous confidence intervals.
What Problem Does This Paper Address?
In modern data systems, we often deal with "hybrid" queries. Part of the query is structured (e.g., Age > 40), and part is semantic (e.g., "notes describe flood damage, not wind damage").
While databases are lightning-fast at structured filters, semantic filters are a bottleneck. To get an accurate count, you typically need an "oracle"—usually a high-end LLM—to judge the records. Even if you only sample a few hundred records at query time to get an estimate, a single LLM call can take seconds. If you have to wait for a batch of them, the "interactive" feel of the application dies.
Previous research tried to solve this by using a cheap "proxy" model to guide the sampling, but they still required calling the expensive oracle during the query. SignalCount asks: What if we could skip the oracle entirely at query time?
Methods
The secret sauce of SignalCount is moving the expensive work offline.
- Offline Calibration: The system looks at the logs of the actual production pipeline. It takes the scores from a fast, cheap classifier (the proxy) and compares them to the final "yes/no" verdicts from the expensive LLM judge (the oracle). Using isotonic regression, it builds a calibration table that maps a proxy score (say, 0.7) to a real-world probability (say, 85% chance the LLM would agree).
- The One-Scan Query: When a user types a criterion, the system performs a single SQL scan. It calculates the exact count of records passing the structured filters and simultaneously grabs a random "bottom-k" sample of up to 1,000 records.
- Bounded Scoring: The system fetches the text for only those 1,000 records and scores them using the fast classifier. Because the sample size is capped, the "model work" doesn't grow even if the database has millions of records.
- Statistical Safety Net: Since the proxy isn't perfect, the system uses split conformal prediction to calculate a 90% confidence interval. This isn't just a standard bell-curve interval; it accounts for "calibration error"—the risk that the classifier is more biased for this specific query than it was on average in the past.
Datasets
The authors evaluated SignalCount using real-world data from their multi-tenant SaaS platform:
- Calibration Set: 1.66 million (score, verdict) pairs logged from actual production LLM runs.
- Main Study: 2,119 estimates across hundreds of different customer "tenants," using real saved filters and criteria.
- Latency Workload: 112 production estimates used to measure real-world responsiveness.
Key Insights and Ideas
- The "Oracle" is a Log File: By treating the production LLM's history as the ground truth, the authors realized they didn't need to call the LLM now if they had enough data to know how it behaved then.
- Latency Independence: By capping the sample at 1,000 records, the system's bottleneck becomes the initial database scan. Everything else—fetching text, scoring, and calibrating—takes a constant amount of time regardless of whether you are filtering 5,000 or 5,000,000 records.
- Rate-Dependent Margins: The error isn't symmetric. If a criterion is very rare, the estimate tends to be noisier. SignalCount uses different "widening" factors for the interval based on how common the matches are, which significantly improved the reliability of the bounds.
Key Results
- Speed: The 99th percentile (p99) latency was 3.76 seconds. For large datasets, this is over 1,100x faster than running a full LLM pipeline.
- Reliability: In tests on "held-out" tenants (data the model hadn't seen during calibration), the 90% interval correctly contained the true count 92% of the time.
- Cost: Running an estimate is essentially "free" compared to the LLM pipeline, which would cost hundreds of dollars and take hours for a 500,000-record set.
Limitations and Future Work
- Aggregate Bias: While the intervals are reliable, the point estimates (the "About 2,000 patients" number) tend to run about 15% high on average.
- The "Oracle" Assumption: The system assumes the LLM judge is always right. If the LLM is biased or wrong, SignalCount will faithfully replicate that error.
- Limited to COUNT: Currently, the system only estimates counts. The authors suggest that estimating sums or averages (e.g., "What is the average bill for these patients?") is a logical next step.
- Future Hybridization: The authors mention that they could eventually incorporate a few live LLM calls at query time to "de-bias" the estimate even further, combining the best of both worlds.
Summary updated