arXiv(opens in a new tab)cs.IRAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.27017

ProRetrieval: Learning to Orchestrate Hybrid Search via Executable Program Synthesis

Chengsong You, Zhen Sun, Yunhai Hu, Junwei Zhou, Xiaoyu Cao, Binyu Li, Ziyan Zhao, Weiyao Wang, Liren Lu, Zhijie Ye, Yumo Cao, Yitao Long, Yiwei Xu, Qiyi Jiang, Xuanyi Fu, Yufan Chen, Yilun Li, Rongkang Xiong, Yiran Zou, Nan Du

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

Chengsong You1,3^{1,3}, Zhen Sun1,3^{1,3}, Yunhai Hu4^{4}, Junwei Zhou2∗^{2*}, Xiaoyu Cao1^{1}, Binyu Li1^{1}, Ziyan Zhao1^{1}, Weiyao Wang1^{1}, Liren Lu3^{3}, Zhijie Ye3^{3}, Yumo Cao1^{1}, Yitao Long4^{4}, Yiwei Xu1,3^{1,3}, Qiyi Jiang1^{1}, Xuanyi Fu5^{5}, Yufan Chen5^{5}, Yilun Li5^{5}, Rongkang Xiong5^{5}, Yiran Zou1^{1}, Nan Du2∗^{2*}

1^{1}Thin Red Line 2^{2}Matter Innovation Inc. 3^{3}East China Normal University

4^{4}New York University 5^{5}Independent Researcher

51275901122@stu.ecnu.edu.cn sunzhen@thinredline.com.cn yh5961@nyu.edu

zjw330501@gmail.com frankdu@matter.ai

Abstract

Real-world retrieval often composes structured constraints with semantic intents over text and images through arbitrary Boolean logic. Existing hybrid pipelines such as reciprocal rank fusion or self-querying retrievers admit only a fixed form of composition, while recent reinforcement-learning retrievers train the language model as a query generator for a single backend, leaving the orchestration of heterogeneous retrieval paths outside its action space. We propose ProRetrieval, which recasts the language model as a retrieval orchestrator: given a natural-language query, it synthesizes an executable program in a hybrid DSL interleaving SQL operators over structured fields with vector-retrieval primitives over text and images, with SQL itself providing the logical algebra that fuses heterogeneous candidate sets. We train Qwen3-4B with GRPO and DAPO under a hierarchical four-term reward, and evaluate on two new benchmarks built from Amazon products and Enron email. Our 4B model surpasses GPT-5.5 (Hit@1 0.81 vs. 0.69 on e-commerce; 0.91 vs. 0.86 on email) and Claude Opus 4.7 and a comprehensive suite of retrieval, LLM-augmented, structured-query, and graph-based baselines. Code: https://anonymous.4open.science/r/ProRetrieval/; data: https://huggingface.co/datasets/anonymous-7219/ProRetrieval.

1 Introduction

Real-world retrieval rarely reduces to either symbolic filtering or pure semantic matching. A user may ask for “last week’s emails from the marketing team about the Q3 budget, but not the archived ones”, or for “a wireless headphone under $200 from Sony or Bose, with strong noise-cancelling reviews, in matte black”. Such queries share two properties: information is split across heterogeneous backends (relational fields, text and image indices), and constraints are composed by arbitrary Boolean connectives (disjunction, negation, and nested groups). Solving them requires not only understanding what the user wants, but deciding how to find it: which conditions to push down as exact filters, which intents to pose as semantic queries, and how to logically combine the resulting candidate sets.

Existing methods fall short along two axes. On expressive power, pure retrievers (Robertson and Zaragoza, 2009; Karpukhin et al., 2020) cover a single modality; fusion pipelines (Cormack et al., 2009) express only weighted disjunction; and self-querying retrievers (Chase, 2023) admit simple key-value conjunctions but not disjunction, negation, or nested predicates. On orchestration capability, recent RL approaches such as Search-R1 (Jin et al., 2025) and DeepRetrieval (Jiang et al., 2025a) train models to issue better queries to a single backend but cannot compose across heterogeneous stores. Hybrid retrieval therefore requires enlarging the model's role from query generator to retrieval orchestrator, with an action space that is itself an executable program over a logically complete operator set.

We propose ProRetrieval, a framework that trains a small language model to orchestrate hybrid retrieval by synthesizing executable retrieval programs. Our key observation is that SQL's logical algebra (selection, conjunction, disjunction, negation, and nested subqueries) can serve as the orchestration skeleton, while vector retrieval is incorporated as a first-class primitive whose results plug into SQL through candidate-set placeholders (e.g., id IN <text_0>). This reduces orchestration to learnable program generation in a hybrid DSL while inheriting SQL's logical completeness for free. We train Qwen3-4B with GRPO (Shao et al., 2024) and DAPO (Yu et al., 2025) under a hierarchical four-term reward (format, execution, result, length) that mirrors the layered correctness

∗^{*}Corresponding authors.

Figure

Figure 1: Overview of ProRetrieval. Given a natural-language query, the RL-trained policy emits a hybrid DSL program that combines an SQL filter with text and image vector-retrieval primitives. The DSL execution engine dispatches each primitive to its embedding-based backend, substitutes the returned candidate sets into the SQL through placeholder injection, and lets the SQL engine perform the final AND/OR/NOT fusion to produce ranked results. The model is trained in two stages: SFT on expert DSL examples followed by RL (GRPO/DAPO) under a hierarchical composite reward over format, executability, and result quality.

requirements of executable program generation. To evaluate the framework we construct two hybrid retrieval benchmarks from public corpora: Amazon e-commerce (structured + text + image) and Enron email (structured + text), with queries spanning single-leaf to nested Boolean expressions.

On both benchmarks our 4B model surpasses GPT-5.5 (Hit@1 0.81 vs. 0.69 on e-commerce; 0.91 vs. 0.86 on email) and a comprehensive suite of retrieval, reranking, structured-query, and graph-based baselines. In summary, our contributions are:

• A new paradigm: retrieval program synthesis. We reformulate hybrid retrieval as program generation in a DSL that unifies SQL operators with multimodal vector primitives, lifting the model’s action space from a textual query to a logically complete executable program. The expressiveness strictly subsumes that of fixed-fusion pipelines and single-backend RL retrievers.

• A hierarchical reward for executable program RL. We introduce a four-term composite reward (format, execution, result, length) that mirrors the layered correctness requirements of program generation, generalizing the single-signal rewards used by prior RL retrievers.

• Two hybrid retrieval benchmarks and a comprehensive empirical study. We release benchmarks over Amazon products and Enron email, together with four paradigms of baselines, and demonstrate that a 4B open-source model trained with our framework consistently outperforms frontier commercial LLMs at a fraction of their inference cost.

References (41)