When fine-tuning models like Llama 3, you might generate up to 32 candidate answers for each training example—only the one with the highest score makes it to the next round. Rinse and repeat six times, and the quality model gets called tens of millions of times. Reinforcement Learning from Human Feedback (RLHF) has become standard, but its computational price tag is staggering. Reframing the whole process as an SQL query—something like `SELECT * ORDER BY score LIMIT 1`—makes it obvious: you don’t have to run the pricey evaluator on every single candidate. That insight opens up a whole new space for optimization at the intersection of Large Language Models and probability theory.
The authors propose two complementary approaches. The first is an approximate query processing (AQP) strategy: think of it like prospecting—you take soil samples, estimate the average gold content, and once the confidence interval narrows to your target, you stop digging. Computationally, that means progressively sampling rows, calling the oracle on each, updating a running estimate of the aggregate (sum, average, count), and halting when the result stabilizes. For ranking queries with a LIMIT clause, the criterion shifts to order statistics: sampling ends when the kth best result stops budging. The second approach is a surrogate filter model (PM): you train a compact decision tree on shallow features (answer length, presence of formulas, special characters) using a small subset of oracle-labeled data. Unlike neural network proxies that need GPU inference for every candidate, a decision tree runs on a CPU in milliseconds. The tree then rapidly scans all records and passes only “borderline” cases to the expensive oracle—anything obvious gets discarded or accepted on the spot. This creates cascaded gating: if the spread of predictions within a group is tiny, the whole group is skipped; otherwise, only the likely weak answers get weeded out.
On TPC-DS benchmarks with aggregation queries, the AQP strategy hit less than 10% error while using only 10–15% of the oracle calls—a savings of 85–90%. On real fine-tuning pipelines for LLaMA and Qwen models, covering math reasoning (GSM8K) and code generation (HumanEval+), AQP finished sampling with just 20–50% of the calls and an accuracy loss under 5%. Meanwhile, the surrogate PM slashed scoring time by up to 19x—for example, from 1079 seconds to 56 seconds for LLaMA-8B—with a quality drop below 10%. The stochastic estimation converges faster when the data is more uniform. On open-ended instructions (General), the savings were more modest but still significant: throughput improved by 1.2–2.5x. Confidence intervals behaved predictably: they narrowed quickly on uniform label distributions and needed more samples when things were skewed. Crucially, neither strategy modifies the underlying models or requires a database engine rewrite.
The results show that classic query optimizations—approximate computation and proxy filtering—get a second life in the age of LLMs. They’re agnostic to the internals of the evaluator and can be bolted onto any existing pipeline. This busts the myth that speeding up AI demands new architectures: often, you just need to rethink the data flow. For data scientists, it means lower energy costs and cheaper experiments; for developers, a drop-in tool that doesn’t require deep refactoring.
Down the road, such query-centric approaches could extend to multi-step agentic reasoning and retrieval-augmented generation. Instead of chaining models across every document, the system could—like a seasoned geologist—rule out barren patches after a quick glance. Pairing the idea with adaptive query routing to models of different costs would tighten the compute budget even further.
Areas affected: language model training, large-scale analytical pipelines, automatic data labeling, recommendation systems.
Integrate these strategies into database engines (e.g., DuckDB) and test them on more complex agentic scenarios where LLM call chains involve external tools.
The paper tackles the challenge of scaling RLHF and making large-model inference more efficient—a critical issue for sustainable AI. It also throws a bridge to the unsolved problem of automatically optimizing declarative pipelines where computation cost depends on data distribution.
This section is addressed to the author of the paper and their colleagues. Neighbouring works were found by meaning-based search across our archive, not by word overlap. We do not review: we show the field around the work.
What the work does
The paper proposes two approaches to reduce the number of expensive oracle calls in RLHF pipelines: approximate query processing (AQP) with progressive sampling and early stopping based on confidence intervals, and a surrogate model filter (PM) based on a decision tree trained on shallow features. The methods were tested on TPC-DS benchmarks and real-world fine-tuning pipelines for LLaMA and Qwen on mathematical reasoning and code generation tasks, showing significant computational savings with moderate accuracy loss.
Where its strength is
The strength of the work lies in transferring mature query optimization techniques from the database domain (AQP, cascade gating) to the RLHF context, which sharply reduces oracle inference costs without substantial quality degradation. The simplicity and interpretability of the decision-tree-based surrogate model running on CPU make the approach practical for real systems.
Where it could go next
Worth trying
Why this may matter
The proposed optimizations could make RLHF more accessible to researchers and companies with limited computational resources, speeding up development iterations and reducing carbon footprint. Furthermore, transferring methods from databases to machine learning paves the way for systematic application of mature query optimization techniques in new domains.
Nearby works in our archive
The archive is sparse around this work: the closest review is only 0.58, against a usual 0.64. It looks like few have drilled nearby.
The most eye-popping result: for the Qwen3-32B code generator, the proxy model cut the reward scorer’s runtime from 175 seconds to just 10 seconds, an 18x speedup, while keeping accuracy (pass@1) within 1% of the full run.
While there’s no direct analog, the idea of “smart sifting” echoes the concept of using limited resources to extract the most value — a timeless theme in engineering fiction, from ore smelters to data refineries.