---
title: Incremental Query Refinement (IncreQA)
url: https://www.emergentmind.com/topics/incremental-query-refinement-increqa
type: topic
---

# Incremental Query Refinement (IncreQA)

Searching arXiv for recent and foundational papers on Incremental Query Refinement and closely related formulations.
arXiv search query: "Incremental Query Refinement IncreQA interactive query clarification database preferences query changing preferences"
Incremental Query Refinement (IncreQA) denotes an iterative mode of query processing in which the operative query representation is updated as additional constraints, preferences, feedback, or system-state changes become available. In EHR-ChatQA, the term is used explicitly for an interaction flow “where users add constraints to existing queries” and the agent must maintain and rewrite SQL over multiple turns [2509.23415]. Closely related formulations revise preference relations in relational databases, clarify ambiguous search requests through simulated interaction, rerank knowledge-graph answers from labeled examples, refine query embeddings in a continuous latent space after retrieval failure, or incrementally update optimizer state when costs change [0607013] [2205.15918] [2508.13663] [2607.00446] [1409.6288]. This suggests that IncreQA is best understood as a family of iterative update procedures for query semantics and execution behavior rather than a single canonical algorithm.

## 1. Scope and lineage

A recurrent feature across the literature is that the object being refined differs by setting. In relational preference querying, the refined object is a binary preference relation over tuples; in conversational database access, it is a progressively constrained SQL statement; in interactive IR, it is the ranking of candidate reformulations; in knowledge-graph QA, it is a reranked answer distribution; in video retrieval, it is a latent query embedding; and in adaptive query optimization, it is the optimizer’s declarative search state [0607013] [2509.23415] [2205.15918] [2508.13663] [2607.00446] [1409.6288].

| Work | Refined object | Incremental signal |
|---|---|---|
| “Database Querying under Changing Preferences” [0607013] | Preference relation $R \subseteq T \times T$ | Revised preferences via union, prioritized, and Pareto composition |
| “Interactive Query Clarification and Refinement via User Simulation” [2205.15918] | Ranking over candidate reformulations $Q=\{q_1,\dots,q_m\}$ | Turn-level feedback $(q_t^+,q_t^-)$ |
| “From Conversation to Query Execution” [2509.23415] | SQL query $S_t$ | Newly revealed constraints $c_t$ plus clarification and tool use |
| “Interactive Query Answering on Knowledge Graphs with Soft Entity Constraints” [2508.13663] | Answer scores $\mathrm{score}_{\rm rerank}(e\mid Q,P(T))$ | Incremental positive and negative entity labels |
| “VideoSearch-R1” [2607.00446] | Latent query embedding $q_t$ | Retrieval verification and generated soft query tokens |
| “Enabling Incremental Query Re-Optimization” [1409.6288] | Datalog-maintained optimizer state | Cost and selectivity deltas |

Historically, the relational treatment of changing preferences provides an early formal foundation: it studies how a query is transformed by revising the preference relation itself and when order-theoretic properties survive revision [0607013]. Later work moves the same incremental logic into interactive retrieval and QA settings, where the update source is no longer a revised binary relation but user feedback, tool-mediated disambiguation, or learned latent corrections [2205.15918] [2509.23415] [2508.13663] [2607.00446]. In systems work, the query need not change semantically at all; instead, the optimizer’s internal representation is updated incrementally under changing costs [1409.6288].

## 2. Formal models of iterative refinement

Several papers formalize IncreQA as a state-update process. In EHR-ChatQA, the initial question is $Q_0$, the user reveals a sequence of concrete constraints $C=\{c_1,c_2,\dots,c_K\}$, and the agent must produce an updated SQL query at each step,
$$
S_t = f_t(Q_0,\{c_1,\dots,c_t\}), \quad t=1\dots K,
$$
with final output $S_{\mathrm{final}} \equiv S_K = f(Q_0,C)$ [2509.23415]. The refinement function includes clarifications, tool calls, value-linking, and SQL generation.

