arXiv:2610.32586cs.DBOct 2026

Manuscript Offprint

arXiv:2610.32586

OCTOPUS: Towards A Tag Model for Cross-Query Reuse in Semantic Query Processing

GuangXue Zhang, Nada Lahjouji, Yiming Lin, Ashwin Colaco, Sharad Mehrotra

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

GuangXue Zhang

University of California, Irvine

Irvine, USA

gxzhang7@uci.edu

Nada Lahjouji

Blizzard Inc

Irvine, USA

nlahjouji@blizzard.com

Yiming Lin

University of California, Berkeley

Berkeley, USA

yiminglin@berkeley.edu

Ashwin Colaco

University of California, Irvine

Irvine, USA

acolaco@uci.edu

ABSTRACT

Large language models make it possible to pose semantic questions over diverse, multi-modal data. Recent systems give such workloads the declarative feel of a database through semantic operators: relational operators whose conditions a model judges. Most of them now run on a relational engine, yet almost none keeps what the model says past the query: every judgment is discarded on completion and paid for again the next time a query needs it. We present the tag model and tag operators, the right unit for semantic processing, and OCTOPUS, a prototype built as a middleware over DBMS. Two mechanisms are central. First, the tag: each semantic answer a model produces is written back to the relation as data, which the database engine filters, indexes, and stores as it would any other. Second, the tag operator: the unit into which common semantic operators are translated, which fixes the granularity of reuse. A model judges a tuple once, and later queries reuse that judgment as data: through relationships between predicates, a stored judgment can accept a tuple for a later predicate, eliminate one that cannot satisfy it, simplify its test, or order the search of a query that stops early. On the movie scenario of SemBench, our prototype sends the model 10 to 108× fewer rows than iPDB, ThalamusDB, Palimpzest, and LOTUS at broadly competitive quality, and three of its eight queries issue no model call at all. More broadly, a database that keeps its judgments lets its schema grow from the questions its users ask, so that each semantic answer is paid for once, stays consistent across queries, and can be audited through its provenance.

PVLDB Reference Format:

GuangXue Zhang, Nada Lahjouji, Yiming Lin, Ashwin Colaco, and Sharad Mehrotra. OCTOPUS: Towards A Tag Model for Cross-Query Reuse in Semantic Query Processing [Vision]. PVLDB, 20(1): XXX-XXX, 2027. doi:XX.XX/XXX.XX

PVLDB Artifact Availability:

The source code, data, and/or other artifacts have been made available at https://github.com/Delilah1230/octopus_vision.

Sharad Mehrotra

University of California, Irvine

Irvine, USA

sharad@ics.uci.edu

1 INTRODUCTION

Large language models make it possible to evaluate, at query time, a class of conditions relational databases cannot support: predicates whose satisfaction is computed over the meaning of unstructured content rather than typed values. Consider applications that hold large collections of multi-modal data, such as Amazon, whose catalogue carries product descriptions, customer reviews along with pictures, or Netflix, whose movies carry synopses and trailers. Given the number of customers such platforms serve, the questions asked on them cannot be anticipated. Users phrase questions in their own terms, so the set of predicates a workload will eventually ask is unbounded and unknown when the schema is designed. A customer may search Amazon for “a Christmas-themed gift that suits my grandparents”, or parents may look for “a comedy that adults enjoy but is still suitable for young children”. No column of either schema records whether a product is Christmas-themed or whether a film is suitable for children. Instead, a model such as an LLM analyzes the question on the fly and judges which products or movies semantically satisfy it.

Although such questions rarely repeat literally, the judgments their predicates require often overlap: gift and holiday themes return every holiday season, and family-suitable films are asked for by other families as well. An LLM agent that answers each question in isolation cannot exploit this overlap. The agent retains nothing between queries, so every semantic judgment is discarded on completion and paid for again the next time it is needed, and none of the pruning and reordering a database optimizer would apply is available to it. Semantic operator systems answer such questions with relational-style operators (filter, map, join) whose condition is written in natural language and judged by an LLM.

