Skip to content

Do Semantic Query Engines Need LLMs? An Experimental Study of Decision Models

Oktie Hassanzadeh, Long Vu, Dharmashankar Subramanian

cs.DB

Abstract

Semantic query processing engines (SQPEs) evaluate predicates written in natural language inside SQL by prompting large language models (LLMs), and many send the decisions a cheaper model is unsure of to a larger LLM. Yet a predicate often asks a question with a fixed set of answers, such as whether a review is positive, and a new kind of model targets such questions: decision models, small models that answer yes/no, choice and score questions with a probability for every answer. We present an experimental study of whether semantic query engines still need LLMs. Its key idea is to treat the reference as a variable. Every decision is scored against two references, the gold that people entered and what its text says, and every engine is calibrated with labels from the reference it is scored against. We run the study on SemBench and on DecideBench, a new benchmark whose answers combine many decisions through joins, quantifiers, negation and aggregates, in DecideSQL, a DuckDB-based engine in which decision models, LLMs, cascades and recorded decisions are interchangeable. Without labels, a 9B decision model matches or beats a 120B LLM on most of the SemBench queries it can answer, at a twelfth of the cost. With 200 labels per predicate, the best decision model answers DecideBench's queries more accurately than every open-weight LLM against the gold, and escalating its uncertain decisions to an LLM whose answers are taken as final mostly makes answers worse. Against the text, which engine wins depends on what a predicate is taken to mean.

Create a lesson

Metadata

Categories
cs.DB, cs.AI
Comments
24 pages, 5 figures, 25 tables. Extended version with appendices