In interactive clarification for document retrieval, the initial query embedding is $q_0 \in \mathcal Q$, the latent user intent embedding is $i \in \mathbb D$, and the system operates over a fixed candidate set of reformulations $Q=\{q_1,\dots,q_m\}$. Each turn returns ordered feedback
$$
\mathrm{feedback}_t=(q_t^+,q_t^-),
$$
where the accepted reformulation is selected by dot-product similarity to the latent intent, and after $T$ turns the system chooses the highest-ranked reformulation $q^\*$ for document retrieval [2205.15918].

In knowledge-graph QA with soft constraints, the base query remains a conjunctive query $Q(x)$, but refinement acts on scores rather than symbolic syntax. The approximate QA model yields $\mathrm{score}_{\rm orig}(e\mid Q)$, a preference set
$$
P(T)=\{(e_1,\ell_1),\dots,(e_T,\ell_T)\}, \quad \ell_i\in\{0,1\},
$$
encodes preferred and non-preferred examples, and the reranked score is
$$
\mathrm{score}_{\rm rerank}(e\mid Q,P(T))
=
\mathrm{score}_{\rm orig}(e\mid Q)+\Delta(e\mid P(T)).
$$
The adjustment must raise preferred entities above non-preferred ones while not distorting the original global ranking more than necessary [2508.13663].

In VideoSearch-R1, the query state is a latent embedding
$$
q_t \in \mathbb R^{L_t \times D},
$$
the retriever returns a top-1 video, verification produces a match or not-match label, and when retrieval fails the policy generates a block of soft query tokens $\Delta q_t \in \mathbb R^{N \times D}$. The update is written as
$$
q_{t+1}=q_t+\alpha\cdot \Delta q_t,
$$
while the implementation uses concatenation of new embeddings to the original fixed text tokens [2607.00446].

In the preference-query framework, the formal state is a binary relation $R \subseteq T \times T$ over tuples, typically required to be irreflexive and transitive, yielding a strict partial order (SPO). A weak order (WO) is defined as transitive, total, but not necessarily antisymmetric; it partitions tuples into ties and orders the blocks [0607013]. Across these formulations, the constant structural feature is staged update under partial information, but the refined state ranges from symbolic logic to embeddings and optimizer views.

## 3. Relational preference revision

The most explicit algebra of incremental refinement appears in the treatment of changing preferences in relational databases. Given two preference relations $R_1$ and $R_2$, revision may use union composition, prioritized composition, or Pareto composition [0607013].

Union composition is the set-theoretic union $R_1 \cup R_2$. Because this may violate transitivity, it is often followed by transitive closure:
$$
(R_1 \cup R_2)^+.
$$
Prioritized composition gives strict priority to $R_1$:
$$
x (R_1 \succ R_2) y \iff R_1(x,y)\ \vee\ (\neg R_1(y,x)\wedge R_2(x,y)).
$$
Pareto composition defines preference when one relation wins and the other does not defeat it:
$$
x (R_1 \otimes R_2) y \iff (R_1(x,y)\wedge \neg R_2(y,x))\ \vee\ (R_2(x,y)\wedge \neg R_1(y,x)).
$$

The framework analyzes when order-theoretic properties are preserved. If $R_1$ and $R_2$ are irreflexive, then $R_1 \circ R_2$ is irreflexive for $\circ \in \{\cup,\succ,\otimes\}$. Union may fail to be transitive and therefore requires closure. Prioritized composition remains transitive if $R_1$ and $R_2$ are SPOs and $R_2$ is transitive on the $R_1$-incomparability zones. Pareto composition is transitive when both component relations are transitive. When the inputs are weak orders, prioritized and Pareto composition produce weak orders again, possibly after merging tied blocks [0607013].

The paper also gives algebraic laws that enable incremental evaluation rather than full recomputation. Prioritized composition is associative,
$$
(R_1 \succ R_2)\succ R_3 = R_1 \succ (R_2 \succ R_3),
$$
Pareto composition is commutative,
$$
R_1 \otimes R_2 = R_2 \otimes R_1,
$$
and a distributive law is provided for a mix of union and prioritized composition:
$$
(R_1 \cup R_2)\succ R_3 = (R_1 \succ R_3)\cup (R_2 \succ R_3).
$$
These laws permit staged update of already materialized preference components instead of reconstructing the full relation from scratch [0607013].