We compare recent semantic operator systems in Table 1 from four angles: planner-level optimization, operator-level optimization, whether the system is built upon a DBMS, and whether it caches model results. Among the systems listed in Table 1, only LOTUS [25] and Palimpzest [23] are built as standalone engines, while the others build their semantic operators upon a DBMS (inside DuckDB [27] or Snowflake [8], as UDFs, or as a layer over DuckDB). The last column compares whether a system caches model results; iPDB [18], PLOP [24], and FlockMTL [11] do, but only for duplicate tuples within a query, and a cross-query cache is provided by LOTUS and AIDB [14], under the constraint of an identical prompt, which limits the use case.

This work is licensed under the Creative Commons BY-NC-ND 4.0 International License. Visit https://creativecommons.org/licenses/by-nc-nd/4.0/ to view a copy of this license. For any use beyond those covered by this license, obtain permission by emailing info@vldb.org. Copyright is held by the owner/author(s). Publication rights licensed to the VLDB Endowment.

Proceedings of the VLDB Endowment, Vol. 20, No. 1 ISSN 2150-8097. doi:XX.XX/XXX.XX

Table 1: Comparison of current representative semantic query processing systems. Planner: plan-level optimization. SemOps: semantic operator-level optimization. DB-based: integration with a relational DBMS. Cache: caching of semantic inference results. Circles denote full, partial, and no support.

PlannerSemOpsDB-basedCache
LOTUS [25]○●○①
Palimpzest [23]●○○○
iPDB [18]①①●①
PLOP [24]●○①①
ThalamusDB [15]①①①○
FlockMTL [11]○●①①
Sema [26]●①●○
Sema-SQL [21]●①①○
Cortex AISQL [22]①●●○

We propose a new approach, built on two notions: tag operators and tags. A tag operator is a semantic operator, only a more basic one: it takes a single semantic condition and issues one model call about a single tuple, or about a single pair of tuples. A tag holds the value a model returns, as well as other information such as a confidence score, the model name, and a timestamp, which help track when each tag was produced and at what quality. A tag is an ordinary column the DBMS stores, indexes, and filters like any other, read and written through SQL. This granularity is what makes such reuse possible: an answer produced for a whole table at once can be reused only by a query asking the same question of the same data, whereas an answer stored in a tag serves any later tag operator and any future query that needs that tuple judged. None of the DB-based systems in Table 1 keeps a judgment past the query; at most it is kept within one. Reuse of arbitrary semantic conditions requires a data model designed for it. With the small set of tag operators that we define in Section 3, we are able to express the semantic operators commonly used in other semantic operator systems, by decomposing them into a composition of tag operators and ordinary relational operators (Section 3.2), but at a granularity at which the returned answers can be stored and reused.

Reuse also reaches beyond the identical question: through relationships between predicates, which an LLM judges from their meaning, the judgments a tuple already carries can accept it for a later predicate, eliminate it, or simplify its test; where they only make an answer more likely, they can still order the search of a query that stops early (Section 4).

To study the feasibility of this approach we built OCTOPUS, a prototype that extends a DBMS (PostgreSQL, but the design is not limited to it) with our tag model. Further, OCTOPUS aims to make writing the operator program optional: the user asks a question in natural language, and an LLM-based parser produces the plan of operators from it, though a plan can also be submitted directly. Queries that share semantic conditions then grow cheaper over the workload, since the tags written for earlier queries already answer part of new ones. On SemBench's [19] movie scenario, OCTOPUS judges 10 to 108×108\times fewer rows and pairs than four baselines, at competitive quality. The savings are the visible part of a larger shift. Every tag is a column no designer anticipated, added because a user asked, so the database's schema grows from its workload. Because each judgment is stored with its provenance, the same question receives the same answer across queries, and every answer can be audited or re-judged. A database used this way does not merely call a model: it accumulates what the model has established about its data, shared by every application that queries it.

This paper is thus organized as follows: Section 2 presents that data model, the tag, and the design of the semantic system built on a database that supports it. Section 3 argues that semantic operators are too coarse to be the unit of reuse, defines the tag operators as the appropriate unit, and shows how the existing operators translate onto them. Section 4 shows how the judgments a tuple already carries decide, simplify, or order the evaluation of later predicates. Section 5 reports a feasibility study with OCTOPUS, and Section 6 lays out the directions database research must pursue to make semantic operators first-class citizens of the database.

References (11)