Two extensions broaden the framework. A finite restriction $R|T_n = R \cap (T_n \times T_n)$ allows an “unbounded” preference relation to be evaluated only on the current candidate set. An SPO can also be extended into a weak order by taking transitive closure and completing each incomparability class into ties [0607013]. A hotel example illustrates the semantics: price and rating preferences can be Pareto-composed so that a tuple wins by being strictly cheaper and not lower rated, or strictly higher rated and not more expensive; rating can then be prioritized over price, so that any rating win trumps price while equal ratings fall back on price [0607013].

## 4. Conversational clarification and SQL refinement

In interactive retrieval, refinement is often driven by explicit clarification dialogue rather than algebraic composition. The simulated clarification framework in IR models a two-agent interaction between an IR system agent and a simulated user agent. At each turn, the system ranks the current reformulation pool, selects two candidates under a selection policy such as top-2, random sampling, or K-means, receives ordered preference feedback from the user, optionally prunes the pool, and repeats for up to $T$ turns [2205.15918]. The ranking model is pairwise and inspired by RankNet: a hierarchical RNN encodes feedback history, and pairwise cross-entropy is used for training. The simulated user is assumed to be greedy and fully cooperative, with no position or presentation bias [2205.15918].

The evaluation uses MS MARCO 2020 Passages, with a test set of 43 queries and a dev subset of 1,000 queries. Final retrieval is performed by a dense retriever with FAISS, and performance is measured with MRR@10 and MAP@10. On the test set, the initial query yields MRR@10 = 0.4554 and MAP@10 = 0.3382; MonoT5 ranking over the reformulation pool yields MRR@10 = 0.4713; after one simulated turn, K-means yields MRR@10 = 0.5232; and by $T=5$, K-means reaches MRR@10 = 0.5515 and MAP@10 = 0.3347 [2205.15918]. All selection policies show monotonic gains with more turns, and K-means consistently outperforms alternatives, indicating that semantic diversification better exploits user feedback [2205.15918].

The EHR-ChatQA benchmark instantiates IncreQA as a database-agent workflow in which an LLM-based user begins with a broad question and reveals at most one or two new constraints per turn. The agent scans for missing filter criteria or ambiguous terminology, may ask a clarifying question, explores schema with `table_search()` and `column_search(table)`, resolves free-text values with `value_substring_search(table, column, v)` and `value_similarity_search(table, column, v)`, and then rewrites a single new SQL query $S_t$ from scratch, including all constraints in the `WHERE` clause and following SQLite-specific rules [2509.23415]. Execution occurs through `sql_execute(query=S_t)`, and the returned table is presented in natural language with a brief explanation of how each constraint was enforced [2509.23415].

The benchmark contains 286 IncreQA instances, with 145 on MIMIC-IV★ and 141 on eICU★, and evaluates robustness across five independent trials per task using $\mathrm{Pass@}k$, $\mathrm{Pass}^k$, and $\mathrm{Gap}\text{-}k = \mathrm{Pass@}k - \mathrm{Pass}^k$ [2509.23415]. Across closed-source LLMs, $\mathrm{Pass@}5$ is approximately 90–95%, but $\mathrm{Pass}^5$ drops by 35–60 percentage points. For o4-mini, $\mathrm{Pass@}5 = 95.1\%$, $\mathrm{Pass}^5 = 58.4\%$, and Gap = 36.7%; for Gemini-2.5-Flash, $\mathrm{Pass@}5 = 91.3\%$, $\mathrm{Pass}^5 = 47.9\%$, and Gap = 43.4%; and an open-source model such as Llama 3.3-70B reaches approximately $\mathrm{Pass@}5 = 66.8\%$ and $\mathrm{Pass}^5 = 11.2\%$ [2509.23415]. Failure analysis distinguishes consistent failures, dominated by Value Linking Errors at approximately 47% and complex SQL-generation mistakes at approximately 25%, from inconsistent failures, which are overwhelmingly due to brittle SQL contexts at approximately 72%, where slight variations in clarification language cause earlier constraints to be dropped when SQL is rewritten [2509.23415].

## 5. Soft constraints and latent-space refinement

A major development in recent work is the shift from discrete query reformulation to soft or latent refinement. In knowledge-graph QA, the Neural Query Reranker (NQR) augments an approximate answer distribution with user-supplied examples of preferred and non-preferred entities [2508.13663]. Each entity has a pretrained embedding $\mathbf e \in \mathbb R^d$, the preference set is represented as a matrix
$$
\mathbf M \in \mathbb R^{T\times(d+1)},
$$
whose rows are $[\mathbf e_i \Vert \ell_i]$, and a Transformer/self-attention module with pooling maps $\mathbf M$ to a preference vector $\mathbf m = g_\theta(\mathbf M) \in \mathbb R^d$ [2508.13663]. For candidate entity $e$, the model forms
$$
\mathbf u_e = [\mathbf e \Vert \mathbf m \Vert \alpha_e] \in \mathbb R^{2d+1},
$$
passes it through a two-layer MLP to obtain a scalar adjustment, and reranks all entities accordingly [2508.13663]. The interactive update algorithm appends one labeled preference at a time, rebuilds $\mathbf M$, recomputes $\mathbf m$, and updates all scores; the total computation in the update steps costs $O(t^2 + |\mathcal V|)$ because self-attention is $O(t^2)$ and scoring is linear in the number of entities [2508.13663].

Training balances adaptation to soft constraints against preservation of the original answer distribution. The preference margin loss pushes positives above negatives with margin $\gamma$,
$$
\mathcal L_{\rm pref}(t)
=
\sum_{e^+\in P^+}\sum_{e^-\in P^-}
\max\bigl(0,\gamma + a^{(t)}[e^-]-a^{(t)}[e^+]\bigr),
$$
while
$$
\mathcal L_{\rm ans}(t)
=
D_{KL}\bigl(\mathrm{softmax}(\{\alpha_e\}) \Vert \mathrm{softmax}(\{a^{(t)}[e]\})\bigr)
$$
preserves the original global ranking distribution, and the total loss is
$$
\mathcal L(t)=\mathcal L_{\rm pref}(t)+\lambda \mathcal L_{\rm ans}(t).
$$
A worked example shows how the preference “Prefer films” can be internalized through a positive label on “Inception” and a negative label on “NobelPrize,” progressively separating film entities from a non-film entity while preserving the original order among film answers [2508.13663].

VideoSearch-R1 pushes refinement further into continuous latent space. At each turn, a cross-modal retriever computes $f(q_t)^\top f(v)$ scores and returns the top-1 video, the agent verifies whether it matches the intent, and if the label is not match, Soft Query Refinement (SQR) autoregressively generates $N$ new soft query tokens in $\mathbb R^{N\times D}$ [2607.00446]. Supervised fine-tuning uses a contrastive retrieval loss $\mathcal L_{ret}$ of InfoNCE form on each generated soft block, adds a temporal-grounding loss $\mathcal L_{time}$ when a match occurs, and optimizes
$$
\mathcal L_{SFT} = \mathcal L_{verif} + \mathcal L_{ret} + \mathbf 1[y^{ret}=match]\mathcal L_{time}.
$$
After supervised fine-tuning, the entire reasoning–retrieval policy is optimized with Group Relative Policy Optimization (GRPO), where the total reward is
$$
R_i = R^{format}_i + R^{verif}_i + R^{ret}_i + \mathbf 1[y^{ret}=match]R^{time}_i,
$$
the advantage is group-normalized, and the objective is a PPO-style clipped objective with a KL penalty [2607.00446].

The paper argues for soft over hard rewriting on both computational and retrieval grounds. Hard query refinement typically generates 20–30 new text tokens per turn, while SQR needs only 8 dense vectors; continuous tokens are matched directly in the same embedding space as the search engine; fine-grained updates can be made with small steps; and InfoNCE on continuous embeddings provides stronger gradients than next-token prediction [2607.00446]. Empirically, SQR improved R@1 by approximately 7 points versus an approximately 3.7 point gain from hard rewrite, at one-third the token-generation cost [2607.00446]. A plausible implication is that latent-space IncreQA is especially suitable when the retrieval layer itself operates in embedding space and textual rewrites introduce unnecessary surface-form noise.

## 6. Adaptive optimization, robustness, and limitations

Incrementality can also target execution planning rather than query semantics. The incremental query re-optimizer of “Enabling Incremental Query Re-Optimization” recasts System-R/Volcano-style optimization as recursive Datalog views for plan enumeration, cost estimation, and best-plan selection [1409.6288]. `SearchSpace` rules enumerate physical plans, `PlanCost` rules aggregate child costs and local operator costs, `BestCost` uses a min aggregate over plan costs, and `BestPlan` materializes the corresponding optimal plan [1409.6288]. When a scan or non-scan cost changes, delta tuples are emitted into base relations such as `ScanCost` or `NonScanCost`, and standard incremental view-maintenance techniques propagate the effect through the optimizer state [1409.6288].

Three pruning techniques are central. Aggregate selection with tuple-source suppression prevents any newly derived `PlanCost` tuple with cost at least the current `BestCost` from being propagated further. Reference counting associates each `SearchSpace` tuple with the number of parent plans that still depend on it and garbage-collects tuples whose count falls to zero. Recursive bounding generalizes branch-and-bound by maintaining a `Bound(e,p)` relation derived from both local best cost and parent-derived bounds, and any plan whose cost is at least that bound may be pruned [1409.6288]. The implementation stores optimizer state in indexed in-memory relations, keeps small priority queues for `BestCost` and `Bound`, memoizes summaries, and revisits only the affected portion of the DAG under a cost change [1409.6288].

The experimental results show both static and incremental benefits. Across 4–8-way TPC-H joins, the system is within 10–50% of Volcano’s latency, prunes 35–80% of OR-nodes and 55–75% of AND-nodes, and in incremental re-optimization achieves 5–10× speedup over full re-planning for a large-table scan-cost adjustment and 12× to more than 300× speedups for join-selectivity updates [1409.6288]. In the LinearRoad SegToll streaming setting, non-incremental re-optimization takes approximately 200 ms each time and limits adaptivity to approximately 2 re-plans per second, whereas incremental re-optimization drops from approximately 0.4 s to near zero as the stream stabilizes, reaches more than 20 re-plans per second with latencies of 10–100 ms, and reduces total re-optimization time over a 300 s trace from approximately 60 s to 5.8 s [1409.6288].

Across the broader IncreQA literature, a recurring limitation is that refinement quality depends on the fidelity of the update signal. In simulated IR clarification, the user is unrealistically greedy and fully cooperative, and the reformulation pool is static rather than generated on the fly [2205.15918]. In EHR-ChatQA, high $\mathrm{Pass@}5$ combined with much lower $\mathrm{Pass}^5$ indicates sensitivity to dialogue-path variation rather than a lack of one-shot capability [2509.23415]. In knowledge-graph reranking, the objective explicitly constrains the model not to distort the original ranking more than necessary, reflecting a design tension between adaptation and preservation [2508.13663]. In soft video refinement, the method assumes that retrieval verification and downstream temporal grounding can jointly shape the latent update through reward signals [2607.00446]. A common misconception is therefore that incremental refinement is merely iterative query rewriting. The literature shows a broader picture: the refinement target may be a preference order, a candidate-query ranking, a SQL program, an answer-score distribution, a latent embedding trajectory, or an optimizer’s internal search graph [0607013] [2205.15918] [2509.23415] [2508.13663] [2607.00446] [1409.6288].

Source: https://www.emergentmind.com/topics/incremental-query-refinement-increqa